|
| 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.util import Utilities |
| 7 | + |
| 8 | + |
| 9 | +@pytest.fixture() |
| 10 | +def test_case(): |
| 11 | + return "2888557" |
| 12 | + |
| 13 | + |
| 14 | +def test_demo_ad_preview_name_org( |
| 15 | + driver: Firefox, |
| 16 | + region: str, |
| 17 | + address_autofill: AddressFill, |
| 18 | + util: Utilities, |
| 19 | + autofill_popup: AutofillPopup |
| 20 | +): |
| 21 | + """ |
| 22 | + C2888557 - Verify Autofill Preview on hover over dropdown entries for name/org fields |
| 23 | + """ |
| 24 | + # Create fake data and fill it in |
| 25 | + address_autofill.open() |
| 26 | + address_autofill_data = util.fake_autofill_data(region) |
| 27 | + address_autofill.save_information_basic(address_autofill_data) |
| 28 | + |
| 29 | + # Click the "Save" button |
| 30 | + autofill_popup.click_doorhanger_button("save") |
| 31 | + |
| 32 | + # Double-click inside Name field and hover the mouse over any saved address entry in the dropdown (without selecting it). |
| 33 | + address_autofill.double_click("form-field", labels=["name"]) |
| 34 | + # Get the first element from the autocomplete dropdown |
| 35 | + first_item = autofill_popup.get_nth_element(1) |
| 36 | + actual_value = autofill_popup.hover(first_item).get_primary_value(first_item) |
| 37 | + |
| 38 | + # Get the primary value (name) from the first item in the dropdown and assert that the actual value matches the expected value |
| 39 | + expected_name = address_autofill_data.name |
| 40 | + assert expected_name == actual_value, ( |
| 41 | + f"Expected {expected_name}, but got {actual_value}" |
| 42 | + ) |
| 43 | + |
| 44 | + # Double-click inside Name field and hover the mouse over any saved address entry in the dropdown (without selecting it). |
| 45 | + address_autofill.double_click("form-field", labels=["organization"]) |
| 46 | + # Get the first element from the autocomplete dropdown |
| 47 | + first_item = autofill_popup.get_nth_element(1) |
| 48 | + actual_value = autofill_popup.hover(first_item).get_primary_value(first_item) |
| 49 | + |
| 50 | + # Get the primary value (org) from the first item in the dropdown and assert that the actual value matches the expected value |
| 51 | + expected_org = address_autofill_data.organization |
| 52 | + assert expected_org == actual_value, ( |
| 53 | + f"Expected {expected_org}, but got {actual_value}" |
| 54 | + ) |
| 55 | + |
| 56 | + fields_to_test = [ |
| 57 | + "name", |
| 58 | + "organization" |
| 59 | + ] |
| 60 | + |
| 61 | + for field in fields_to_test: |
| 62 | + address_autofill.verify_autofill_preview(field, ) |
0 commit comments