Skip to content

Philimon/reenable_sync_fxa_test_suite #717

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pypom = "2.2.4"
taskcluster-taskgraph = "==9.0.0"
jsonpath-ng = "1.6.1"
pillow = "<10.5"
pyfxa = "0.7.0"
pyfxa = "0.8.1"
ruff = "0.9.6"
pytest-rerunfailures = "14.0"
slack-sdk = "3.31.0"
Expand Down
28 changes: 28 additions & 0 deletions SELECTOR_INFO.md
Original file line number Diff line number Diff line change
Expand Up @@ -2042,6 +2042,34 @@ Location: In the FxA signin page flow
Path to .json: modules/data/fxa_home.components.json
```
```
Selector Name: do-it-later-button
Selector Data: "inline_recovery_key_setup_create_do_it_later"
Description: Coninute fxa account creation flow
Location: In the FxA signin page flow
Path to .json: modules/data/fxa_home.components.json
```
```
Selector Name: login-password-input
Selector Data: "choice-pair-not-now"
Description: Dont pair with phone now
Location: In the FxA signin page flow
Path to .json: modules/data/fxa_home.components.json
```
```
Selector Name: signed-in-status
Selector Data: "div[role='status']"
Description: Sign in status
Location: In the FxA signin page flow
Path to .json: modules/data/fxa_home.components.json
```
```
Selector Name: manage-sync-button
Selector Data: "signup_confirmed_sync_manage_sync_button"
Description: sign up and sync confirmation
Location: In the FxA signin page flow
Path to .json: modules/data/fxa_home.components.json
```
```
Selector Name: signin-otp-input
Selector Data: "[data-testid='signin-token-code-input-field']"
Description: The FxAccount One Time Password entry field
Expand Down
24 changes: 24 additions & 0 deletions modules/browser_object_panel_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,21 @@ def click_sync_sign_in_button(self) -> BasePage:
self.click_on("fxa-sign-in")
return self

def open_account_toolbar(self):
"""
Open the FxA account toolbar.
"""
self.click_on("sync-user-button")
return self

def click_finish_sign_in_button(self):
"""
Click FxA finish sign in button.
"""
self.open_account_toolbar()
self.click_on("fxa-finish-sign-in")
return self

def log_out_fxa(self) -> BasePage:
"""
Click FxA signout button.
Expand All @@ -89,6 +104,15 @@ def manage_fxa_account(self) -> BasePage:
self.get_element("fxa-manage-account-button").click()
return self

@BasePage.context_chrome
def manage_fxa_finish_sign_in(self):
"""
Open the FxA management flow to finish sign in.
"""
self.open_account_toolbar()
self.click_on("fxa-manage-account-button")
return self

def confirm_sync_in_progress(self) -> BasePage:
"""
Check that FxA Sync Label is set to "Syncing…"
Expand Down
171 changes: 89 additions & 82 deletions modules/data/fxa_home.components.json
Original file line number Diff line number Diff line change
@@ -1,84 +1,91 @@
{
"login-email-input": {
"selectorData": "input[type='email']",
"strategy": "css",
"groups": [
"requiredForPage"
]

},

"submit-button": {
"selectorData": "button[type='submit']",
"strategy": "css",
"groups": [
"doNotCache"
]
},

"signup-password-input": {
"selectorData": "[data-testid='new-password-input-field']",
"strategy": "css",
"groups": []
},

"signup-password-repeat-input": {
"selectorData": "[data-testid='verify-password-input-field']",
"strategy": "css",
"groups": []
},

"age-input": {
"selectorData": "[data-testid='age-input-field']",
"strategy": "css",
"groups": []
},

"card-header": {
"selectorData": "card-header",
"strategy": "class",
"groups": []
},

"signup-otp-input": {
"selectorData": "[data-testid='confirm-signup-code-input-field']",
"strategy": "css",
"groups": []
},

"signin-otp-input": {
"selectorData": "[data-testid='signin-token-code-input-field']",
"strategy": "css",
"groups": []
},

"otp-input": {
"selectorData": "input[inputmode='numeric']",
"strategy": "css",
"groups": []
},

"connected-heading": {
"selectorData": "fxa-connected-heading",
"strategy": "id",
"groups": []
},

"continue-browsing-link": {
"selectorData": "cad-not-now",
"strategy": "id",
"groups": []
},

"login-password-input": {
"selectorData": "input[type='password']",
"strategy": "css",
"groups": []
},

"sign-in-button": {
"selectorData": "use-logged-in",
"strategy": "id",
"groups": []
}
"login-email-input": {
"selectorData": "input[name='email']",
"strategy": "css",
"groups": [
"requiredForPage"
]
},
"submit-button": {
"selectorData": "button[type='submit']",
"strategy": "css",
"groups": [
"doNotCache"
]
},
"signup-password-input": {
"selectorData": "[data-testid='new-password-input-field']",
"strategy": "css",
"groups": []
},
"signup-password-repeat-input": {
"selectorData": "[data-testid='verify-password-input-field']",
"strategy": "css",
"groups": []
},
"age-input": {
"selectorData": "[data-testid='age-input-field']",
"strategy": "css",
"groups": []
},
"card-header": {
"selectorData": "card-header",
"strategy": "class",
"groups": []
},
"signup-otp-input": {
"selectorData": "[data-testid='confirm-signup-code-input-field']",
"strategy": "css",
"groups": []
},
"signin-otp-input": {
"selectorData": "[data-testid='signin-token-code-input-field']",
"strategy": "css",
"groups": []
},
"otp-input": {
"selectorData": "input[inputmode='numeric']",
"strategy": "css",
"groups": []
},
"connected-heading": {
"selectorData": "fxa-connected-heading",
"strategy": "id",
"groups": []
},
"continue-browsing-link": {
"selectorData": "cad-not-now",
"strategy": "id",
"groups": []
},
"login-password-input": {
"selectorData": "input[type='password']",
"strategy": "css",
"groups": []
},
"signed-in-status": {
"selectorData": "div[role='status']",
"strategy": "css",
"groups": []
},
"manage-sync-button": {
"selectorData": "signup_confirmed_sync_manage_sync_button",
"strategy": "id",
"groups": []
},
"do-it-later-button": {
"selectorData": "inline_recovery_key_setup_create_do_it_later",
"strategy": "id",
"groups": []
},
"not-now-button": {
"selectorData": "choice-pair-not-now",
"strategy": "id",
"groups": []
},
"sign-in-button": {
"selectorData": "use-logged-in",
"strategy": "id",
"groups": []
}
}
7 changes: 7 additions & 0 deletions modules/data/panel_ui.components.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@
"strategy": "css",
"groups": []
},
"fxa-finish-sign-in": {
"selectorData": "appMenu-header-description",
"strategy": "id",
"groups": []
},

