Skip to content

Commit 30f254c

Browse files
Merge pull request #717 from mozilla/philimon/sync_fxa_test
Philimon/reenable_sync_fxa_test_suite
2 parents ae796b2 + 52f3e1c commit 30f254c

File tree

10 files changed

+204
-148
lines changed

10 files changed

+204
-148
lines changed

Pipfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pypom = "2.2.4"
1616
taskcluster-taskgraph = "==9.0.0"
1717
jsonpath-ng = "1.6.1"
1818
pillow = "<10.5"
19-
pyfxa = "0.7.0"
19+
pyfxa = "0.8.1"
2020
ruff = "0.9.6"
2121
pytest-rerunfailures = "14.0"
2222
slack-sdk = "3.31.0"

SELECTOR_INFO.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2042,6 +2042,34 @@ Location: In the FxA signin page flow
20422042
Path to .json: modules/data/fxa_home.components.json
20432043
```
20442044
```
2045+
Selector Name: do-it-later-button
2046+
Selector Data: "inline_recovery_key_setup_create_do_it_later"
2047+
Description: Coninute fxa account creation flow
2048+
Location: In the FxA signin page flow
2049+
Path to .json: modules/data/fxa_home.components.json
2050+
```
2051+
```
2052+
Selector Name: login-password-input
2053+
Selector Data: "choice-pair-not-now"
2054+
Description: Dont pair with phone now
2055+
Location: In the FxA signin page flow
2056+
Path to .json: modules/data/fxa_home.components.json
2057+
```
2058+
```
2059+
Selector Name: signed-in-status
2060+
Selector Data: "div[role='status']"
2061+
Description: Sign in status
2062+
Location: In the FxA signin page flow
2063+
Path to .json: modules/data/fxa_home.components.json
2064+
```
2065+
```
2066+
Selector Name: manage-sync-button
2067+
Selector Data: "signup_confirmed_sync_manage_sync_button"
2068+
Description: sign up and sync confirmation
2069+
Location: In the FxA signin page flow
2070+
Path to .json: modules/data/fxa_home.components.json
2071+
```
2072+
```
20452073
Selector Name: signin-otp-input
20462074
Selector Data: "[data-testid='signin-token-code-input-field']"
20472075
Description: The FxAccount One Time Password entry field

modules/browser_object_panel_ui.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,21 @@ def click_sync_sign_in_button(self) -> BasePage:
7171
self.click_on("fxa-sign-in")
7272
return self
7373

74+
def open_account_toolbar(self):
75+
"""
76+
Open the FxA account toolbar.
77+
"""
78+
self.click_on("sync-user-button")
79+
return self
80+
81+
def click_finish_sign_in_button(self):
82+
"""
83+
Click FxA finish sign in button.
84+
"""
85+
self.open_account_toolbar()
86+
self.click_on("fxa-finish-sign-in")
87+
return self
88+
7489
def log_out_fxa(self) -> BasePage:
7590
"""
7691
Click FxA signout button.
@@ -89,6 +104,15 @@ def manage_fxa_account(self) -> BasePage:
89104
self.get_element("fxa-manage-account-button").click()
90105
return self
91106

107+
@BasePage.context_chrome
108+
def manage_fxa_finish_sign_in(self):
109+
"""
110+
Open the FxA management flow to finish sign in.
111+
"""
112+
self.open_account_toolbar()
113+
self.click_on("fxa-manage-account-button")
114+
return self
115+
92116
def confirm_sync_in_progress(self) -> BasePage:
93117
"""
94118
Check that FxA Sync Label is set to "Syncing…"

modules/data/fxa_home.components.json

