Skip to content

Commit 3aaf68e

Browse files
Merge pull request #624 from mozilla/philimon/l10n_fixes
l10n fixes
2 parents 784616d + cf80799 commit 3aaf68e

File tree

4 files changed

+37
-25
lines changed

4 files changed

+37
-25
lines changed

l10n_CM/constants/amazon/DE/amazon_ad.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"field_mapping": {
44
"country": "90b596de-e266-4e66-9530-2e41b184555d",
55
"name": "28f5f493-ad18-4e7c-99fa-524bc768ed7a",
6-
"telephone": "28f5f493-ad18-4e7c-99fa-524bc768ed7a",
7-
"address_level_1": "a5fb9e4c-60a0-42a2-9e4a-6a067b55d208",
6+
"telephone": "c384d303-3e2b-4b8a-ba89-c741056fc9b4",
7+
"street_address": "a5fb9e4c-60a0-42a2-9e4a-6a067b55d208",
88
"organization": "9e8475b3-e1a5-46cf-9af0-6f2caab918fe",
99
"address_level_2": "67cbe0f8-dbe4-4afd-a077-765186bcf0b3",
1010
"postal_code": "e38f3160-4ce5-4804-b5d5-b92c3ccc499e"
@@ -13,7 +13,7 @@
1313
"fields": [
1414
"90b596de-e266-4e66-9530-2e41b184555d",
1515
"28f5f493-ad18-4e7c-99fa-524bc768ed7a",
16-
"28f5f493-ad18-4e7c-99fa-524bc768ed7a",
16+
"c384d303-3e2b-4b8a-ba89-c741056fc9b4",
1717
"a5fb9e4c-60a0-42a2-9e4a-6a067b55d208",
1818
"9e8475b3-e1a5-46cf-9af0-6f2caab918fe",
1919
"67cbe0f8-dbe4-4afd-a077-765186bcf0b3",
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
{
22
"url": "http://127.0.0.1:8080/amazon_ad.html",
33
"field_mapping": {
4-
"country": "da8fcb20-ecdb-44de-8fe6-d0086af67e96",
5-
"name": "53cea474-f431-4d44-bf79-83e28ff8afc1",
6-
"telephone": "c75098c8-1441-4e12-93bd-e213af1dc745",
7-
"address_level_1": "e1311f61-d43d-403a-94b4-127107489157",
8-
"address_level_2": "3809592b-2557-4035-b089-1adbe42a51ad",
9-
"postal_code": "122f5d67-36a2-47c7-b759-8ab92103d602"
4+
"country": "ec708d25-c69f-48a6-80f1-be4e96b6db04",
5+
"name": "87e21b43-187e-400b-bd9d-fd889f9fbaa0",
6+
"telephone": "499c2ea7-72a7-4e8f-8f76-5e37bb793016",
7+
"street_address": "3f36ea97-c7d4-4334-baba-ed7bb1d31230",
8+
"address_level_2": "ef31ec08-7a7a-4a82-b68e-495d3154700c",
9+
"postal_code": "71d96b8d-e26c-4aab-bfd7-b2bdb6b4ceb7"
1010
},
1111
"form_field": "*[data-moz-autofill-inspect-id='{name}']",
1212
"fields": [
13-
"da8fcb20-ecdb-44de-8fe6-d0086af67e96",
14-
"53cea474-f431-4d44-bf79-83e28ff8afc1",
15-
"c75098c8-1441-4e12-93bd-e213af1dc745",
16-
"e1311f61-d43d-403a-94b4-127107489157",
17-
"3809592b-2557-4035-b089-1adbe42a51ad",
18-
"122f5d67-36a2-47c7-b759-8ab92103d602"
13+
"ec708d25-c69f-48a6-80f1-be4e96b6db04",
14+
"87e21b43-187e-400b-bd9d-fd889f9fbaa0",
15+
"499c2ea7-72a7-4e8f-8f76-5e37bb793016",
16+
"3f36ea97-c7d4-4334-baba-ed7bb1d31230",
17+
"ef31ec08-7a7a-4a82-b68e-495d3154700c",
18+
"71d96b8d-e26c-4aab-bfd7-b2bdb6b4ceb7"
1919
]
2020
}

l10n_CM/constants/amazon/FR/amazon_cc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"form_field": "*[data-moz-autofill-inspect-id='{name}']",
1010
"fields": [
1111
"4bfc1932-75e6-436c-b195-a443beb1adfc",
12-
"4f630b6e-efd1-458d-9762-9a12a3dd28de",
12+
"b48f8715-36a7-4c89-8c64-5a5471f7d9f2",
1313
"fe1bdc2d-e0e3-477b-9d4a-416221ad0851",
1414
"68a5e85d-d8c5-4d10-9827-394263770656"
1515
]

modules/page_object_autofill.py

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ def click_form_field(self, attr_name: str):
146146
"""Click the form field given the attribute name."""
147147
field = self.field_mapping.get(attr_name, None)
148148
if field:
149+
self.get_element("form-field", labels=[field]).clear()
149150
self.double_click("form-field", labels=[field])
150151
else:
151152
logging.warning(f"The field: {attr_name} is not available in the site.")
@@ -236,12 +237,14 @@ def verify_form_data(self, sample_data: CreditCardBase | AutofillAddressBase):
236237
autofilled_field
237238
).first_selected_option.text
238239
if (
239-
field_name == "address-level1"
240+
attr_name == "address_level_1"
240241
and autofilled_field_value != expected_value
241242
):
242243
expected_value = self.util.get_state_province_abbreviation(
243244
expected_value
244245
)
246+
elif attr_name == "expiration_date" and len(autofilled_field_value) > 5:
247+
autofilled_field_value = autofilled_field_value.replace("20", "")
245248
assert expected_value in autofilled_field_value, (
246249
f"{autofilled_field_value} is different from {expected_value}"
247250
)
@@ -282,6 +285,7 @@ def verify_field_autofill_dropdown(
282285
if field:
283286
autofill_field = self.get_element("form-field", labels=[field])
284287
if autofill_field.tag_name.lower() != "select":
288+
autofill_field.clear()
285289
# more general way of activating the dropdown
286290
self.double_click("form-field", labels=[field])
287291
autofill_field.send_keys("")
@@ -370,13 +374,14 @@ def is_yellow_highlight(rgb_tuple):
370374
if field:
371375
autofill_field = self.get_element("form-field", labels=[field])
372376
if autofill_field.tag_name.lower() != "select":
377+
autofill_field.clear()
373378
# Focus the field so the highlight is visible
374379
self.click_on("form-field", labels=[field])
375380

376381
# Get all colors in the field
377382
selector = self.get_selector("form-field", labels=[field])
378383
colors = self.browser_actions.get_all_colors_in_element(selector)
379-
logging.info(f"Colors found in '{field}': {colors}")
384+
logging.info(f"Colors found in '{field_name}': {colors}")
380385

381386
# Check the highlight
382387
is_field_highlighted = any(
@@ -387,20 +392,24 @@ def is_yellow_highlight(rgb_tuple):
387392
# Assert based on expectation
388393
if should_be_highlighted:
389394
assert is_field_highlighted, (
390-
f"Expected yellow highlight on '{field}', but none found."
395+
f"Expected yellow highlight on '{field_name}', but none found."
391396
)
392-
logging.info(f"Yellow highlight found in '{field}'.")
397+
logging.info(f"Yellow highlight found in '{field_name}'.")
393398
else:
394399
assert not is_field_highlighted, (
395-
f"Expected NO yellow highlight on '{field}', but found one."
400+
f"Expected NO yellow highlight on '{field_name}', but found one."
401+
)
402+
logging.info(
403+
f"No yellow highlight in '{field_name}', as expected."
396404
)
397-
logging.info(f"No yellow highlight in '{field}', as expected.")
398405
else:
399406
logging.info(
400-
f"Field: {field} is a select element. No autofill option."
407+
f"Field: {field_name} is a select element. No autofill option."
401408
)
402409
else:
403-
logging.warning(f"The field: {field} is not available in the site.")
410+
logging.warning(
411+
f"The field: {field_name} is not available in the site."
412+
)
404413

405414
return self
406415

@@ -470,7 +479,7 @@ def sanitize_preview_data(self, field, value):
470479
value = value[-4:]
471480
elif field == "cc-exp-year":
472481
value = value[-2:]
473-
elif value[0] == "+":
482+
elif field == "tel" or value[0] == "+":
474483
value = self.util.normalize_phone_number(value)
475484
return value
476485

@@ -485,6 +494,7 @@ def select_autofill_option(self, field, index: int = 1):
485494
"""
486495
autofill_field = self.get_element("form-field", labels=[field])
487496
if autofill_field.tag_name.lower() != "select":
497+
autofill_field.clear()
488498
self.double_click("form-field", labels=[field])
489499
self.autofill_popup.ensure_autofill_dropdown_visible()
490500
self.autofill_popup.select_nth_element(index)
@@ -554,6 +564,7 @@ def check_autofill_preview_for_field(
554564
if field:
555565
autofill_field = self.get_element("form-field", labels=[field])
556566
if autofill_field.tag_name.lower() != "select":
567+
autofill_field.clear()
557568
self.double_click("form-field", labels=[field])
558569
self.autofill_popup.ensure_autofill_dropdown_visible()
559570
self.autofill_popup.hover("select-form-option")
@@ -609,6 +620,7 @@ def clear_and_verify(
609620
if field:
610621
autofill_field = self.get_element("form-field", labels=[field])
611622
if autofill_field.tag_name.lower() != "select":
623+
autofill_field.clear()
612624
# Double-click a field and choose the first element from the autocomplete dropdown
613625
self.double_click("form-field", labels=[field])
614626
self.autofill_popup.ensure_autofill_dropdown_visible()

0 commit comments

Comments
 (0)