Skip to content

Commit 1c40c43

Browse files
committed
Add files that were reverted.
2 parents 046a888 + 65b0a32 commit 1c40c43

File tree

40 files changed

+121
-96
lines changed

40 files changed

+121
-96
lines changed

modules/browser_object_panel_ui.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ def loaded(self):
3939
]
4040
return all([EC.presence_of_element_located(el) for el in targeted])
4141

42+
@BasePage.context_chrome
4243
def open_panel_menu(self) -> BasePage:
4344
"""
4445
Opens the PanelUi menu.
4546
"""
46-
with self.driver.context(self.driver.CONTEXT_CHROME):
47-
panel_root = self.get_element("panel-ui-button")
48-
panel_root.click()
49-
self.menu = self.Menu(self, root=panel_root)
47+
panel_root = self.get_element("panel-ui-button")
48+
panel_root.click()
49+
self.menu = self.Menu(self, root=panel_root)
5050
return self
5151

5252
def select_panel_setting(self, name: str, *labels) -> BasePage:
@@ -181,13 +181,13 @@ def get_all_history(self) -> List[WebElement]:
181181
history_items = self.get_elements("bookmark-item")
182182
return history_items
183183

184+
@BasePage.context_chrome
184185
def redirect_to_about_logins_page(self) -> BasePage:
185186
"""
186187
Opens the about:logins page by clicking the Password option in Hamburger Menu"
187188
"""
188189
self.open_panel_menu()
189-
with self.driver.context(self.driver.CONTEXT_CHROME):
190-
self.get_element("password-button").click()
190+
self.get_element("password-button").click()
191191
return self
192192

193193
# Bookmarks section

modules/page_object_about_pages.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
from modules.page_base import BasePage
1414
from modules.util import BrowserActions
15+
from selenium.webdriver import Firefox
1516

1617

1718
class AboutConfig(BasePage):
@@ -133,6 +134,10 @@ class AboutLogins(BasePage):
133134

134135
URL_TEMPLATE = "about:logins"
135136

