diff --git a/l10n_CM/constants/mediamarkt/AT/mediamarkt_ad.json b/l10n_CM/constants/mediamarkt/AT/mediamarkt_ad.json new file mode 100644 index 000000000..e0be66684 --- /dev/null +++ b/l10n_CM/constants/mediamarkt/AT/mediamarkt_ad.json @@ -0,0 +1,19 @@ +{ + "url": "http://127.0.0.1:8080/mediamarkt_ad.html", + "field_mapping": { + "given_name": "eb82fd1f-6ebc-4e00-91b0-b33126e3ef51", + "family_name": "5f200911-7e5f-4d9a-9d75-8cc496b455a7", + "street_address": "81b35c70-5949-4b70-afc8-030bdc2d9128", + "email": "ddde9f4b-5d3d-4346-bb45-1df768613507", + "telephone": "721fc82e-817e-4bff-8b5d-e4360eee4724" + + }, + "form_field": "*[data-moz-autofill-inspect-id='{name}']", + "fields": [ + "eb82fd1f-6ebc-4e00-91b0-b33126e3ef51", + "5f200911-7e5f-4d9a-9d75-8cc496b455a7", + "81b35c70-5949-4b70-afc8-030bdc2d9128", + "ddde9f4b-5d3d-4346-bb45-1df768613507", + "721fc82e-817e-4bff-8b5d-e4360eee4724" + ] +} diff --git a/l10n_CM/constants/mediamarkt/AT/mediamarkt_cc.json b/l10n_CM/constants/mediamarkt/AT/mediamarkt_cc.json new file mode 100644 index 000000000..050b432d2 --- /dev/null +++ b/l10n_CM/constants/mediamarkt/AT/mediamarkt_cc.json @@ -0,0 +1,16 @@ +{ + "url": "http://127.0.0.1:8080/mediamarkt_cc.html", + "field_mapping": { + "card_number": "1d77675c-2591-4e83-b5b5-286b1196d918", + "expiration_date": "811f3be9-b204-469f-aff5-294aa91fb232", + "name": "cdf66cc6-01cb-4f0d-b905-fc4bd37c51e1", + "cvv": "839f304f-4191-4bb7-b3bc-75d9d2314715" + }, + "form_field": "*[data-moz-autofill-inspect-id='{name}']", + "fields": [ + "1d77675c-2591-4e83-b5b5-286b1196d918", + "811f3be9-b204-469f-aff5-294aa91fb232", + "cdf66cc6-01cb-4f0d-b905-fc4bd37c51e1", + "839f304f-4191-4bb7-b3bc-75d9d2314715" + ] +} \ No newline at end of file diff --git a/l10n_CM/constants/zalando/IT/zalando_ad.json b/l10n_CM/constants/zalando/IT/zalando_ad.json new file mode 100644 index 000000000..d9b7bea53 --- /dev/null +++ b/l10n_CM/constants/zalando/IT/zalando_ad.json @@ -0,0 +1,20 @@ +{ + "url": "http://127.0.0.1:8080/zalando_ad.html", + "field_mapping": { + "given_name":"c5f8ff92-697e-46dc-bfba-9b9e7cdc14e7", + "family_name":"325c01d4-84df-4932-8db6-bfc0cb44a434", + "street_address":"e5d2f67c-2506-4d2a-a26d-7c373fe652f2", + "postal_code":"116ae2a6-aaf6-4d83-9dc6-6ab532b2613d", + "address_level_2": "2373a2e4-629e-41a7-b2fb-2a7d76dbb093" + + }, + "form_field": "*[data-moz-autofill-inspect-id='{name}']", + "fields": [ + "c5f8ff92-697e-46dc-bfba-9b9e7cdc14e7", + "325c01d4-84df-4932-8db6-bfc0cb44a434", + "e5d2f67c-2506-4d2a-a26d-7c373fe652f2", + "116ae2a6-aaf6-4d83-9dc6-6ab532b2613d", + "2373a2e4-629e-41a7-b2fb-2a7d76dbb093" + + ] +} diff --git a/l10n_CM/constants/zalando/IT/zalando_cc.json b/l10n_CM/constants/zalando/IT/zalando_cc.json new file mode 100644 index 000000000..8facb0295 --- /dev/null +++ b/l10n_CM/constants/zalando/IT/zalando_cc.json @@ -0,0 +1,17 @@ +{ + "url": "http://127.0.0.1:8080/zalando_cc.html", + "field_mapping": { + "card_name": "9698e0d8-06d5-4538-a5e2-49931904c8a1", + "card_number": "bb810e33-ff6f-4755-af03-924b6263b822", + "expiration_date": "0f3e3c5e-a4ef-4fbe-997b-40d146ab7e96", + "cvv": "adda6a56-6f74-4cb4-9829-19393edf1e2c" +}, + "form_field": "*[data-moz-autofill-inspect-id='{name}']", + "skip": "True", + "fields": [ + "9698e0d8-06d5-4538-a5e2-49931904c8a1", + "bb810e33-ff6f-4755-af03-924b6263b822", + "0f3e3c5e-a4ef-4fbe-997b-40d146ab7e96", + "adda6a56-6f74-4cb4-9829-19393edf1e2c" +] +} \ No newline at end of file diff --git a/l10n_CM/region/AT.json b/l10n_CM/region/AT.json index 47b1bc864..9932c030e 100644 --- a/l10n_CM/region/AT.json +++ b/l10n_CM/region/AT.json @@ -2,7 +2,7 @@ "region": "AT", "sites": [ "demo", - "torfs" + "mediamarkt" ], "tests": [ ] diff --git a/l10n_CM/run_l10n.py b/l10n_CM/run_l10n.py index 412b10098..df33eb7c6 100644 --- a/l10n_CM/run_l10n.py +++ b/l10n_CM/run_l10n.py @@ -26,7 +26,6 @@ "bijoubrigitte", "brico", "burtsbees", - "burtsbeescalvinklein", "calvinklein", "canadatire", "cdiscount", diff --git a/l10n_CM/sites/mediamarkt/AT/mediamarkt_ad.html b/l10n_CM/sites/mediamarkt/AT/mediamarkt_ad.html new file mode 100644 index 000000000..7e438d89f --- /dev/null +++ b/l10n_CM/sites/mediamarkt/AT/mediamarkt_ad.html @@ -0,0 +1,2 @@ +ohne Angabe

