Write robocop test for switch-to-tab

NEW
Unassigned

Status

()

Firefox for Android
General
5 years ago
2 years ago

People

(Reporter: Margaret, Unassigned, Mentored)

Tracking

(Depends on: 1 bug)

Trunk
ARM
Android
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [lang=java])

MozReview Requests

()

Submitter Diff Changes Open Issues Last Updated
Loading...
Error loading review requests:

Attachments

(1 attachment)

(Reporter)

Description

5 years ago
To make sure this doesn't regress again.
(Reporter)

Comment 1

4 years ago
I haven't been working on this, so I'd love to open it up for someone else to help.

To fix this bugs, you'll first want to get robocop tests running locally:
https://wiki.mozilla.org/Auto-tools/Projects/Robocop#Running_tests

Then you'll want to add a new test to the suite of robocop tests.

A good minimal test should look something like:

1) Load a page
2) Open a new tab
3) Enter some characters in the URL bar that match the page from step 1
4) Verify that "Switch to tab" shows up in the UI
5) Click that "Switch to tab" item
6) Verify that we switched to that other tab
Assignee: margaret.leibovic → nobody
Summary: [fig] Write robocop test for switch-to-tab → Write robocop test for switch-to-tab
Whiteboard: [mentor=margaret][lang=java]

Comment 2

4 years ago
I'd like to take this as my first bug if your happy with mentoring me on it Margaret?
(Reporter)

Comment 3