"fxa-sync-label": {
"selectorData": "syncnow-label",
Expand All @@ -57,6 +62,8 @@
"groups": []
},



"customize-toolbar": {
"selectorData": "overflowMenu-customize-button",
"strategy": "id",
Expand Down
5 changes: 5 additions & 0 deletions modules/page_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,11 @@ def title_contains(self, url_part: str) -> Page:
self.expect(EC.title_contains(url_part))
return self

def title_is(self, url_part: str) -> Page:
"""Expect helper: wait until driver URL is given text or timeout"""
self.expect(EC.title_is(url_part))
return self

def verify_opened_image_url(self, url_substr: str, pattern: str) -> Page:
"""
Given a part of a URL and a regex, wait for that substring to exist in
Expand Down
16 changes: 4 additions & 12 deletions modules/page_object_fxa_home.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
from selenium.common.exceptions import NoSuchElementException, TimeoutException
from selenium.webdriver.support import expected_conditions as EC

from modules.page_base import BasePage


Expand All @@ -19,20 +16,14 @@ def fill_password(self, password: str) -> BasePage:
self.set_content_context()
self.fill("login-password-input", password, press_enter=False)
self.get_element("submit-button").click()
# If OTP is needed, wait for the field to be ready, else move on.
try:
self.custom_wait(timeout=3).until(
EC.presence_of_element_located(self.get_selector("connected-heading"))
)
except (TimeoutException, NoSuchElementException):
self.element_exists("otp-input")
self.element_visible("signed-in-status")
return self

def create_new_account(self, password: str, age=30) -> BasePage:
"""Fill out the password and age fields, then submit and wait for code"""
self.fill("signup-password-input", password, press_enter=False)
self.fill("signup-password-repeat-input", password, press_enter=False)
self.fill("age-input", str(age), press_enter=False)
# self.fill("age-input", str(age), press_enter=False)
self.element_clickable("submit-button")
self.get_element("submit-button").click()
self.element_has_text("card-header", "Enter confirmation code")
Expand All @@ -42,7 +33,7 @@ def fill_otp_code(self, otp: str) -> BasePage:
"""Given an OTP, confirm the account, submit, and wait for account activation"""
self.fill("otp-input", otp, press_enter=False)
self.get_element("submit-button").click()
self.element_exists("connected-heading")
self.title_is("Mozilla accounts")
return self

def finish_account_setup(self, password: str) -> BasePage:
Expand All @@ -51,4 +42,5 @@ def finish_account_setup(self, password: str) -> BasePage:
self.driver.switch_to.window(self.driver.window_handles[-1])
self.fill("login-password-input", password, press_enter=False)
self.get_element("submit-button").click()
self.element_visible("signed-in-status")
return self
Loading
Loading