137+
def __init__(self, driver: Firefox, **kwargs):
138+
super().__init__(driver, **kwargs)
139+
self.ba = BrowserActions(self.driver)
140+
136141
def click_add_login_button(self) -> Page:
137142
"""Click the Add Login button"""
138143
self.get_element("create-login-button").click()
@@ -144,11 +149,10 @@ def create_new_login(self, form_info: dict) -> Page:
144149
Given a dict with keys that match the valid item types in the
145150
new login dialog, create a new login with those values through UI.
146151
"""
147-
ba = BrowserActions(self.driver)
148152
try:
149153
for item_type, value in form_info.items():
150154
logging.info(f"Filling {item_type} with {value}")
151-
ba.clear_and_fill(
155+
self.ba.clear_and_fill(
152156
self.get_element("login-item-type", labels=[item_type]), value
153157
)
154158
logging.info("Clicking submit...")

modules/page_object_autofill.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ def verify_form_data(self, sample_data: CreditCardBase | AutofillAddressBase):
230230
autofilled_field = self.get_element("form-field", labels=[field_name])
231231
if autofilled_field.tag_name.lower() != "select":
232232
autofilled_field_value = autofilled_field.get_attribute("value")
233-
# self.element_attribute_contains(
233+
# self.expect_element_attribute_contains(
234234
# "form-field", "value", expected_value, labels=[field_name]
235235
# )
236236
else:

modules/page_object_prefs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def set_alternative_language(self, lang_code: str) -> BasePage:
8080
self.get_element("language-option-by-code", labels=[lang_code]).click()
8181
select_language.click()
8282
self.get_element("language-settings-add-button").click()
83-
self.element_attribute_contains(
83+
self.expect_element_attribute_contains(
8484
"language-added-list", "last-selected", f"locale-{lang_code}"
8585
)
8686

@@ -94,7 +94,7 @@ def select_https_only_setting(self, option_id: HttpsOnlyStatus) -> BasePage:
9494
self.find_in_settings("HTTPS")
9595
self.element_clickable(str(option_id))
9696
self.click_on(str(option_id))
97-
self.element_attribute_contains(str(option_id), "checked", "")
97+
self.expect_element_attribute_contains(str(option_id), "checked", "")
9898
return self
9999

100100
def set_default_zoom_level(self, zoom_percentage: int) -> BasePage:

tests/bookmarks_and_history/test_opened_website_in_new_tab_present_in_toolbar_history.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@ def test_the_website_opened_in_new_tab_is_present_in_history_menu(driver: Firefo
4242
panel_ui.open_history_menu()
4343

4444
# Verify YouTube is present in the history menu and is on top of the list as the most recent website visited
45-
panel_ui.element_attribute_contains("recent-history-content", "value", "YouTube")
45+
panel_ui.expect_element_attribute_contains("recent-history-content", "value", "YouTube")

tests/bookmarks_and_history/test_opened_website_in_new_window_present_in_toolbar_history.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,4 @@ def test_the_website_opened_in_new_window_is_present_in_history_menu(driver: Fir
3636
panel_ui.open_history_menu()
3737

3838
# Verify YouTube is present in the history menu and is on top of the list as the most recent website visited
39-
panel_ui.element_attribute_contains("recent-history-content", "value", "YouTube")
39+
panel_ui.expect_element_attribute_contains("recent-history-content", "value", "YouTube")

tests/bookmarks_and_history/test_toggle_bookmarks_toolbar.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ def test_toggle_bookmark_toolbar(driver: Firefox):
2424
# By default, the Bookmarks Toolbar is hidden. The element attribute indicates
2525
# whether the bookmarks toolbar is either, collapsed = 'true' is hidden,
2626
# or not collapsed = 'false' is visible.
27-
nav.element_attribute_contains("bookmarks-toolbar", "collapsed", "true")
27+
nav.expect_element_attribute_contains("bookmarks-toolbar", "collapsed", "true")
2828

2929
# Un-hide the Bookmarks Toolbar with keyboard shortcut.
3030
nav.toggle_bookmarks_toolbar_with_key_combo()
31-
nav.element_attribute_contains("bookmarks-toolbar", "collapsed", "false")
31+
nav.expect_element_attribute_contains("bookmarks-toolbar", "collapsed", "false")
3232

3333
# Toggle the Bookmarks Toolbar again and confirm it is hidden.
3434
nav.toggle_bookmarks_toolbar_with_key_combo()
35-
nav.element_attribute_contains("bookmarks-toolbar", "collapsed", "true")
35+
nav.expect_element_attribute_contains("bookmarks-toolbar", "collapsed", "true")

tests/drag_and_drop/test_copy_entire_row_column.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def test_copy_entire_row_column(driver: Firefox):
3636

3737
# Verify that the row is pasted properly
3838
for i in range(1, 4):
39-
web_page.element_attribute_contains(
39+
web_page.expect_element_attribute_contains(
4040
"formula-box-input", "innerHTML", str(i)
4141
)
4242
web_page.perform_key_combo(Keys.TAB)
@@ -50,7 +50,7 @@ def test_copy_entire_row_column(driver: Firefox):
5050

5151
# Verify that the row is pasted properly
5252
for i in range(1, 4):
53-
web_page.element_attribute_contains(
53+
web_page.expect_element_attribute_contains(
5454
"formula-box-input", "innerHTML", str(i)
5555
)
5656
web_page.perform_key_combo(Keys.TAB)
@@ -70,7 +70,7 @@ def test_copy_entire_row_column(driver: Firefox):
7070

7171
# Verify that the column is pasted properly
7272
for i in range(1, 4):
73-
web_page.element_attribute_contains(
73+
web_page.expect_element_attribute_contains(
7474
"formula-box-input", "innerHTML", str(i)
7575
)
7676
web_page.perform_key_combo(Keys.TAB)
@@ -85,7 +85,7 @@ def test_copy_entire_row_column(driver: Firefox):
8585

8686
# Verify that the column is pasted properly
8787
for i in range(1, 4):
88-
web_page.element_attribute_contains(
88+
web_page.expect_element_attribute_contains(
8989
"formula-box-input", "innerHTML", str(i)
9090
)
9191
web_page.perform_key_combo(Keys.TAB)

tests/drag_and_drop/test_copy_from_an_editor_paste_in_another.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def test_copy_from_an_editor_paste_in_another(driver: Firefox, sys_platform):
4444
for row_index, row in enumerate(expected_values):
4545
for col_index, expected_value in enumerate(row):
4646
# Check that the current cell's value matches expected_value
47-
web_page.element_attribute_contains(
47+
web_page.expect_element_attribute_contains(
4848
"formula-box-input", "innerHTML", expected_value
4949
)
5050
# Move to the next cell to the right

tests/drag_and_drop/test_copy_hyperlink_table.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def test_copy_table_with_hyperlink(driver: Firefox, temp_selectors):
6060
# Verify that the pasted values are correct
6161
for row_index, row in enumerate(expected_values):
6262
for col_index, expected_value in enumerate(row):
63-
web_page.element_attribute_contains(
63+
web_page.expect_element_attribute_contains(
6464
"formula-box-input", "innerHTML", expected_value
6565
)
6666
# Move to the next cell to the right

0 commit comments

Comments
 (0)