Lines changed: 89 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,91 @@
11
{
2-
"login-email-input": {
3-
"selectorData": "input[type='email']",
4-
"strategy": "css",
5-
"groups": [
6-
"requiredForPage"
7-
]
8-
9-
},
10-
11-
"submit-button": {
12-
"selectorData": "button[type='submit']",
13-
"strategy": "css",
14-
"groups": [
15-
"doNotCache"
16-
]
17-
},
18-
19-
"signup-password-input": {
20-
"selectorData": "[data-testid='new-password-input-field']",
21-
"strategy": "css",
22-
"groups": []
23-
},
24-
25-
"signup-password-repeat-input": {
26-
"selectorData": "[data-testid='verify-password-input-field']",
27-
"strategy": "css",
28-
"groups": []
29-
},
30-
31-
"age-input": {
32-
"selectorData": "[data-testid='age-input-field']",
33-
"strategy": "css",
34-
"groups": []
35-
},
36-
37-
"card-header": {
38-
"selectorData": "card-header",
39-
"strategy": "class",
40-
"groups": []
41-
},
42-
43-
"signup-otp-input": {
44-
"selectorData": "[data-testid='confirm-signup-code-input-field']",
45-
"strategy": "css",
46-
"groups": []
47-
},
48-
49-
"signin-otp-input": {
50-
"selectorData": "[data-testid='signin-token-code-input-field']",
51-
"strategy": "css",
52-
"groups": []
53-
},
54-
55-
"otp-input": {
56-
"selectorData": "input[inputmode='numeric']",
57-
"strategy": "css",
58-
"groups": []
59-
},
60-
61-
"connected-heading": {
62-
"selectorData": "fxa-connected-heading",
63-
"strategy": "id",
64-
"groups": []
65-
},
66-
67-
"continue-browsing-link": {
68-
"selectorData": "cad-not-now",
69-
"strategy": "id",
70-
"groups": []
71-
},
72-
73-
"login-password-input": {
74-
"selectorData": "input[type='password']",
75-
"strategy": "css",
76-
"groups": []
77-
},
78-
79-
"sign-in-button": {
80-
"selectorData": "use-logged-in",
81-
"strategy": "id",
82-
"groups": []
83-
}
2+
"login-email-input": {
3+
"selectorData": "input[name='email']",
4+
"strategy": "css",
5+
"groups": [
6+
"requiredForPage"
7+
]
8+
},
9+
"submit-button": {
10+
"selectorData": "button[type='submit']",
11+
"strategy": "css",
12+
"groups": [
13+
"doNotCache"
14+
]
15+
},
16+
"signup-password-input": {
17+
"selectorData": "[data-testid='new-password-input-field']",
18+
"strategy": "css",
19+
"groups": []
20+
},
21+
"signup-password-repeat-input": {
22+
"selectorData": "[data-testid='verify-password-input-field']",
23+
"strategy": "css",
24+
"groups": []
25+
},
26+
"age-input": {
27+
"selectorData": "[data-testid='age-input-field']",
28+
"strategy": "css",
29+
"groups": []
30+
},
31+
"card-header": {
32+
"selectorData": "card-header",
33+
"strategy": "class",
34+
"groups": []
35+
},
36+
"signup-otp-input": {
37+
"selectorData": "[data-testid='confirm-signup-code-input-field']",
38+
"strategy": "css",
39+
"groups": []
40+
},
41+
"signin-otp-input": {
42+
"selectorData": "[data-testid='signin-token-code-input-field']",
43+
"strategy": "css",
44+
"groups": []
45+
},
46+
"otp-input": {
47+
"selectorData": "input[inputmode='numeric']",
48+
"strategy": "css",
49+
"groups": []
50+
},
51+
"connected-heading": {
52+
"selectorData": "fxa-connected-heading",
53+
"strategy": "id",
54+
"groups": []
55+
},
56+
"continue-browsing-link": {
57+
"selectorData": "cad-not-now",
58+
"strategy": "id",
59+
"groups": []
60+
},
61+
"login-password-input": {
62+
"selectorData": "input[type='password']",
63+
"strategy": "css",
64+
"groups": []
65+
},
66+
"signed-in-status": {
67+
"selectorData": "div[role='status']",
68+
"strategy": "css",
69+
"groups": []
70+
},
71+
"manage-sync-button": {
72+
"selectorData": "signup_confirmed_sync_manage_sync_button",
73+
"strategy": "id",
74+
"groups": []
75+
},
76+
"do-it-later-button": {
77+
"selectorData": "inline_recovery_key_setup_create_do_it_later",
78+
"strategy": "id",
79+
"groups": []
80+
},
81+
"not-now-button": {
82+
"selectorData": "choice-pair-not-now",
83+
"strategy": "id",
84+
"groups": []
85+
},
86+
"sign-in-button": {
87+
"selectorData": "use-logged-in",
88+
"strategy": "id",
89+
"groups": []
90+
}
8491
}

