Closed Bug 1145821 Opened 9 years ago Closed 8 years ago

Add browser menu "Add to reading list" button test

Categories

(Firefox for Android Graveyard :: Testing, defect)

All
Android
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: mcomella, Assigned: Mailkov, Mentored)

References

Details

(Whiteboard: [lang=java][good next bug])

In bug 1127445, we added an "add to reading list" menu option - we should add a test to ensure this button adds and removes items from the reading list as expected. We should combine the test with testReaderModeTitle (and rename that to compensate) to save testing resources (i.e. setting up tests takes a long time so we try to minimize our overall number).
I want to try fixing this bug , so can you elaborate the bug.
Hi, Basam - welcome to Bugzilla! :)

To start, set up a build environment - you can see the instructions here: https://wiki.mozilla.org/Mobile/Fennec/Android

The tests you would be fixing are in our Robocop test framework, so you'll need to set that up too: https://wiki.mozilla.org/Auto-tools/Projects/Robocop

When you make changes in the mobile/android/base/tests/ directory, you should only need to recompile Robocop, not the entire browser, for these changes.

While you're developing, I recommend running just a single test at a time because the full robocop test suite takes a long time to run (at least 30 minutes).

You should look into AppMenuComponent [1] to add the "Add to reading list" button to the component, and press it, such as in testAppMenuPathways [2].

If you need any help, you can reply to this bug, or feel free to message me on IRC - my nick is "mcomella" and you can find me in #mobile. If you need IRC setup instructions, see https://wiki.mozilla.org/IRC

Once you post a patch, we'll assign you to the bug. Thanks!

[1]: https://mxr.mozilla.org/mozilla-central/source/mobile/android/base/tests/components/AppMenuComponent.java
[2]: https://mxr.mozilla.org/mozilla-central/source/mobile/android/base/tests/testAppMenuPathways.java
I'd like to work on this ... can you assign it to me ?
I'd like to work on this ... can you assign it to me ?
Flags: needinfo?(michael.l.comella)
Sure, Melchiorre! Let me know if you have any questions.
Assignee: nobody → miticomilko
Flags: needinfo?(michael.l.comella)
I'm looking this bug ...

I have some questions.

1) The AppComponent code does not seem to work with MenuItems that have text invisible. 
   So for example in AppComponent the code pressMenuItem(MenuItem.FORWARD); does not work or 
   if I add READING_LIST(R.string.overlay_share_reading_list_btn_label) to enum MenuItem and I use
   pressMenuItem(MenuItem.READING_LIST); it does not work too.
   Am I doing something wrong?

2) If AppComponent does not work ... Must I open a new bug? Or simply do I fix it in this bug?

3) I must to rename testReaderModeTitle ... is testReaderModeTitleReadingList ok as name ?
   If it is not, Can you suggest me a better name?
Flags: needinfo?(michael.l.comella)
(In reply to Melchiorre Alastra (:Mailkov) from comment #6)
> 1) The AppComponent code does not seem to work with MenuItems that have text
> invisible.

That's unexpected - we use the content descriptions to match against the menu items so items with icons should be fine. Can you attach the code you're trying to run that's causing you issues?

>    So for example in AppComponent the code pressMenuItem(MenuItem.FORWARD);
> does not work

We use AppComponent.pressMenuItem(MenuItem.FORWARD) here [1] - perhaps that will give you a better sense of how it works?

We check isEnabled in pressMenuItem [2] - perhaps you are trying to add about:home (the default page), which is disabled, to the reading list?

> 2) If AppComponent does not work ... Must I open a new bug? Or simply do I
> fix it in this bug?

In the general case, file a new bug and mark it blocking this bug, but since this code already seems to work maybe we can debug it here.

> 3) I must to rename testReaderModeTitle ... is
> testReaderModeTitleReadingList ok as name ?
>    If it is not, Can you suggest me a better name?

Perhaps testReaderModeChrome? Chrome is the part of the browser that is not the web content.