Wir benötigen deine Telefonnummer für eventuelle Rückfragen: Bitte gib eine Telefonnummer an, um den Kauf abzuschließen.

Beginne bei der Adresseingabe mit der Straße:

Wir versenden nur innerhalb Österreichs.

\ No newline at end of file diff --git a/l10n_CM/sites/mediamarkt/AT/mediamarkt_cc.html b/l10n_CM/sites/mediamarkt/AT/mediamarkt_cc.html new file mode 100644 index 000000000..27b4cfddb --- /dev/null +++ b/l10n_CM/sites/mediamarkt/AT/mediamarkt_cc.html @@ -0,0 +1 @@ +Payment Page

Geben Sie Ihre Kartendaten manuell ein

American Express
Diners Club
Discover
Visa
Mastercard
Maestro
\ No newline at end of file diff --git a/l10n_CM/sites/zalando/IT/zalando_ad.html b/l10n_CM/sites/zalando/IT/zalando_ad.html new file mode 100644 index 000000000..1ab6a9a05 --- /dev/null +++ b/l10n_CM/sites/zalando/IT/zalando_ad.html @@ -0,0 +1 @@ +Indirizzo
acquisto sicuro

Indirizzo di consegna

Aggiungi nuovo indirizzo
Max 30 caratteri: c/o, interno, nome sul citofono
PaeseItalia
\ No newline at end of file diff --git a/l10n_CM/sites/zalando/IT/zalando_cc.html b/l10n_CM/sites/zalando/IT/zalando_cc.html new file mode 100644 index 000000000..c8f5680de --- /dev/null +++ b/l10n_CM/sites/zalando/IT/zalando_cc.html @@ -0,0 +1 @@ +Pagamento
acquisto sicuro
\ No newline at end of file diff --git a/modules/page_object_autofill.py b/modules/page_object_autofill.py index 013233e43..cc11a2abf 100644 --- a/modules/page_object_autofill.py +++ b/modules/page_object_autofill.py @@ -510,6 +510,7 @@ def verify_autofill_data_on_hover( is_present = any( [value in val for val in autofill_data.__dict__.values()] ) + assert is_present, ( f"Mismatched data: {(field, value)} not in {autofill_data.__dict__.values()}." ) diff --git a/modules/util.py b/modules/util.py index 5d54054c9..59d2250e3 100644 --- a/modules/util.py +++ b/modules/util.py @@ -112,6 +112,19 @@ def __init__(self): "Belgium": "België", "Austria": "Österreich", } + # Country code mapping for different regions + self.country_codes = { + "US": "1", + "CA": "1", + "FR": "33", + "DE": "49", + "GB": "44", + "IT": "39", + "PL": "48", + "ES": "34", + "BE": "32", + "AT": "43", + } self.fake = None self.locale = None @@ -556,23 +569,18 @@ def normalize_regional_phone_numbers(self, phone: str, region: str) -> str: str The normalized phone number in the format . """ + # Handle leading zero in local numbers before country code is removed + if region not in ["US", "CA"] and phone.startswith("0"): + # Remove the leading zero + phone = phone[1:] - # Country code mapping for different regions - country_codes = { - "US": "1", - "CA": "1", - "FR": "33", - "DE": "49", - "GB": "44", - "IT": "39", - "PL": "48", - "ES": "34", - "BE": "32", - "AT": "43", - } + # Fix Austrian phone number duplication issue before processing + if region == "AT" and "4343" in phone: + # Remove the duplicated country code + phone = phone.replace("4343", "43") # If phone is already normalized, return as it is - expected_country_code = country_codes.get(region) + expected_country_code = self.country_codes.get(region) if ( expected_country_code and phone.isdigit() @@ -581,17 +589,13 @@ def normalize_regional_phone_numbers(self, phone: str, region: str) -> str: ): return phone - # Fix Austrian duplicated country code before processing - if region == "AT" and phone.startswith("+4343"): - phone = "+43" + phone[5:] # Remove duplicated 43 - # Sub out anything that matches this regex statement with an empty string to get rid of extensions in generated phone numbers phone = re.sub(r"\s*(?:x|ext)\s*\d*$", "", phone, flags=re.IGNORECASE) # Sub out anything that is not a digit with the empty string to ensure the phone number is formatted with no spaces or special characters digits = re.sub(r"\D", "", phone) # Determine country code - country_code = country_codes.get( + country_code = self.country_codes.get( region, "1" ) # Default to "1" (US/CA) if the region is unknown # handle leading zeros @@ -602,7 +606,7 @@ def normalize_regional_phone_numbers(self, phone: str, region: str) -> str: # Remove country code from the local number local_number = digits[len(country_code) :] - # Handle leading zero in local numbers + # Handle leading zero in local numbers after country code is removed if region not in ["US", "CA"] and local_number.startswith("0"): # Remove the leading zero local_number = local_number[1:] @@ -613,7 +617,9 @@ def normalize_regional_phone_numbers(self, phone: str, region: str) -> str: return "" # Return formatted phone number with correct country code - return f"{country_code}{local_number}" + result = f"{country_code}{local_number}" + logging.info(f"Phone normalization result: {phone} -> {result}") + return result class BrowserActions: