Skip to content

Commit 70f30d1

Browse files
Hani YacoubHani Yacoub
authored andcommitted
Start test preview name and org
1 parent 5f8479e commit 70f30d1

File tree

3 files changed

+73
-1
lines changed

3 files changed

+73
-1
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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, )

l10n_CM/region/Unified.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
"test_demo_cc_yellow_highlight.py",
1616
"test_demo_ad_yellow_highlight_name_org.py",
1717
"test_demo_ad_yellow_highlight_address.py",
18-
"test_demo_ad_yellow_highlight_phone_email.py"
18+
"test_demo_ad_yellow_highlight_phone_email.py",
19+
"test_demo_ad_preview_name_org.py"
1920

2021
]
2122
}

modules/page_object_autofill.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,15 @@ def verify_field_yellow_highlights(
549549
expected_highlighted_fields=expected_highlighted_fields,
550550
)
551551

552+
def verify_autofill_preview(self, field_label: str, expected_value: str):
553+
"""Reusable method to verify autofill preview for a given field."""
554+
self.double_click("form-field", labels=[field_label])
555+
first_item = self.get_nth_element(1)
556+
actual_value = self.hover(first_item).get_primary_value(first_item)
557+
assert expected_value == actual_value, (
558+
f"Expected {expected_value}, but got {actual_value}"
559+
)
560+
552561

553562
class TextAreaFormAutofill(Autofill):
554563
"""

0 commit comments

Comments
 (0)