4 years ago
(In reply to basscase from comment #2)
> I'd like to take this as my first bug if your happy with mentoring me on it
> Margaret?

That sounds great!

First of all, do you have a local build environment set up? If not, you should follow the directions here:
https://wiki.mozilla.org/Mobile/Fennec/Android#Building_Fennec

Then after that, you should get robocop tests running locally, as I mentioned in comment 1.

Let me know if you run into any problems. You can also ask questions #mobile on irc.mozilla.org, and you can check out our "Get Involved" page for more resources for newcomers:
https://wiki.mozilla.org/Mobile/Get_Involved
Assignee: nobody → basscase

Comment 4

4 years ago
perfect thanks! I'll get started on setting up my build environment this weekend. when asking questions about this bug should I post them here or would you prefer to use email or irc?
(Reporter)

Comment 5

4 years ago
(In reply to basscase from comment #4)
> perfect thanks! I'll get started on setting up my build environment this
> weekend. when asking questions about this bug should I post them here or
> would you prefer to use email or irc?

Asking questions on IRC will give you the quickest responses, but you can also post questions here if you don't get an answer on IRC.
(Reporter)

Comment 6

4 years ago
Stefan is interested in working on this bug, so I'm going to let him take a shot at it.

basscase, let us know if you've been working on this, and perhaps you two can work together. Or if not, there are lots of other bugs out there that need fixing :)
Assignee: basscase → ss

Comment 7

4 years ago
Ok I'll talk to stefan about working together on it, thanks :)

Comment 8

4 years ago
Apologies for taking so long with this issue, it's currently exam time so there's been no shortage of code for me to write.

Margaret, I've begun work on this bug: https://gist.github.com/sobering/474f7580aca0fe64289f

I'm just wondering if I can get some feedback on what I have so far, to see if I'm on the right track. At this point the code is incomplete and untested, but it's just what I put together from your pseudocode in comment #1.

Just looking for feedback.

(In reply to basscase from comment #7)
> Ok I'll talk to stefan about working together on it, thanks :)

I've decided not to work together on this particular bug, but if you want to work together on another bug I'd be glad to team up! Just shoot me an email!
Flags: needinfo?(margaret.leibovic)

Comment 9

4 years ago
Ok Stefan thanks very much. I haven't had as much time as I'd have liked either as I'm on an internship but that finishes at the end of January so I'll have enough time again then and will definitely get in touch. Thanks guys!
(Reporter)

Comment 10

4 years ago
(In reply to Stefan :Sobering from comment #8)
> Apologies for taking so long with this issue, it's currently exam time so
> there's been no shortage of code for me to write.
> 
> Margaret, I've begun work on this bug:
> https://gist.github.com/sobering/474f7580aca0fe64289f
> 
> I'm just wondering if I can get some feedback on what I have so far, to see
> if I'm on the right track. At this point the code is incomplete and
> untested, but it's just what I put together from your pseudocode in comment
> #1.

This looks like a good start! The one thing I'm wary of is the use of sendKeys, since we've had some reliability issues with that in the past. Perhaps a more reliable approach would be to just use BaseTest's enterUrl method, since the test is just entering text in the url bar:
http://mxr.mozilla.org/mozilla-central/source/mobile/android/base/tests/BaseTest.java#208

(In the future, it's better if you upload WIP patches for feedback, rather than linking to code hosted elsewhere, since it's easier to comment on the code itself. That also creates better bug history.)

I'm also cc'ing gbrown and mcomella, since they're more familiar with the current state of our robocop tests.
Flags: needinfo?(margaret.leibovic)
Disclaimer: I'm not too familiar with BaseTest.

I agree with Margaret's replacement for sendKeys in comment 10.

> String url = getAbsoluteUrl("/robocop/robocop_blank_01.html");
> String urlTitle = "Browser Blank Page 01";

You can get these strings from the StringHelper class (though you'll still have to call getAbsoluteUrl for the url).

> String expectedText = "Switch to tab";

This could be useful elsewhere so I would recommend defining it in the StringHelper class.
Status: NEW → ASSIGNED
(Assignee)

Updated

4 years ago
Mentor: margaret.leibovic@gmail.com
Whiteboard: [mentor=margaret][lang=java] → [lang=java]
This is still a useful test to add.  margaret, mcomella: do you know if such a test already exists?  If not, I'd like to suggest this for a contributor.
Assignee: ss → nobody
Mentor: nalexander@mozilla.com
Status: ASSIGNED → NEW
Flags: needinfo?(michael.l.comella)
Flags: needinfo?(margaret.leibovic)
While I'm not familiar with any such test, some searching brought up testHistory which briefly tests it [1]. It could be worth having it in its own test and comprehensively testing it (and perhaps even removing that part from testHistory so we have a separation of concerns).

[1]: https://mxr.mozilla.org/mozilla-central/source/mobile/android/tests/browser/robocop/testHistory.java#69
Flags: needinfo?(michael.l.comella)
(Reporter)

Comment 14

3 years ago
(In reply to Michael Comella (:mcomella) from comment #13)
> While I'm not familiar with any such test, some searching brought up
> testHistory which briefly tests it [1]. It could be worth having it in its
> own test and comprehensively testing it (and perhaps even removing that part
> from testHistory so we have a separation of concerns).
> 
> [1]:
> https://mxr.mozilla.org/mozilla-central/source/mobile/android/tests/browser/
> robocop/testHistory.java#69

testHistory is disabled:
http://mxr.mozilla.org/mozilla-central/source/mobile/android/tests/browser/robocop/robocop.ini#50

And it has been for a long time.

I would be in favor of implementing a switch-to-tab test that does its own thing, then replacing testHistory with something simpler that isn't as prone to intermittent failures.
Flags: needinfo?(margaret.leibovic)
Depends on: 1227021
(In reply to Nick Alexander :nalexander from comment #15)
> Created attachment 8723256 [details]
> MozReview Request: Bug 904217 - Add switch-to-tab test.
> 
> Review commit: https://reviewboard.mozilla.org/r/36425/diff/#index_header
> See other reviews: https://reviewboard.mozilla.org/r/36425/

mcomella: here's a hack that lets me run an Espresso test from Android Studio.  You can see some non-trivial WIP on using Espresso, etc.
Flags: needinfo?(michael.l.comella)
Writing this link down locally – I have a lot on my plate so I may not get to this soon.
Flags: needinfo?(michael.l.comella)
You need to log in before you can comment on or make changes to this bug.