modules/data/panel_ui.components.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@
3838
"strategy": "css",
3939
"groups": []
4040
},
41+
"fxa-finish-sign-in": {
42+
"selectorData": "appMenu-header-description",
43+
"strategy": "id",
44+
"groups": []
45+
},
4146

4247
"fxa-sync-label": {
4348
"selectorData": "syncnow-label",
@@ -57,6 +62,8 @@
5762
"groups": []
5863
},
5964

65+
66+
6067
"customize-toolbar": {
6168
"selectorData": "overflowMenu-customize-button",
6269
"strategy": "id",

modules/page_base.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,11 @@ def title_contains(self, url_part: str) -> Page:
454454
self.expect(EC.title_contains(url_part))
455455
return self
456456

457+
def title_is(self, url_part: str) -> Page:
458+
"""Expect helper: wait until driver URL is given text or timeout"""
459+
self.expect(EC.title_is(url_part))
460+
return self
461+
457462
def verify_opened_image_url(self, url_substr: str, pattern: str) -> Page:
458463
"""
459464
Given a part of a URL and a regex, wait for that substring to exist in

modules/page_object_fxa_home.py

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
from selenium.common.exceptions import NoSuchElementException, TimeoutException
2-
from selenium.webdriver.support import expected_conditions as EC
3-
41
from modules.page_base import BasePage
52

63

@@ -19,20 +16,15 @@ def fill_password(self, password: str) -> BasePage:
1916
self.set_content_context()
2017
self.fill("login-password-input", password, press_enter=False)
2118
self.get_element("submit-button").click()
22-
# If OTP is needed, wait for the field to be ready, else move on.
23-
try:
24-
self.custom_wait(timeout=3).until(
25-
EC.presence_of_element_located(self.get_selector("connected-heading"))
26-
)
27-
except (TimeoutException, NoSuchElementException):
28-
self.element_exists("otp-input")
2919
return self
3020

21+
def is_otp_input_required(self) -> bool:
22+
return len(self.get_elements("otp-input")) > 0
23+
3124
def create_new_account(self, password: str, age=30) -> BasePage:
3225
"""Fill out the password and age fields, then submit and wait for code"""
3326
self.fill("signup-password-input", password, press_enter=False)
3427
self.fill("signup-password-repeat-input", password, press_enter=False)
35-
self.fill("age-input", str(age), press_enter=False)
3628
self.element_clickable("submit-button")
3729
self.get_element("submit-button").click()
3830
self.element_has_text("card-header", "Enter confirmation code")
@@ -42,7 +34,7 @@ def fill_otp_code(self, otp: str) -> BasePage:
4234
"""Given an OTP, confirm the account, submit, and wait for account activation"""
4335
self.fill("otp-input", otp, press_enter=False)
4436
self.get_element("submit-button").click()
45-
self.element_exists("connected-heading")
37+
self.title_is("Mozilla accounts")
4638
return self
4739

4840
def finish_account_setup(self, password: str) -> BasePage:
@@ -51,4 +43,5 @@ def finish_account_setup(self, password: str) -> BasePage:
5143
self.driver.switch_to.window(self.driver.window_handles[-1])
5244
self.fill("login-password-input", password, press_enter=False)
5345
self.get_element("submit-button").click()
46+
self.element_visible("signed-in-status")
5447
return self

0 commit comments

Comments
 (0)