[1]: https://mxr.mozilla.org/mozilla-central/source/mobile/android/tests/browser/robocop/helpers/NavigationHelper.java#85
[2]: https://mxr.mozilla.org/mozilla-central/source/mobile/android/tests/browser/robocop/components/AppMenuComponent.java#211
Flags: needinfo?(michael.l.comella)
Flags: needinfo?(miticomilko)
I tried to launch testSessionHistory that contains NavigationHelper.goForward() and this is the result:

./mach robocop testSessionHistory


/usr/bin/make -j4 -s install-tests
From _tests: Kept 34491 existing; Added/updated 0; Removed 0 files and 0 directories.
 0:00.00 LOG: MainThread INFO Checking for orphan ssltunnel processes...
 0:00.09 LOG: MainThread INFO Checking for orphan xpcshell processes...
Error deleting /data/anr/traces.txt
 0:00.92 LOG: MainThread INFO Android sdk version '16'; will use this to filter manifests
pk12util: PKCS12 IMPORT SUCCESSFUL
 0:12.44 LOG: MainThread INFO MochitestServer : launching [u'/home/mailkov/prova/mozilla-central/obj-x86_64-unknown-linux-gnu/dist/bin/xpcshell', '-g', '/home/mailkov/prova/mozilla-central/obj-x86_64-unknown-linux-gnu/dist/bin', '-v', '170', '-f', '/home/mailkov/prova/mozilla-central/obj-x86_64-unknown-linux-gnu/dist/bin/components/httpd.js', '-e', "const _PROFILE_PATH = '/tmp/tmplC8wwP.mozrunner'; const _SERVER_PORT = '8888'; const _SERVER_ADDR = '192.168.1.100'; const _TEST_PREFIX = undefined; const _DISPLAY_RESULTS = false;", '-f', '/home/mailkov/prova/mozilla-central/obj-arm-linux-androideabi/_tests/testing/mochitest/server.js']
 0:12.44 LOG: MainThread INFO runtests.py | Server pid: 3151
 0:12.45 LOG: MainThread INFO runtests.py | Websocket server pid: 3154
 0:12.61 LOG: MainThread INFO runtests.py | SSL tunnel pid: 3157
[3151] WARNING: Re-registering a CID?: file /home/mailkov/prova/mozilla-central/xpcom/components/nsComponentManager.cpp, line 551
 0:19.62 SUITE_START: MainThread 1
 0:20.12 LOG: MainThread INFO Unable to copy remote profile; falling back to push.
INFO | automation.py | Application pid: 0
-1282368:52.68 LOG: None INFO SimpleTest START
-1282368:52.68 TEST_START: None testSessionHistory
 1:59.90 LOG: MainThread INFO EventExpecter: no longer listening for Gecko:Ready
-1282367:20.19 LOG: None INFO ToolbarTitleTextChangeVerifier: stored title, "".
 1:59.90 LOG: MainThread INFO EventExpecter: no longer listening for DOMContentLoaded
 1:59.90 LOG: MainThread INFO EventExpecter: no longer listening for DOMTitleChanged
-1282367:22.28 LOG: None INFO ToolbarTitleTextChangeVerifier: state changed to title, "mochi.test:8888/tests/robocop/robocop_blank_01.html".
-1282367:22.28 LOG: None INFO ToolbarTitleTextChangeVerifier: was satisfied.
-1282367:34.12 LOG: None INFO ToolbarTitleTextChangeVerifier: stored title, "mochi.test:8888/tests/robocop/robocop_blank_01.html".
 1:59.90 LOG: MainThread INFO EventExpecter: no longer listening for DOMContentLoaded
 1:59.90 LOG: MainThread INFO EventExpecter: no longer listening for DOMTitleChanged
-1282367:35.89 LOG: None INFO ToolbarTitleTextChangeVerifier: state changed to title, "mochi.test:8888/tests/robocop/robocop_blank_02.html".
-1282367:35.89 LOG: None INFO ToolbarTitleTextChangeVerifier: was satisfied.
-1282367:47.82 LOG: None INFO ToolbarTitleTextChangeVerifier: stored title, "mochi.test:8888/tests/robocop/robocop_blank_02.html".
 1:59.91 LOG: MainThread INFO EventExpecter: no longer listening for DOMContentLoaded
 1:59.91 LOG: MainThread INFO EventExpecter: no longer listening for DOMTitleChanged
