|
| 1 | +import pytest |
| 2 | +from selenium.webdriver import Firefox |
| 3 | + |
| 4 | +from modules.browser_object_autofill_popup import AutofillPopup |
| 5 | +from modules.page_object_autofill import AddressFill |
| 6 | +from modules.page_object_prefs import AboutPrefs |
| 7 | +from modules.util import Utilities |
| 8 | + |
| 9 | + |
| 10 | +@pytest.fixture() |
| 11 | +def test_case(): |
| 12 | + return "2888568" |
| 13 | + |
| 14 | + |
| 15 | +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, |
| 22 | +): |
| 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. |
| 29 | + address_autofill.open() |
| 30 | + autofill_data = util.fake_autofill_data(region) |
| 31 | + address_autofill.save_information_basic(autofill_data) |
| 32 | + |
| 33 | + # Click the "Save" button on the autofill popup. |
| 34 | + autofill_popup.click_doorhanger_button("save") |
| 35 | + |
| 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) |
0 commit comments