Closed Bug 897970 Opened 6 years ago Closed 6 years ago

Robocop testBookmark fails consistently on Android x86 emulators

Categories

(Firefox for Android :: General, defect)

x86
Android
defect
Not set

Tracking

()

RESOLVED FIXED
Firefox 25

People

(Reporter: gbrown, Assigned: gbrown)

References

Details

Attachments

(1 file)

Robocop's testBookmark fails consistently when run on the x86 emulator setup (see bug 891959). It also fails locally when run on a Motorola Razr i (XT890).

This is likely a fails-on-Jellybean rather than a fails-on-x86 problem, but it is the effort to get tests running on x86 that is bringing about this bug.

Locally, I see the first call to toggleBookmark() bring up the menu, but then fail to tap on the bookmark "star" icon.
0 INFO SimpleTest START
1 INFO TEST-START | testBookmark
EventExpecter: no longer listening for Gecko:Ready
2 INFO TEST-PASS | testBookmark | checking that bookmarks list exists - bookmarks list exists and has 4 children (the default bookmarks)
3 INFO TEST-PASS | testBookmark | Find default bookmark - Default bookmark for about:firefox found
4 INFO TEST-PASS | testBookmark | Find default bookmark - Default bookmark for about:home found
5 INFO TEST-PASS | testBookmark | Find default bookmark - Default bookmark for https://addons.mozilla.org/en-US/android/ found
6 INFO TEST-PASS | testBookmark | Find default bookmark - Default bookmark for http://support.mozilla.org/en-US/products/mobile found
7 INFO TEST-PASS | testBookmark | bookmarks list has 5 children (the default bookmarks and the new one) - 5 should equal 5
8 INFO TEST-PASS | testBookmark | list item can be retrieved - android.widget.RelativeLayout@215cff98
PaintExpecter: no longer listening for events
9 INFO TEST-PASS | testBookmark | Page is not bookmarked initially - false should equal false
10 INFO TEST-PASS | testBookmark | Awesomebar URL typed properly - http://mochi.test:8888/tests/robocop/robocop_blank_01.html should equal http://mochi.test:8888/tests/robocop/robocop_blank_01.html
EventExpecter: no longer listening for DOMContentLoaded
PaintExpecter: no longer listening for events
waitForText timeout on Bookmark
11 INFO TEST-UNEXPECTED-FAIL | testBookmark | intentional fail - intentional fail
Exception caught during test!
junit.framework.AssertionFailedError: 11 INFO TEST-UNEXPECTED-FAIL | testBookmark | intentional fail - intentional fail
        at junit.framework.Assert.fail(Assert.java:50)
        at org.mozilla.fennec.FennecMochitestAssert._logMochitestResult(FennecMochitestAssert.java:107)
        at org.mozilla.fennec.FennecMochitestAssert.ok(FennecMochitestAssert.java:136)
        at org.mozilla.fennec.tests.testBookmark.toggleBookmark(testBookmark.java:156)
        at org.mozilla.fennec.tests.testBookmark.setUpBookmark(testBookmark.java:163)
        at org.mozilla.fennec.tests.testBookmark.runMenuTest(testBookmark.java:55)
        at org.mozilla.fennec.tests.testBookmark.testBookmark(testBookmark.java:48)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:511)
        at android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:214)
        at android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:199)
        at android.test.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTestCase2.java:192)
        at org.mozilla.fennec.tests.BaseTest.runTest(BaseTest.java:133)
        at junit.framework.TestCase.runBare(TestCase.java:134)
        at junit.framework.TestResult$1.protect(TestResult.java:115)
        at junit.framework.TestResult.runProtected(TestResult.java:133)
        at junit.framework.TestResult.run(TestResult.java:118)
        at junit.framework.TestCase.run(TestCase.java:124)
        at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:190)
        at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:175)
        at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:555)
        at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1584)
12 INFO TEST-UNEXPECTED-FAIL | testBookmark | Exception caught - junit.framework.AssertionFailedError: 11 INFO TEST-UNEXPECTED-FAIL | testBookmark | intentional fail - intentional fail
13 INFO TEST-END | testBookmark | finished in 41181ms
14 INFO TEST-START | Shutdown
15 INFO Passed: 9
16 INFO Failed: 2
17 INFO Todo: 0
18 INFO SimpleTest FINISHED
INFO | automation.py | Application ran for: 0:00:45.109988
testBookmark uses its own toggleBookmark() function to select the bookmark menu item. It seems too simplistic, looking for "Bookmark" text in the menu...how can that work on ICS+, where only the icon is shown? 

