Skip to content

Commit 33192df

Browse files
committed
vs/autofill-hover-test
1 parent c268e60 commit 33192df

File tree

2 files changed

+19
-31
lines changed

2 files changed

+19
-31
lines changed

l10n_CM/Unified/test_demo_ad_hover_over_tele_and_email_dropdown.py

Lines changed: 10 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -13,40 +13,19 @@ def test_case():
1313

1414

1515
def test_hover_email_and_phone_autofill_preview(
16-
driver: Firefox,
17-
region: str,
18-
about_prefs_privacy: AboutPrefs,
19-
address_autofill: AddressFill,
20-
autofill_popup: AutofillPopup,
21-
util: Utilities,
16+
driver: Firefox,
17+
region: str,
18+
about_prefs_privacy: AboutPrefs,
19+
address_autofill: AddressFill,
20+
autofill_popup: AutofillPopup,
21+
util: Utilities,
2222
):
23-
"""
24-
Verify that hovering over a saved address entry in the dropdown previews all fields
25-
when interacting with both the Email and Phone fields.
26-
27-
"""
28-
# Open the autofill page and fill it with fake data.
2923
address_autofill.open()
3024
autofill_data = util.fake_autofill_data(region)
3125
address_autofill.save_information_basic(autofill_data)
32-
33-
# Click the "Save" button on the autofill popup.
3426
autofill_popup.click_doorhanger_button("save")
3527

36-
# Click inside the Email field to trigger the autofill dropdown.
37-
address_autofill.double_click("form-field", labels=["email"])
38-
# Ensure the dropdown is visible.
39-
autofill_popup.ensure_autofill_dropdown_visible()
40-
# Hover over any saved address entry (without selecting it).
41-
autofill_popup.hover("select-form-option")
42-
# Verify that the preview displays all the fields correctly.
43-
address_autofill.verify_autofill_data_on_hover(autofill_data, autofill_popup, util)
44-
45-
# Click inside the Phone field (using the correct label "tel") to trigger the autofill dropdown.
46-
address_autofill.double_click("form-field", labels=["tel"])
47-
# Ensure the dropdown is visible.
48-
autofill_popup.ensure_autofill_dropdown_visible()
49-
# Hover over any saved address entry (without selecting it).
50-
autofill_popup.hover("select-form-option")
51-
# Verify that the preview displays all the fields correctly.
52-
address_autofill.verify_autofill_data_on_hover(autofill_data, autofill_popup, util)
28+
# Check Email field preview.
29+
address_autofill.check_autofill_preview_for_field("email", autofill_data, autofill_popup, util)
30+
# Check Phone field preview (using the correct label "tel").
31+
address_autofill.check_autofill_preview_for_field("tel", autofill_data, autofill_popup, util)

modules/page_object_autofill.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,6 +504,15 @@ def verify_autofill_displayed(self):
504504
element = self.get_element("select-address")
505505
self.expect(EC.visibility_of(element))
506506

507+
def check_autofill_preview_for_field(self, field_label: str, autofill_data, autofill_popup, util: Utilities, region: str = None):
508+
# Skip fields that don't appear in the dropdown for certain regions.
509+
if field_label == "address-level1" and region in ["DE", "FR"]:
510+
return
511+
self.double_click("form-field", labels=[field_label])
512+
autofill_popup.ensure_autofill_dropdown_visible()
513+
autofill_popup.hover("select-form-option")
514+
self.verify_autofill_data_on_hover(autofill_data, autofill_popup, util)
515+
507516
def send_keys_to_element(self, name: str, label: str, keys: str):
508517
"""
509518
Send keys to the specified element.

0 commit comments

Comments
 (0)