Closed Bug 1112334 Opened 5 years ago Closed 5 years ago

Write a test for basic Find My Device logging in existing account

Categories

(Firefox OS Graveyard :: Gaia::UI Tests, defect)

x86
macOS
defect
Not set

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: martijn.martijn, Assigned: martijn.martijn)

Details

Attachments

(1 file)

46 bytes, text/x-github-pull-request
jlorenzo
: review+
RobertC
: review+
Details | Review
This is as part of one of the requests made at: https://etherpad.mozilla.org/functionalautomationtests

This is a basic automated test that checks you can log in with an existing Firefox accounts account, using the Find My Device UI.
Attached file findmydevice
The mail address and password need to be adjusted yet. I think we could the same credentials as the Facebook account for that.
Attachment #8537460 - Flags: review?(jlorenzo)
Comment on attachment 8537460 [details] [review]
findmydevice

This is a good start which is working on my device. One major thing to me in this PR: I don't think it's the best practice to have locators inside the test itself. That's why I propose to split the "FindMyDevice" page class into "FirefoxAccount", "FindMyDeviceSignedIn" and "FindMyDeviceNotSignedIn" (not sure about the naming of the 2 last).

See more details in the PR.
Attachment #8537460 - Flags: review?(jlorenzo) → review-
Assignee: nobody → martijn.martijn
Comment on attachment 8537460 [details] [review]
findmydevice

Thanks for the review, my previous pull request clearly wasn't good enough for review (sorry about that).
I think I addressed all of your comments.

I'm now using the gmail account that we already use for the findmydevice login part.
Attachment #8537460 - Flags: review- → review?(jlorenzo)
Comment on attachment 8537460 [details] [review]
findmydevice

That's way cleaner! Like you mentioned, we have some trouble with the keyboard as per this adhoc job[1]. I prefer to not land this test as it fails around half of the time, for now.

I also found a couple of nits (unused imports) and one function which should be renamed, I think.

[1] http://jenkins1.qa.scl3.mozilla.com/view/UI/job/flame-kk.ui.adhoc/475/console
Attachment #8537460 - Flags: review?(jlorenzo) → review-
QA Whiteboard: [fxosqa-auto-s6]
Flags: in-qa-testsuite?(martijn.martijn)
Ok, I updated the pull request with your review comments.
I'll take a look at the failures once I get home.
Hmm, the Jenkins adhoc run shows all kinds of failures.
1 - There are 3 failures where there seems to be some kind of connection issue.
2 - There are 5 failures related to the problem that tapping on the Next or Done button doesn't work well, because of the keyboard appearing.
3 - There are 6 failues, because of the age verification dialog, which should have never appeared.

I think I might be able to solve 2 and I think 3 ultimately also happens because of 2 (see first screenshot failure in the Jenkins run).
The connection issue isn't solvable, the website just has to be reliable, I guess.
Ok, this is interesting. After 10 retries, I get the failure in tap_done with the "Unable to connect" screenshot.
After that, I keep getting the Age verification dialog failure.
When I try to login on https://accounts.firefox.com/signin , I get "Maximumaantal pogingen overschreden" (maximum attempts reached).

So I think there is a maximum of 10 times that I'm allowed to log in (from the same ip address?) and then I have to wait for a while (not sure how long, it's not very long at least).
Comment on attachment 8537460 [details] [review]
findmydevice

I updated the pull request now.
This is what I added and that seems to have made the keyboard issue go away:
--- a/tests/python/gaia-ui-tests/gaiatest/apps/settings/regions/fxaccounts.py
+++ b/tests/python/gaia-ui-tests/gaiatest/apps/settings/regions/fxaccounts.py
@@ -28,6 +28,13 @@ class FirefoxAccount(Base):
             expected.element_present(*self._input_locator))
         Wait(self.marionette).until(expected.element_displayed(input))
         input.send_keys(email)
+
+        # Wait until the keyboard is completely displayed, otherwise tapping
+        # the next button is unreliable
+        self.marionette.switch_to_frame()
+        Wait(self.marionette).until(lambda m: self.keyboard.is_keyboard_displayed)
+        self.marionette.switch_to_frame(iframe)
+
         self.marionette.find_element(*self._next_locator).tap()
 
     def enter_password(self, password=None):
@@ -35,6 +42,14 @@ class FirefoxAccount(Base):
             expected.element_present(*self._password_locator))
         Wait(self.marionette).until(expected.element_displayed(input))
         input.send_keys(password)
+
+        # Wait until the keyboard is completely displayed, otherwise tapping
+        # the next button is unreliable
+        active_frame = self.marionette.get_active_frame()
+        self.marionette.switch_to_frame()
+        Wait(self.marionette).until(lambda m: self.keyboard.is_keyboard_displayed)
+        self.marionette.switch_to_frame(active_frame)
+
         self.marionette.find_element(*self._next_locator).tap()
 
     def tap_done(self):
Attachment #8537460 - Flags: review- → review?(jlorenzo)
I can test the pull request on Jenkins adhoc try run, but I would have to do it in batches of max 8 repeats.
(In reply to Martijn Wargers [:mwargers] (QA) from comment #10)
> http://jenkins1.qa.scl3.mozilla.com/job/flame-kk.ui.adhoc/512/

Please ignore this one.
In 1 failure in those 2 Jenkins ad hoc try runs, but that was unrelated (Marionette connection issue).
Comment on attachment 8537460 [details] [review]
findmydevice

I left just a comment on a minor change to make regarding the documentation. After that I'm good with merging this test.
Attachment #8537460 - Flags: review?(jlorenzo) → review+
Attachment #8537460 - Flags: review?(robert.chira)
I followed your suggestion regarding the documentation, Johan, thanks for calling that out.
Comment on attachment 8537460 [details] [review]
findmydevice

Unfortunately I got the age verification dialog on my first run of the test on the device. Could the number of attempts be tied to the account name rather than the ip?

Martijn, would it be possible to add a couple of extra steps where we check if the age verification dialog is displayed and if so we handle it?
Flags: needinfo?(martijn.martijn)
Attachment #8537460 - Flags: review?(robert.chira) → review-
(In reply to Robert Chira [:RobertC] from comment #17)
> Unfortunately I got the age verification dialog on my first run of the test
> on the device. Could the number of attempts be tied to the account name
> rather than the ip?

Which account are you using? Did you use the account that is provided by: https://github.com/mozilla/webqa-credentials/blob/master/b2g/common.json#L19
You should not get the age verification dialog there, since that account is already used.
Flags: needinfo?(martijn.martijn) → needinfo?(robert.chira)
Comment on attachment 8537460 [details] [review]
findmydevice

My credentials were out-of-date and that is why I had issues running the test.

Merged in master:
https://github.com/mozilla-b2g/gaia/commit/47e9853c1a81afb90cd48dcbc3005dd676784821
Flags: needinfo?(robert.chira)
Attachment #8537460 - Flags: review- → review+
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Thanks!
QA Whiteboard: [fxosqa-auto-s6] → [fxosqa-auto-from-s6][fxosqa-auto-s7][fxosqa-auto-points=4]
Flags: in-qa-testsuite?(martijn.martijn) → in-qa-testsuite+
You need to log in before you can comment on or make changes to this bug.