There is more complicated code in BaseTest's Navigation.bookmark(), which accounts for the differences between phones/tablets and different android versions. But it is only used by the disabled test testWebContentContextMenu. I tried using that code in testBookmark, but it fails also.

There is also another approach used in testHistoryTab -- that works great!
Blocks: 892688
I pasted the wrong log in Comment 1.

0 INFO SimpleTest START
1 INFO TEST-START | testBookmark
EventExpecter: no longer listening for Gecko:Ready
2 INFO TEST-PASS | testBookmark | checking that bookmarks list exists - bookmarks list exists and has 4 children (the default bookmarks)
3 INFO TEST-PASS | testBookmark | Find default bookmark - Default bookmark for about:firefox found
4 INFO TEST-PASS | testBookmark | Find default bookmark - Default bookmark for about:home found
5 INFO TEST-PASS | testBookmark | Find default bookmark - Default bookmark for https://addons.mozilla.org/en-US/android/ found
6 INFO TEST-PASS | testBookmark | Find default bookmark - Default bookmark for http://support.mozilla.org/en-US/products/mobile found
7 INFO TEST-PASS | testBookmark | bookmarks list has 5 children (the default bookmarks and the new one) - 5 should equal 5
8 INFO TEST-PASS | testBookmark | list item can be retrieved - android.widget.RelativeLayout@21571158
PaintExpecter: no longer listening for events
9 INFO TEST-PASS | testBookmark | Page is not bookmarked initially - false should equal false
10 INFO TEST-PASS | testBookmark | Awesomebar URL typed properly - http://mochi.test:8888/tests/robocop/robocop_blank_01.html should equal http://mochi.test:8888/tests/robocop/robocop_blank_01.html
EventExpecter: no longer listening for DOMContentLoaded
PaintExpecter: no longer listening for events
waitForText timeout on Bookmark
Exception caught during test!
junit.framework.AssertionFailedError: The text: Bookmark is not found!
	at junit.framework.Assert.fail(Assert.java:50)
	at junit.framework.Assert.assertTrue(Assert.java:20)
	at com.jayway.android.robotium.solo.Clicker.clickOnText(Clicker.java:330)
	at com.jayway.android.robotium.solo.Solo.clickOnText(Solo.java:839)
	at org.mozilla.fennec.tests.testBookmark.toggleBookmark(testBookmark.java:154)
	at org.mozilla.fennec.tests.testBookmark.setUpBookmark(testBookmark.java:160)
	at org.mozilla.fennec.tests.testBookmark.runMenuTest(testBookmark.java:55)
	at org.mozilla.fennec.tests.testBookmark.testBookmark(testBookmark.java:48)
	at java.lang.reflect.Method.invokeNative(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:511)
	at android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:214)
	at android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:199)
	at android.test.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTestCase2.java:192)
	at org.mozilla.fennec.tests.BaseTest.runTest(BaseTest.java:133)
	at junit.framework.TestCase.runBare(TestCase.java:134)
	at junit.framework.TestResult$1.protect(TestResult.java:115)
	at junit.framework.TestResult.runProtected(TestResult.java:133)
	at junit.framework.TestResult.run(TestResult.java:118)
	at junit.framework.TestCase.run(TestCase.java:124)
	at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:190)
	at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:175)
	at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:555)
	at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1584)
11 INFO TEST-UNEXPECTED-FAIL | testBookmark | Exception caught - junit.framework.AssertionFailedError: The text: Bookmark is not found!
12 INFO TEST-END | testBookmark | finished in 51167ms
13 INFO TEST-START | Shutdown
14 INFO Passed: 9
15 INFO Failed: 1
16 INFO Todo: 0
17 INFO SimpleTest FINISHED
INFO | automation.py | Application ran for: 0:00:55.118882
This moves the bookmarking code from testHistoryTab to BaseTest.toggleBookmark, and then calls toggleBookmark from both testHistoryTab and testBookmark. 

I have marked Navigation.bookmark() as deprecated -- we can re-visit that when we try to enable testWebContentContextMenu.

Try run at https://tbpl.mozilla.org/?tree=Try&rev=5251432f7fc0.
Attachment #780980 - Flags: review?(jmaher)
Comment on attachment 780980 [details] [diff] [review]
re-use code from testHistoryTab

Review of attachment 780980 [details] [diff] [review]:
-----------------------------------------------------------------

eventually basetest will have everything!
Attachment #780980 - Flags: review?(jmaher) → review+
https://hg.mozilla.org/mozilla-central/rev/277c1e376c3c
Status: NEW → RESOLVED
Closed: 6 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → Firefox 25
Duplicate of this bug: 893652
Blocks: 936226
You need to log in before you can comment on or make changes to this bug.