Skip to content

Commit 3b350fe

Browse files
committed
Add back accidentally removed selectors
1 parent 4913dd4 commit 3b350fe

5 files changed

+45
-16
lines changed

l10n_CM/Unified/test_demo_ad_address_data_captured_in_doorhanger_and_stored.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,9 @@ def test_case():
1212
return "2888703"
1313

1414

15-
1615
def test_demo_ad_address_data_captured_in_doorhanger_and_stored(
1716
driver: Firefox, region: str
1817
):
19-
2018
"""
2119
C2888703 - Verify Address data are captured in the Capture Doorhanger and stored in about:preferences
2220
"""
@@ -59,7 +57,7 @@ def test_demo_ad_address_data_captured_in_doorhanger_and_stored(
5957
if region in ["FR", "DE"]
6058
else "address-doorhanger-zip"
6159
)
62-
60+
6361
address_autofill_popup.element_has_text(zip_selector, expected_zip)
6462

6563
# containing Country field
@@ -97,4 +95,3 @@ def test_demo_ad_address_data_captured_in_doorhanger_and_stored(
9795
assert found_address_data, (
9896
"Street, city, state (if applicable), zip, or country were not found in any of the address entries!"
9997
)
100-

l10n_CM/Unified/test_demo_cc_doorhanger_data_is_stored_in_about_prefs.py

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from modules.browser_object_autofill_popup import AutofillPopup
77
from modules.page_object_autofill import CreditCardFill
88
from modules.page_object_prefs import AboutPrefs
9-
from modules.util import Utilities, BrowserActions
9+
from modules.util import BrowserActions, Utilities
1010

1111

1212
@pytest.fixture()
@@ -33,13 +33,21 @@ def test_demo_cc_data_captured_in_doorhanger_and_stored(driver: Firefox, region:
3333
credit_card_fill_obj.fill_credit_card_info(credit_card_sample_data)
3434

3535
# The "Save credit card?" doorhanger is displayed
36-
assert autofill_popup_obj.element_visible("doorhanger-save-button"), "Credit card save doorhanger is not visible"
36+
assert autofill_popup_obj.element_visible("doorhanger-save-button"), (
37+
"Credit card save doorhanger is not visible"
38+
)
3739

3840
# Verify Credit Card Doorhanger Data
3941
doorhanger_text = autofill_popup_obj.get_cc_doorhanger_data("cc-doorhanger-data")
40-
assert credit_card_sample_data.card_number[-4:] in doorhanger_text, f"Expected last 4 digits '{credit_card_sample_data.card_number[-4:]}' but not found."
41-
assert credit_card_sample_data.name in doorhanger_text, f"Expected name '{credit_card_sample_data.name}' but not found."
42-
assert credit_card_sample_data.cvv not in doorhanger_text, f"CVV '{credit_card_sample_data.cvv}' should not be saved, but found in doorhanger."
42+
assert credit_card_sample_data.card_number[-4:] in doorhanger_text, (
43+
f"Expected last 4 digits '{credit_card_sample_data.card_number[-4:]}' but not found."
44+
)
45+
assert credit_card_sample_data.name in doorhanger_text, (
46+
f"Expected name '{credit_card_sample_data.name}' but not found."
47+
)
48+
assert credit_card_sample_data.cvv not in doorhanger_text, (
49+
f"CVV '{credit_card_sample_data.cvv}' should not be saved, but found in doorhanger."
50+
)
4351

4452
# Click the "Save" button using click_doorhanger_button
4553
autofill_popup_obj.click_doorhanger_button("save")
@@ -50,9 +58,18 @@ def test_demo_cc_data_captured_in_doorhanger_and_stored(driver: Firefox, region:
5058
browser_action_obj.switch_to_iframe_context(iframe)
5159

5260
# Get stored values
53-
elements = [x.strip() for x in about_prefs.get_element("saved-credit-cards-values").text.split(',')]
61+
elements = [
62+
x.strip()
63+
for x in about_prefs.get_element("saved-credit-cards-values").text.split(",")
64+
]
5465

5566
# Validate stored values match expected values
56-
assert elements[0].endswith(credit_card_sample_data.card_number[-4:]), f"Expected last 4 digits '{credit_card_sample_data.card_number[-4:]}' but got '{elements[0]}'"
57-
assert elements[1] == credit_card_sample_data.name, f"Expected name '{credit_card_sample_data.name}' but got '{elements[1]}'"
58-
assert credit_card_sample_data.cvv not in elements, f"CVV '{credit_card_sample_data.cvv}' should not be saved, but found in stored values."
67+
assert elements[0].endswith(credit_card_sample_data.card_number[-4:]), (
68+
f"Expected last 4 digits '{credit_card_sample_data.card_number[-4:]}' but got '{elements[0]}'"
69+
)
70+
assert elements[1] == credit_card_sample_data.name, (
71+
f"Expected name '{credit_card_sample_data.name}' but got '{elements[1]}'"
72+
)
73+
assert credit_card_sample_data.cvv not in elements, (
74+
f"CVV '{credit_card_sample_data.cvv}' should not be saved, but found in stored values."
75+
)

modules/browser_object_autofill_popup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def get_doorhanger_cc_number(self) -> str:
5858

5959
def get_cc_doorhanger_data(self, selector: str) -> str:
6060
"""
61-
get text for the credit card doorhanger data.
61+
get text for the credit card doorhanger data.
6262
"""
6363
with self.driver.context(self.driver.CONTEXT_CHROME):
6464
return self.get_element(selector).text

modules/browser_object_navigation.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,3 +382,14 @@ def handle_geolocation_prompt(self, button_type="primary"):
382382
button_selector = f"popup-notification-{button_type}-button"
383383
self.element_clickable(button_selector)
384384
self.click_on(button_selector)
385+
386+
def open_searchmode_switcher_settings(self):
387+
"""Open search settings from searchmode switcher in awesome bar"""
388+
self.click_on("searchmode-switcher")
389+
self.click_on("searchmode-switcher-settings")
390+
return self
391+
392+
def select_element_in_nav(self, element: str) -> BasePage:
393+
with self.driver.context(self.driver.CONTEXT_CHROME):
394+
self.get_element(element).click()
395+
return self

modules/page_object_autofill.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,9 @@ def send_keys_to_element(self, name: str, label: str, keys: str):
414414
elem.clear()
415415
elem.send_keys(new_value)
416416

417-
def verify_autofill_data(self, autofill_data: AutofillAddressBase, region: str, util: Utilities):
417+
def verify_autofill_data(
418+
self, autofill_data: AutofillAddressBase, region: str, util: Utilities
419+
):
418420
"""
419421
Verifies that the autofill data matches the expected values.
420422
@@ -465,7 +467,9 @@ def verify_autofill_data(self, autofill_data: AutofillAddressBase, region: str,
465467
if field == "Phone":
466468
actual = util.normalize_phone_number(actual)
467469

468-
assert actual == expected, f"Mismatch in {field}: Expected '{expected}', but got '{actual}'"
470+
assert actual == expected, (
471+
f"Mismatch in {field}: Expected '{expected}', but got '{actual}'"
472+
)
469473

470474

471475
class TextAreaFormAutofill(Autofill):

0 commit comments

Comments
 (0)