-1282367:49.59 LOG: None INFO ToolbarTitleTextChangeVerifier: state changed to title, "mochi.test:8888/tests/robocop/robocop_blank_03.html".
-1282367:49.59 LOG: None INFO ToolbarTitleTextChangeVerifier: was satisfied.
-1282367:52.61 LOG: None INFO ToolbarTitleTextChangeVerifier: stored title, "mochi.test:8888/tests/robocop/robocop_blank_03.html".
 1:59.91 LOG: MainThread INFO EventExpecter: no longer listening for DOMContentLoaded
 1:59.91 LOG: MainThread INFO EventExpecter: no longer listening for DOMTitleChanged
-1282366:04.62 LOG: None INFO ToolbarTitleTextChangeVerifier: state changed to title, "mochi.test:8888/tests/robocop/robocop_blank_02.html".
-1282366:04.62 LOG: None INFO ToolbarTitleTextChangeVerifier: was satisfied.
-1282366:06.67 LOG: None INFO ToolbarTitleTextChangeVerifier: stored title, "mochi.test:8888/tests/robocop/robocop_blank_02.html".
 1:59.91 LOG: MainThread INFO EventExpecter: no longer listening for DOMContentLoaded
 1:59.91 LOG: MainThread INFO EventExpecter: no longer listening for DOMTitleChanged
-1282366:08.68 LOG: None INFO ToolbarTitleTextChangeVerifier: state changed to title, "mochi.test:8888/tests/robocop/robocop_blank_01.html".
-1282366:08.68 LOG: None INFO ToolbarTitleTextChangeVerifier: was satisfied.
-1282366:10.69 LOG: None INFO ToolbarTitleTextChangeVerifier: stored title, "mochi.test:8888/tests/robocop/robocop_blank_01.html".
-1282366:23.47 LOG: None ERROR Exception caught during test! - junit.framework.AssertionFailedError: TEST-UNEXPECTED-FAIL | testSessionHistory | Menu is open - 
	at junit.framework.Assert.fail(Assert.java:50)
	at org.mozilla.gecko.FennecMochitestAssert._logMochitestResult(FennecMochitestAssert.java:128)
	at org.mozilla.gecko.FennecMochitestAssert.ok(FennecMochitestAssert.java:150)
	at org.mozilla.gecko.tests.helpers.AssertionHelper.fAssertTrue(AssertionHelper.java:98)
	at org.mozilla.gecko.tests.components.AppMenuComponent.pressMenuItem(AppMenuComponent.java:208)
	at org.mozilla.gecko.tests.components.AppMenuComponent.pressMenuItem(AppMenuComponent.java:238)
	at org.mozilla.gecko.tests.helpers.NavigationHelper$2.run(NavigationHelper.java:85)
	at org.mozilla.gecko.tests.helpers.WaitHelper.waitForPageLoad(WaitHelper.java:95)
	at org.mozilla.gecko.tests.helpers.NavigationHelper.goForward(NavigationHelper.java:82)
	at org.mozilla.gecko.tests.testSessionHistory.testSessionHistory(testSessionHistory.java:31)
	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.gecko.tests.UITest.runTest(UITest.java:64)
	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:192)
	at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:177)
	at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:555)
	at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1619)

-1282366:23.47 TEST_END: None Harness OK. Subtests passed 71/73. Unexpected 2
Menu is open
------------
Expected PASS, got FAIL

Exception caught
----------------
Expected PASS, got FAIL
junit.framework.AssertionFailedError: TEST-UNEXPECTED-FAIL | testSessionHistory | Menu is open - 
-1282366:23.47 LOG: None INFO TEST-START | Shutdown
-1282366:23.47 LOG: None INFO Passed: 71
-1282366:23.48 LOG: None INFO Failed: 2
-1282366:23.48 LOG: None INFO Todo: 0
-1282366:23.48 LOG: None INFO SimpleTest FINISHED
INFO | automation.py | Application ran for: 0:01:46.384629
Flags: needinfo?(miticomilko) → needinfo?(michael.l.comella)
Depends on: 1144879
(We've been speaking on irc)
Flags: needinfo?(michael.l.comella)
We're removing the add to reading list button.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → INVALID
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.