Skip to content

Commit 3d02a58

Browse files
authored
Merge pull request #543 from mozilla/as/l10n-improve-readability
Anca/ Improve l10n tests readability
2 parents 4f6041c + dd49a6b commit 3d02a58

File tree

37 files changed

+382
-466
lines changed

37 files changed

+382
-466
lines changed

SELECTOR_INFO.md

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1537,15 +1537,8 @@ Path to .json: modules/data/autofill_popup.components.json
15371537
```
15381538
```
15391539
Selector Name: address-doorhanger-zip
1540-
Selector Data: "div.address-save-update-row-container:nth-of-type(1) div p:nth-of-type(4) span:nth-of-type(5)"
1541-
Description: Save address doorhanger zip section for US and CA
1542-
Location: Address bar
1543-
Path to .json: modules/data/autofill_popup.components.json
1544-
```
1545-
```
1546-
Selector Name: address-doorhanger-zip-other
1547-
Selector Data: "selectorData": "div.address-save-update-row-container:nth-of-type(1) div p:nth-of-type(4) span:nth-of-type(3)",
1548-
Description: Save address doorhanger zip section for other regions
1540+
Selector Data: "div.address-save-update-row-container:nth-of-type(1) div p:nth-of-type(4) span:nth-last-of-type(1)"
1541+
Description: Save address doorhanger zip section
15491542
Location: Address bar
15501543
Path to .json: modules/data/autofill_popup.components.json
15511544
```

l10n_CM/Unified/test_demo_ad_dropdown_presence_name_org.py renamed to l10n_CM/Unified/test_demo_ad_1a_dropdown_name_org_fields.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,7 @@ def test_dropdown_presence_name_organization(
2525

2626
# Create fake data and fill it in
2727
address_autofill.open()
28-
address_autofill_data = util.fake_autofill_data(region)
29-
address_autofill.save_information_basic(address_autofill_data)
30-
31-
# Click the "Save" button
32-
autofill_popup.click_doorhanger_button("save")
28+
address_autofill.fill_and_save(util, autofill_popup, region)
3329

3430
# Verify that the name and organization fields have the autofill dropdown present
3531
fields_to_test = ["name", "organization"]

l10n_CM/Unified/test_demo_ad_dropdown_presence_address.py renamed to l10n_CM/Unified/test_demo_ad_1b_dropdown_address_fields.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,7 @@ def test_dropdown_presence_address_field(
2525

2626
# Create fake data and fill it in
2727
address_autofill.open()
28-
address_autofill_data = util.fake_autofill_data(region)
29-
address_autofill.save_information_basic(address_autofill_data)
30-
31-
# Click the "Save" button
32-
autofill_popup.click_doorhanger_button("save")
28+
address_autofill.fill_and_save(util, autofill_popup, region)
3329

3430
fields_to_test = [
3531
"street-address",

l10n_CM/Unified/test_demo_ad_autofill_dropdown_present_for_email_and_phone.py renamed to l10n_CM/Unified/test_demo_ad_1c_dropdown_phone_email_fields.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,9 @@ def test_dropdown_presence_email_phone_field(
2323
after the contact information was previously saved.
2424
"""
2525

26-
# Open autofill page
26+
# Open autofill page and fill fake data
2727
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")
28+
address_autofill.fill_and_save(util, autofill_popup, region)
3529

3630
fields_to_test = ["email", "tel"]
3731

l10n_CM/Unified/test_demo_ad_hover_name_org.py renamed to l10n_CM/Unified/test_demo_ad_2a_preview_name_org_fields.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import logging
2-
31
import pytest
42
from selenium.webdriver import Firefox
53

@@ -25,15 +23,11 @@ def test_demo_ad_hover_name_org(
2523
"""
2624
# Create fake data and fill it in
2725
address_autofill.open()
28-
autofill_data = util.fake_autofill_data(region)
29-
address_autofill.save_information_basic(autofill_data)
30-
31-
# Click the "Save" button
32-
autofill_popup.click_doorhanger_button("save")
26+
autofill_data = address_autofill.fill_and_save(util, autofill_popup, region)
3327

3428
# Hover over each field and check data preview
3529
fields_to_test = ["name", "organization"]
3630
for field in fields_to_test:
3731
address_autofill.check_autofill_preview_for_field(
38-
field, autofill_data, autofill_popup, util
32+
field, autofill_data, autofill_popup, util, region
3933
)

l10n_CM/Unified/test_demo_ad_hover_verify_address.py renamed to l10n_CM/Unified/test_demo_ad_2b_preview_address_fields.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,21 @@ def test_hover_address_is_previewed(
2929
util: Utilities,
3030
):
3131
"""
32-
C2888562: Verify that hovering over field will preview all fields
32+
C2888562: Verify that hovering over address fields will preview all fields
3333
"""
3434
# Create fake data and fill it in
3535
address_autofill.open()
36-
address_autofill_data = util.fake_autofill_data(region)
37-
address_autofill.save_information_basic(address_autofill_data)
36+
autofill_data = address_autofill.fill_and_save(util, autofill_popup, region)
3837

39-
# Click the "Save" button
40-
autofill_popup.click_doorhanger_button("save")
4138
# Hover over each field and check data preview
42-
for field in AddressFill.fields:
43-
# hack to pass over fields that don't show up in autofill dropdown
44-
if field == "address-level1" and region in ["DE", "FR"]:
45-
continue
46-
address_autofill.double_click("form-field", labels=[field])
47-
autofill_popup.ensure_autofill_dropdown_visible()
48-
autofill_popup.hover("select-form-option")
49-
address_autofill.verify_autofill_data_on_hover(
50-
address_autofill_data, autofill_popup, util
39+
fields_to_test = [
40+
"street-address",
41+
"address-level2", # city
42+
"address-level1", # state/province
43+
"postal-code",
44+
"country",
45+
]
46+
for field in fields_to_test:
47+
address_autofill.check_autofill_preview_for_field(
48+
field, autofill_data, autofill_popup, util, region
5149
)

l10n_CM/Unified/test_demo_ad_hover_over_tele_and_email_dropdown.py renamed to l10n_CM/Unified/test_demo_ad_2c_preview_phone_email_fields.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,13 @@ def test_hover_email_and_phone_autofill_preview(
2020
autofill_popup: AutofillPopup,
2121
util: Utilities,
2222
):
23+
# Create fake data and fill it in
2324
address_autofill.open()
24-
autofill_data = util.fake_autofill_data(region)
25-
address_autofill.save_information_basic(autofill_data)
26-
autofill_popup.click_doorhanger_button("save")
25+
autofill_data = address_autofill.fill_and_save(util, autofill_popup, region)
2726

28-
# Check Email field preview.
29-
address_autofill.check_autofill_preview_for_field(
30-
"email", autofill_data, autofill_popup, util
31-
)
32-
# Check Phone field preview (using the correct label "tel").
33-
address_autofill.check_autofill_preview_for_field(
34-
"tel", autofill_data, autofill_popup, util
35-
)
27+
# Hover over each field and check data preview
28+
fields_to_test = ["email", "tel"]
29+
for field in fields_to_test:
30+
address_autofill.check_autofill_preview_for_field(
31+
field, autofill_data, autofill_popup, util, region
32+
)

l10n_CM/Unified/test_demo_ad_autofill_address_fields.py renamed to l10n_CM/Unified/test_demo_ad_3a_autofill_address_fields.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,13 @@ def test_demo_ad_autofill_address_fields(
2323
"""
2424
# Create fake data and fill it in
2525
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")
26+
address_autofill_data = address_autofill.fill_and_save(util, autofill_popup, region)
3127

3228
# List of field labels to be autofilled and verified
3329
fields_to_test = [
34-
"street-address",
35-
"address-level2",
3630
"address-level1", # This will be skipped for DE/FR
31+
"address-level2",
32+
"street-address",
3733
"postal-code",
3834
"country",
3935
]

l10n_CM/Unified/test_demo_ad_autofill_name_org.py renamed to l10n_CM/Unified/test_demo_ad_3b_autofill_name_org_fields.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,7 @@ def test_demo_ad_autofill_name_org(
2323
"""
2424
# Create fake data and fill it in
2525
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")
26+
address_autofill_data = address_autofill.fill_and_save(util, autofill_popup, region)
3127

3228
# List of field labels to be autofilled and verified
3329
fields_to_test = ["name", "organization"]

0 commit comments

Comments
 (0)