Skip to content

Commit 81c57e9

Browse files
committed
merge main with fixed tests
2 parents 60bdf8c + 919035d commit 81c57e9

34 files changed

+1070
-52
lines changed

Pipfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ pytest-html = "*"
1515
pypom = "*"
1616
jsonpath-ng = "*"
1717
pillow = "*"
18+
pyfxa = "*"
1819

1920
[dev-packages]
2021
werkzeug = "*"

conftest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,8 @@ def driver(
177177
separator = " "
178178
winsize = [int(s) for s in opt_window_size.split(separator)]
179179
driver.set_window_size(*winsize)
180-
driver.implicitly_wait(opt_implicit_timeout)
180+
timeout = 30 if opt_ci else opt_implicit_timeout
181+
driver.implicitly_wait(timeout)
181182
yield driver
182183

183184
finally:

modules/browser_object_autofill_popup.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,6 @@ def verify_no_popup_panel(self):
2626
element = self.get_element("autofill-panel")
2727
self.expect_not(EC.element_to_be_clickable(element))
2828

29-
def hover_over_element(self, element: str):
30-
"""
31-
Hover over the specified element.
32-
Parameters: element (str): The element to hover over.
33-
"""
34-
with self.driver.context(self.driver.CONTEXT_CHROME):
35-
self.actions.move_to_element(element).perform()
36-
return self
37-
3829
def get_nth_element(self, index: str) -> WebElement:
3930
"""
4031
Get the nth element from the autocomplete list.

modules/browser_object_panel_ui.py

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,53 @@ def navigate_to_about_addons(self):
6565
self.select_panel_setting("customize-toolbar")
6666
with self.driver.context(self.driver.CONTEXT_CHROME):
6767
self.get_element("manage-themes").click()
68+
69+
def click_sync_sign_in_button(self) -> BasePage:
70+
"""
71+
Click FxA sync button.
72+
"""
73+
with self.driver.context(self.driver.CONTEXT_CHROME):
74+
self.open_panel_menu()
75+
self.select_panel_setting("fxa-sign-in")
76+
return self
77+
78+
def log_out_fxa(self) -> BasePage:
79+
"""
80+
Click FxA signout button.
81+
"""
82+
with self.driver.context(self.driver.CONTEXT_CHROME):
83+
self.click_sync_sign_in_button()
84+
self.get_element("fxa-sign-out-button").click()
85+
return self
86+
87+
def manage_fxa_account(self) -> BasePage:
88+
"""
89+
Open the FxA management flow.
90+
"""
91+
with self.driver.context(self.driver.CONTEXT_CHROME):
92+
self.click_sync_sign_in_button()
93+
self.get_element("fxa-manage-account-button").click()
94+
return self
95+
96+
def confirm_sync_in_progress(self) -> BasePage:
97+
"""
98+
Check that FxA Sync Label is set to "Syncing…"
99+
"""
100+
with self.driver.context(self.driver.CONTEXT_CHROME):
101+
self.click_sync_sign_in_button()
102+
self.custom_wait(timeout=30, poll_frequency=0.5).until(
103+
EC.text_to_be_present_in_element(
104+
self.get_selector("fxa-sync-label"), "Syncing"
105+
)
106+
)
107+
return self
108+
109+
def start_sync(self) -> BasePage:
110+
"""
111+
Start FxA sync
112+
"""
113+
with self.driver.context(self.driver.CONTEXT_CHROME):
114+
self.click_sync_sign_in_button()
115+
self.element_has_text("fxa-sync-label", "Sync now")
116+
self.get_element("fxa-sync-label").click()
117+
return self

modules/browser_object_tabbar.py

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import logging
22
from typing import Union
33

4-
from selenium.common.exceptions import NoSuchElementException, TimeoutException
4+
from selenium.common.exceptions import NoSuchElementException
55
from selenium.webdriver import Keys
66
from selenium.webdriver.common.by import By
77
from selenium.webdriver.remote.webelement import WebElement
@@ -237,12 +237,3 @@ def get_bar_y():
237237
self.actions.move_by_offset(0, (sign * pixels))
238238
self.actions.release()
239239
self.actions.perform()
240-
241-
def wait_for_num_tabs(self, num_tabs: int) -> BasePage:
242-
"""
243-
Waits for the driver.window_handles to be updated accordingly with the number of tabs requested
244-
"""
245-
try:
246-
self.wait.until(lambda _: len(self.driver.window_handles) == num_tabs)
247-
except TimeoutException:
248-
logging.warn("Timeout waiting for the number of windows to be:", num_tabs)
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"error-title": {
3+
"selectorData": ".title-text[data-l10n-id='dnsNotFound-title']",
4+
"strategy": "css",
5+
"groups": []
6+
},
7+
8+
"error-short-description": {
9+
"selectorData": "errorShortDesc",
10+
"strategy": "id",
11+
"groups": []
12+
},
13+
14+
"error-suggestion-link": {
15+
"selectorData": "#errorShortDesc a[data-l10n-name='website']",
16+
"strategy": "css",
17+
"groups": []
18+
},
19+
20+
"error-long-description-items": {
21+
"selectorData": "#errorLongDesc li",
22+
"strategy": "css",
23+
"groups": []
24+
},
25+
26+
"try-again-button": {
27+
"selectorData": "#netErrorButtonContainer #neterrorTryAgainButton",
28+
"strategy": "css",
29+
"groups": []
30+
}
31+
32+
}

modules/data/fxa_home.components.json

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
{
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+
}
84+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"body": {
3+
"selectorData": "body",
4+
"strategy": "tag",
5+
"groups": []
6+
}
7+
}

modules/data/navigation.components.json

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,9 @@
5252
"refresh-intervention-card": {
5353
"selectorData": "div[tip-type=\"intervention_refresh\"]",
5454
"strategy": "css",
55-
"groups": []
55+
"groups": [
56+
"doNotCache"
57+
]
5658
},
5759

5860
"fx-refresh-text": {
@@ -79,6 +81,12 @@
7981
"groups": []
8082
},
8183

84+
"fx-refresh-menu-get-help-item-get-help": {
85+
"selectorData": "urlbarView-result-menuitem",
86+
"strategy": "class",
87+
"groups": []
88+
},
89+
8290
"search-engine-suggestion-row": {
8391
"selectorData": "div[class=\"urlbarView-row\"][type=\"search_engine\"]",
8492
"strategy": "css",
@@ -134,7 +142,13 @@
134142
"groups": []
135143
},
136144

137-
"addon-suggestion": {
145+
"search-results-container": {
146+
"selectorData": "urlbar-results",
147+
"strategy": "id",
148+
"groups": []
149+
},
150+
151+
"addon-suggestion": {
138152
"selectorData": "div.urlbarView-row[type='rust_amo'] span.urlbarView-title.urlbarView-overflowable",
139153
"strategy": "css",
140154
"groups": []
@@ -154,9 +168,33 @@
154168
"groups": []
155169
},
156170

171+
"sponsored-site-card": {
172+
"selectorData": "top-site-outer",
173+
"strategy": "class",
174+
"groups": []
175+
},
176+
157177
"firefox-suggest": {
158178
"selectorData": "div[label='Firefox Suggest'] > span.urlbarView-row-inner, div[label='Firefox Suggest'] + div.urlbarView-row",
159179
"strategy": "css",
160180
"groups": []
181+
},
182+
183+
"sponsored-site-card-menu-button": {
184+
"selectorData": "button[class=\"context-menu-button icon\"]",
185+
"strategy": "css",
186+
"groups": []
187+
},
188+
189+
"sponsored-site-context-menu": {
190+
"selectorData": "context-menu",
191+
"strategy": "class",
192+
"groups": []
193+
},
194+
195+
"sponsored-site-context-menu-list": {
196+
"selectorData": "ul[class=\"context-menu-list\"]",
197+
"strategy": "css",
198+
"groups": []
161199
}
162-
}
200+
}

modules/data/panel_ui.components.json

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,40 @@
44
"selectorData": "PanelUI-menu-button",
55
"strategy": "id",
66
"groups": [
7-
"requiredForPage"
7+
"requiredForPage",
8+
"doNotCache"
9+
]
10+
},
11+
12+
"sync-user-button": {
13+
"selectorData": "toolbarbutton[id='fxa-toolbar-menu-button']",
14+
"strategy": "css",
15+
"groups": []
16+
},
17+
18+
"fxa-manage-account-button": {
19+
"selectorData": "fxa-manage-account-button",
20+
"strategy": "id",
21+
"groups": []
22+
},
23+
24+
"sync-fxa": {
25+
"selectorData": "appMenu-fxa-status2",
26+
"strategy": "id",
27+
"groups": []
28+
},
29+
30+
"fxa-sign-in": {
31+
"selectorData": "#appMenu-fxa-status2 toolbarbutton",
32+
"strategy": "css",
33+
"groups": []
34+
},
35+
36+
"fxa-sync-label": {
37+
"selectorData": "syncnow-label",
38+
"strategy": "class",
39+
"groups": [
40+
"doNotCache"
841
]
942
},
1043

0 commit comments

Comments
 (0)