Skip to content

Commit db7e677

Browse files
Merge branch 'main' into philimon/dynamic_addressfill
2 parents f3a6dfb + fe0c3be commit db7e677

File tree

86 files changed

+409
-207
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+409
-207
lines changed

conftest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ def driver(
394394
fx_executable: str,
395395
opt_headless: bool,
396396
opt_implicit_timeout: int,
397-
set_prefs: List[Tuple],
397+
prefs_list: List[Tuple],
398398
opt_ci: bool,
399399
opt_window_size: str,
400400
use_profile: Union[bool, str],
@@ -426,7 +426,7 @@ def driver(
426426
opt_implicit_timeout: int
427427
Timeout, in seconds for driver-level wait attribute.
428428
429-
set_prefs: List[Tuple]
429+
prefs_list: List[Tuple]
430430
Preferences to set before the Firefox object is created.
431431
Usually set in the conftest.py inside a test suite folder.
432432
@@ -454,7 +454,7 @@ def driver(
454454
profile_path = tmp_path / use_profile
455455
unpack_archive(os.path.join("profiles", f"{use_profile}.zip"), profile_path)
456456
options.profile = profile_path
457-
for opt, value in set_prefs:
457+
for opt, value in prefs_list:
458458
options.set_preference(opt, value)
459459
driver = Firefox(options=options)
460460
separator = "x"

l10n_CM/Unified/conftest.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,20 @@ def region():
1515

1616

1717
@pytest.fixture()
18-
def add_prefs(region: str):
18+
def add_to_prefs_list(region: str):
1919
return []
2020

2121

2222
@pytest.fixture()
23-
def set_prefs(add_prefs: List[tuple[str, str | bool]], region: str):
24-
"""Set prefs"""
23+
def prefs_list(add_to_prefs_list: List[tuple[str, str | bool]], region: str):
24+
"""List of prefs to send to main conftest.py driver fixture"""
2525
prefs = [
2626
("extensions.formautofill.creditCards.reauth.optout", False),
2727
("extensions.formautofill.reauth.enabled", False),
2828
("browser.aboutConfig.showWarning", False),
2929
("browser.search.region", region),
3030
]
31-
prefs.extend(add_prefs)
31+
prefs.extend(add_to_prefs_list)
3232
return prefs
3333

3434

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
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 "2888567"
12+
13+
14+
def test_dropdown_presence_email_phone_field(
15+
driver: Firefox,
16+
region: str,
17+
address_autofill: AddressFill,
18+
util: Utilities,
19+
autofill_popup: AutofillPopup,
20+
):
21+
"""
22+
C2888567 - Verify that the autofill dropdown is displayed for the email and phone fields
23+
after the contact information was previously saved.
24+
"""
25+
26+
# Open autofill page
27+
address_autofill.open()
28+
29+
# Generate and save fake data
30+
address_autofill_data = util.fake_autofill_data(region)
31+
address_autofill.save_information_basic(address_autofill_data)
32+
33+
# Click the "Save" button
34+
autofill_popup.click_doorhanger_button("save")
35+
36+
fields_to_test = ["email", "tel"]
37+
38+
address_autofill.verify_autofill_dropdown_addresses(
39+
autofill_popup=autofill_popup, fields_to_test=fields_to_test, region=region
40+
)

l10n_CM/Unified/test_demo_ad_autofill_name_org.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,10 @@ def test_demo_ad_autofill_name_org(
3030
autofill_popup.click_doorhanger_button("save")
3131

3232
# List of field labels to be autofilled and verified
33-
fields_to_test = [
34-
"name",
35-
"organization"
36-
]
33+
fields_to_test = ["name", "organization"]
3734

3835
# Loop through each field and perform the autofill test
3936
for field in fields_to_test:
40-
address_autofill.autofill_and_verify(autofill_popup, field,
41-
address_autofill_data, util)
37+
address_autofill.autofill_and_verify(
38+
autofill_popup, field, address_autofill_data, util
39+
)

l10n_CM/Unified/test_demo_ad_autofill_phone_email.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,10 @@ def test_demo_ad_autofill_phone_email(
3131
autofill_popup.click_doorhanger_button("save")
3232

3333
# List of field labels to be autofilled and verified
34-
fields_to_test = [
35-
"email",
36-
"tel"
37-
]
34+
fields_to_test = ["email", "tel"]
3835

3936
# Loop through each field and perform the autofill test
4037
for field in fields_to_test:
41-
address_autofill.autofill_and_verify(autofill_popup, field,
42-
address_autofill_data, util)
38+
address_autofill.autofill_and_verify(
39+
autofill_popup, field, address_autofill_data, util
40+
)

l10n_CM/Unified/test_demo_ad_verify_new_address_added.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def test_case():
1313

1414

1515
@pytest.fixture()
16-
def add_prefs(region: str):
16+
def add_to_prefs_list(region: str):
1717
return [
1818
("extensions.formautofill.creditCards.supportedCountries", region),
1919
("extensions.formautofill.addresses.supported", "on"),

l10n_CM/Unified/test_demo_cc_autofill_from_dropdown.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from modules.util import Utilities
77

88

9-
109
@pytest.fixture()
1110
def test_case():
1211
return "2886600"
@@ -17,7 +16,6 @@ def test_cc_autofill_from_dropdown(
1716
util: Utilities,
1817
autofill_popup: AutofillPopup,
1918
credit_card_fill_obj: CreditCardFill,
20-
2119
):
2220
"""
2321
Verify that saved credit card information is autofilled correctly when selected from the dropdown,
@@ -37,4 +35,4 @@ def test_cc_autofill_from_dropdown(
3735

3836
# Step 5: Click the csc field (cc-csc), ensure autofill popup is not present
3937
credit_card_fill_obj.click_on("form-field", labels=["cc-csc"]) # Use single click
40-
autofill_popup.ensure_autofill_dropdown_not_visible()
38+
autofill_popup.ensure_autofill_dropdown_not_visible()

l10n_CM/conftest.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ def suite_id():
77

88

99
@pytest.fixture()
10-
def set_prefs():
11-
"""Set prefs"""
10+
def prefs_list(add_to_prefs_list: dict):
11+
"""List of prefs to send to main conftest.py driver fixture"""
12+
prefs = []
13+
prefs.extend(add_to_prefs_list)
14+
return prefs
15+
16+
17+
@pytest.fixture()
18+
def add_to_prefs_list():
1219
return []

l10n_CM/region/US.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"region": "US",
3-
"tests": []
3+
"tests": ["test_demo_ad_autofill_dropdown_present_for_email_and_phone.py"]
44
}

modules/browser_object_tabbar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def click_tab_by_title(self, title: str) -> BasePage:
8383
self.get_element("tab-by-title", labels=[title]).click()
8484
return self
8585

86-
def get_tab_by_title(self, title: str) -> BasePage:
86+
def get_tab_by_title(self, title: str) -> WebElement:
8787
"""Given a full page title, return the corresponding tab"""
8888
with self.driver.context(self.driver.CONTEXT_CHROME):
8989
return self.get_element("tab-by-title", labels=[title])

0 commit comments

Comments
 (0)