Skip to content

Commit 812ecbb

Browse files
Hani YacoubHani Yacoub
authored andcommitted
resolving conflicts
2 parents d7c2776 + 944254f commit 812ecbb

40 files changed

+1317
-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_navigation.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,32 @@ def search_bar_search(self, term: str) -> BasePage:
121121
self.search_bar.send_keys(term + Keys.ENTER)
122122
return self
123123

124+
def type_in_search_bar(self, term: str) -> BasePage:
125+
"""
126+
Type in the *Old* Search Bar. Returns self.
127+
128+
Attributes
129+
----------
130+
131+
term : str
132+
The search term
133+
"""
134+
with self.driver.context(self.driver.CONTEXT_CHROME):
135+
self.search_bar = self.find_element(By.CLASS_NAME, "searchbar-textbox")
136+
self.search_bar.click()
137+
self.search_bar.send_keys(term)
138+
return self
139+
140+
def click_on_change_search_settings_button(self) -> BasePage:
141+
with self.driver.context(self.driver.CONTEXT_CHROME):
142+
self.search_bar = self.find_element(By.CLASS_NAME, "searchbar-textbox")
143+
self.search_bar.click()
144+
self.change_search_settings_button = self.find_element(
145+
By.ID, "searchbar-anon-search-settings"
146+
)
147+
self.change_search_settings_button.click()
148+
return self
149+
124150
def click_in_awesome_bar(self) -> BasePage:
125151
self.set_awesome_bar()
126152
self.awesome_bar.click()

modules/browser_object_panel_ui.py

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,60 @@ 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 navigate_to_customize_toolbar(self):
70+
"""
71+
On the hamburger menu > More Tools > Customize Toolbar
72+
"""
73+
self.select_panel_setting("more-tools")
74+
self.select_panel_setting("customize-toolbar")
75+
76+
def click_sync_sign_in_button(self) -> BasePage:
77+
"""
78+
Click FxA sync button.
79+
"""
80+
with self.driver.context(self.driver.CONTEXT_CHROME):
81+
self.open_panel_menu()
82+
self.select_panel_setting("fxa-sign-in")
83+
return self
84+
85+
def log_out_fxa(self) -> BasePage:
86+
"""
87+
Click FxA signout button.
88+
"""
89+
with self.driver.context(self.driver.CONTEXT_CHROME):
90+
self.click_sync_sign_in_button()
91+
self.get_element("fxa-sign-out-button").click()
92+
return self
93+
94+
def manage_fxa_account(self) -> BasePage:
95+
"""
96+
Open the FxA management flow.
97+
"""
98+
with self.driver.context(self.driver.CONTEXT_CHROME):
99+
self.click_sync_sign_in_button()
100+
self.get_element("fxa-manage-account-button").click()
101+
return self
102+
103+
def confirm_sync_in_progress(self) -> BasePage:
104+
"""
105+
Check that FxA Sync Label is set to "Syncing…"
106+
"""
107+
with self.driver.context(self.driver.CONTEXT_CHROME):
108+
self.click_sync_sign_in_button()
109+
self.custom_wait(timeout=30, poll_frequency=0.5).until(
110+
EC.text_to_be_present_in_element(
111+
self.get_selector("fxa-sync-label"), "Syncing"
112+
)
113+
)
114+
return self
115+
116+
def start_sync(self) -> BasePage:
117+
"""
118+
Start FxA sync
119+
"""
120+
with self.driver.context(self.driver.CONTEXT_CHROME):
121+
self.click_sync_sign_in_button()
122+
self.element_has_text("fxa-sync-label", "Sync now")
123+
self.get_element("fxa-sync-label").click()
124+
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)

modules/data/about_prefs.components.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,5 +133,17 @@
133133
"selectorData": "#addresses option",
134134
"strategy": "css",
135135
"groups": []
136+
},
137+
138+
"firefox-suggest-nonsponsored": {
139+
"selectorData": "firefoxSuggestNonsponsored",
140+
"strategy": "id",
141+
"groups": []
142+
},
143+
144+
"firefox-suggest-sponsored": {
145+
"selectorData": "firefoxSuggestSponsored",
146+
"strategy": "id",
147+
"groups": []
136148
}
137149
}
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+
}

0 commit comments

Comments
 (0)