Skip to content

Commit 863f446

Browse files
ebay it fixes
1 parent 70a09fc commit 863f446

File tree

5 files changed

+46
-16
lines changed

5 files changed

+46
-16
lines changed

l10n_CM/Unified/conftest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def get_html_files(live_site, region):
4242

4343
@pytest.fixture()
4444
def region():
45-
return os.environ.get("FX_REGION", "US")
45+
return os.environ.get("FX_REGION", "GB")
4646

4747

4848
@pytest.fixture()
@@ -61,6 +61,7 @@ def prefs_list(add_to_prefs_list: List[tuple[str, str | bool]], region: str):
6161
prefs = [
6262
("extensions.formautofill.creditCards.reauth.optout", False),
6363
("extensions.formautofill.reauth.enabled", False),
64+
("extensions.formautofill.addresses.supportedCountries", region),
6465
("browser.aboutConfig.showWarning", False),
6566
("browser.search.region", region),
6667
]

l10n_CM/Unified/test_demo_ad_0_add_new_address.py

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,30 @@ def test_verify_new_address_is_added(
3636

3737
# address autofill data
3838
address_autofill_data = populate_saved_addresses
39+
address_values = {str(val) for val in address_autofill_data.__dict__.values()}
3940
about_prefs_privacy.open_and_switch_to_saved_addresses_popup()
4041

4142
# verify that the address saved is the same.
42-
# The address saved in step 2 is listed in the "Saved addresses" modal: name and organization
4343
elements = about_prefs_privacy.get_element("saved-addresses-values").text.split(",")
44-
address_match = all(
45-
data_sanitizer(util, element, region, inverted_state_province_abbr)
46-
in address_autofill_data.__dict__.values()
47-
for element in elements
48-
)
49-
assert address_match, "Address found is not equal to address created!"
44+
total_address_match = True
45+
for element in elements:
46+
sanitized_element = data_sanitizer(
47+
util, element, region, inverted_state_province_abbr
48+
)
49+
# temporary fix until Italian province mappings are added.
50+
if (
51+
len(sanitized_element) == 2
52+
and sanitized_element != region
53+
and region not in ["US", "CA"]
54+
):
55+
continue
56+
address_match = False
57+
for val in address_values:
58+
if sanitized_element in val:
59+
address_match = True
60+
break
61+
total_address_match = total_address_match and address_match
62+
assert total_address_match, "Address found is not equal to address created!"
5063

5164

5265
def data_sanitizer(util: Utilities, value: str, region: str, state_province: Dict):

l10n_CM/constants/ebay/IT/ebay_ad.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@
44
"country": "139f9745-aa36-410f-8f74-b034d2e68cc9",
55
"given_name": "eeb50a23-2faf-40cf-939f-9f6a96d57a1e",
66
"family_name": "4b5f7dbd-ef96-4362-a6d6-799f1514e24e",
7+
"street_address": "1accdedb-5ac4-403f-848c-07dbae40086a",
78
"telephone": "62d794bf-b73a-4065-b494-8abb6388b3ce",
8-
"address_level_1": "1accdedb-5ac4-403f-848c-07dbae40086a",
99
"email": "35fe569e-aa96-4f38-8b16-a2b3859ba154",
10-
"address_level_2": "deee6941-08f5-47f4-8c9f-353ec042ee08",
10+
"address_level_1": "9d7ea453-7e6a-4f94-b35c-671d5ac7c134",
1111
"postal_code": "b82b85a9-f315-4d04-8f5d-daa0285a2676"
1212
},
13-
"form_field": "*[data-moz-autofill-inspect-id='{name}']",
1413
"skip": "True",
14+
"form_field": "*[data-moz-autofill-inspect-id='{name}']",
1515
"fields": [
1616
"139f9745-aa36-410f-8f74-b034d2e68cc9",
1717
"eeb50a23-2faf-40cf-939f-9f6a96d57a1e",
18-
"4b5f7dbd-ef96-4362-a6d6-799f1514e24e",
1918
"62d794bf-b73a-4065-b494-8abb6388b3ce",
19+
"4b5f7dbd-ef96-4362-a6d6-799f1514e24e",
2020
"1accdedb-5ac4-403f-848c-07dbae40086a",
2121
"35fe569e-aa96-4f38-8b16-a2b3859ba154",
22-
"deee6941-08f5-47f4-8c9f-353ec042ee08",
22+
"9d7ea453-7e6a-4f94-b35c-671d5ac7c134",
2323
"b82b85a9-f315-4d04-8f5d-daa0285a2676"
2424
]
2525
}

modules/page_object_prefs.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,15 @@ def add_entry_to_saved_addresses(self, address_data: AutofillAddressBase):
347347
self.close_dialog_box()
348348
return self
349349

350+
def select_saved_address_entry(self, idx=0):
351+
"""
352+
Select one of the entries in the saved addresses list.
353+
"""
354+
self.switch_to_saved_addresses_popup_iframe()
355+
select_el = Select(self.get_element("address-saved-options"))
356+
self.double_click(select_el.options[idx])
357+
return self
358+
350359
def get_all_saved_cc_profiles(self) -> List[WebElement]:
351360
"""Gets the saved credit card profiles in the cc panel"""
352361
self.switch_to_saved_payments_popup_iframe()

modules/util.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def __init__(self):
104104
"Yukon": "YT",
105105
}
106106
# temporary fix until faker issue is resolved
107-
self.country_local_translation = {"Germany": "Deutschland"}
107+
self.country_local_translation = {"Germany": "Deutschland", "Italy": "Italia"}
108108
self.fake = None
109109
self.locale = None
110110

@@ -539,7 +539,14 @@ def normalize_regional_phone_numbers(self, phone: str, region: str) -> str:
539539
"""
540540

541541
# Country code mapping for different regions
542-
country_codes = {"US": "1", "CA": "1", "FR": "33", "DE": "49", "GB": "44"}
542+
country_codes = {
543+
"US": "1",
544+
"CA": "1",
545+
"FR": "33",
546+
"DE": "49",
547+
"GB": "44",
548+
"IT": "39",
549+
}
543550

544551
# Sub out anything that matches this regex statement with an empty string to get rid of extensions in generated phone numbers
545552
phone = re.sub(r"\s*(?:x|ext)\s*\d*$", "", phone, flags=re.IGNORECASE)
@@ -559,7 +566,7 @@ def normalize_regional_phone_numbers(self, phone: str, region: str) -> str:
559566
local_number = digits[len(country_code) :]
560567

561568
# Handle leading zero in local numbers (France & Germany)
562-
if region in ["FR", "DE", "GB"] and local_number.startswith("0"):
569+
if region in ["FR", "DE", "GB", "IT"] and local_number.startswith("0"):
563570
# Remove the leading zero
564571
local_number = local_number[1:]
565572

0 commit comments

Comments
 (0)