Closed
Bug 1108720
Opened 11 years ago
Closed 5 years ago
Add "go back" session history tests
Categories
(Firefox for Android Graveyard :: Testing, defect)
Tracking
(Not tracked)
RESOLVED
INCOMPLETE
People
(Reporter: vivek, Assigned: vivek)
References
Details
(Whiteboard: [lang=java])
Attachments
(2 files)
This is a follow up bug to test the functionality of the bug 847435 using robocop
| Assignee | ||
Comment 1•11 years ago
|
||
A WIP patch to test tab history popup on long press back button. This WIP only runs tests on tablet as detailed in question below.
@mcomella: Is it possible to simulate long press on back button in robotium. My simple search didn't yield me positive results https://code.google.com/p/robotium/issues/list?can=1&q=long+press&colspec=ID+Type+Stars+Status+Priority+Milestone+Owner+Summary&cells=tiles
@bnicholson: The current WIP only tests for history item count under various condition. Should the tests include check for current tab highlighted in bold?
Attachment #8536128 -
Flags: review?(michael.l.comella)
Attachment #8536128 -
Flags: feedback?(bnicholson)
Comment 2•11 years ago
|
||
Comment on attachment 8536128 [details] [diff] [review]
WIP
Review of attachment 8536128 [details] [diff] [review]:
-----------------------------------------------------------------
Looking good! I'd recommend adding tests that check that the page URL or title is correct at each load step. And yes, I think it'd be a good idea to test that the selected page matches the expected one.
::: mobile/android/base/tests/testTabHistoryMenu.java
@@ +45,5 @@
> + checkTabHistoryItems(3);
> +
> + // Dismiss tab history popup by selecting an history item.
> + // Here, we assume "Browser Blank Page 02" is not visible anywhere else on the screen.
> + getSolo().clickOnText(StringHelper.ROBOCOP_BLANK_PAGE_02_TITLE);
You'll want to wrap this with WaitHelper (http://mxr.mozilla.org/mozilla-central/source/mobile/android/base/tests/helpers/WaitHelper.java#75) to make sure the page has loaded before continuing.
@@ +62,5 @@
> + // Dismiss tab history popup by pressing menu.
> + getSolo().clickOnButton(R.id.menu);
> +
> + // Navigate a step back in tab history.
> + getSolo().goBack();
You'll also want to wait here. I think this can be replaced with NavigationHelper.goBack (http://mxr.mozilla.org/mozilla-central/source/mobile/android/base/tests/helpers/NavigationHelper.java#57).
Attachment #8536128 -
Flags: feedback?(bnicholson) → feedback+
Comment on attachment 8536128 [details] [diff] [review]
WIP
Review of attachment 8536128 [details] [diff] [review]:
-----------------------------------------------------------------
Looking pretty good - just a few more details to get right.
::: mobile/android/base/tests/testTabHistoryMenu.java
@@ +15,5 @@
> +
> +/**
> + * Test that validates tab history popup menu interactions.
> + */
> +public class testTabHistoryMenu extends UITest {
We're trying to cut down on the number of tests because it takes a long time to setUp/tearDown our tests (e.g. create new profile, push to device). Perhaps this can be combined with testSessionHistory.
@@ +34,5 @@
> +
> + // Currently, long press on hardware/ software action button is not possible through Robotium.
> + // The tests are limited only to long press on tablet toolbar back and forward button.
> + if (DeviceHelper.isTablet()) {
> + helperTestTablet();
You should return before we test pages on non-tablet devices to save testing resources.
Alternatively, this is the right approach in testSessionHistory.
@@ +45,5 @@
> + checkTabHistoryItems(3);
> +
> + // Dismiss tab history popup by selecting an history item.
> + // Here, we assume "Browser Blank Page 02" is not visible anywhere else on the screen.
> + getSolo().clickOnText(StringHelper.ROBOCOP_BLANK_PAGE_02_TITLE);
Maybe wrap this in ToolbarComponent? `clickOnBackHistoryItem(int size, String title)` which would both open the menu, assert the size, and click the given title.
@@ +52,5 @@
> + mToolbar.longPressBackButton();
> + checkTabHistoryItems(2);
> +
> + // Dismiss tab history popup by clicking outside history menu.
> + getSolo().clickOnScreen(0, 0);
After each time the tab history dialog is dismissed, you should assert that the tab history menu is actually gone.
@@ +59,5 @@
> + mToolbar.longPressForwardButton();
> + checkTabHistoryItems(2);
> +
> + // Dismiss tab history popup by pressing menu.
> + getSolo().clickOnButton(R.id.menu);
This doesn't open the menu so it seems weird to click the menu button specifically to close the history menu - perhaps just click at (0, 0) again? You can make this a helper method.
If you choose to click the menu button, try mAppMenu.pressOverflowMenuButton(). In general, if you're using Solo directly in the test, consider whether a method already exists or if the framework could be expanded to encompass such functionality.
@@ +77,5 @@
> + /**
> + * Waits for Tab history menu to appear within default wait duration and checks for tab history items.
> + * Will throw an AssertionError if the duration is elapsed and condition is not satisfied.
> + */
> + public void checkTabHistoryItems(final int count) {
nit: -> assertTabHistoryItemCount
Why not include this as part of ToolbarComponent?
It'd be better to assert specific title content though. Followup?
@@ +83,5 @@
> + @Override
> + public boolean isSatisfied() {
> + return getSolo().waitForFragmentByTag("tabHistoryFragment");
> + }
> + });
Definitely move this wait until longPressBack/ForwardButton - other developers expected to long press the back button are typically expecting the menu, will not think to wait on this, and cause intermittent issuse - that's the beauty of having the framework do the heavy lifting.
You can assert that the tab history menu is open here instead.
Attachment #8536128 -
Flags: review?(michael.l.comella) → feedback+
OS: Linux → Android
Hardware: x86_64 → ARM
Since Vivek does not have a tablet device, I ran the tests for him locally - it doesn't pass.
Updated•11 years ago
|
Mentor: bnicholson
Comment 5•5 years ago
|
||
We have completed our launch of our new Firefox on Android. The development of the new versions use GitHub for issue tracking. If the bug report still reproduces in a current version of [Firefox on Android nightly](https://play.google.com/store/apps/details?id=org.mozilla.fenix) an issue can be reported at the [Fenix GitHub project](https://github.com/mozilla-mobile/fenix/). If you want to discuss your report please use [Mozilla's chat](https://wiki.mozilla.org/Matrix#Connect_to_Matrix) server https://chat.mozilla.org and join the [#fenix](https://chat.mozilla.org/#/room/#fenix:mozilla.org) channel.
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → INCOMPLETE
Updated•5 years ago
|
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•