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

Diff for: SELECTOR_INFO.md

+2-9
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
```

Diff for: 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

+1-5
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"]

Diff for: l10n_CM/Unified/test_demo_ad_dropdown_presence_address.py renamed to l10n_CM/Unified/test_demo_ad_1b_dropdown_address_fields.py

+1-5
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",

Diff for: 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

+2-8
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

Diff for: l10n_CM/Unified/test_demo_ad_hover_name_org.py renamed to l10n_CM/Unified/test_demo_ad_2a_preview_name_org_fields.py

+2-8
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
)

Diff for: l10n_CM/Unified/test_demo_ad_hover_verify_address.py renamed to l10n_CM/Unified/test_demo_ad_2b_preview_address_fields.py

+12-14
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
)

Diff for: 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

+8-11
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+
)

Diff for: l10n_CM/Unified/test_demo_ad_autofill_address_fields.py renamed to l10n_CM/Unified/test_demo_ad_3a_autofill_address_fields.py

+3-7
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
]

Diff for: l10n_CM/Unified/test_demo_ad_autofill_name_org.py renamed to l10n_CM/Unified/test_demo_ad_3b_autofill_name_org_fields.py

+1-5
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"]

Diff for: l10n_CM/Unified/test_demo_ad_autofill_phone_email.py renamed to l10n_CM/Unified/test_demo_ad_3c_autofill_phone_email_fields.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,9 @@ def test_demo_ad_autofill_phone_email(
2121
"""
2222
C2888569 - Verify Autofill functionality when selecting an entry from the dropdown for tele/email fields
2323
"""
24-
2524
# Create fake data and fill it in
2625
address_autofill.open()
27-
address_autofill_data = util.fake_autofill_data(region)
28-
address_autofill.save_information_basic(address_autofill_data)
29-
30-
# Click the "Save" button
31-
autofill_popup.click_doorhanger_button("save")
26+
address_autofill_data = address_autofill.fill_and_save(util, autofill_popup, region)
3227

3328
# List of field labels to be autofilled and verified
3429
fields_to_test = ["email", "tel"]

Diff for: l10n_CM/Unified/test_demo_ad_yellow_highlight_name_org.py renamed to l10n_CM/Unified/test_demo_ad_4a_highlight_name_org_fields.py

+7-10
Original file line numberDiff line numberDiff line change
@@ -21,24 +21,21 @@ def test_address_yellow_highlight_on_name_organization_fields(
2121
"""
2222
C2888559 - Verify the yellow highlight appears on autofilled fields for name and organization.
2323
"""
24-
2524
# Create fake data and fill it in
2625
address_autofill.open()
27-
address_autofill_data = util.fake_autofill_data(region)
28-
address_autofill.save_information_basic(address_autofill_data)
29-
30-
# Click the "Save" button
31-
autofill_popup.click_doorhanger_button("save")
26+
address_autofill.fill_and_save(util, autofill_popup, region)
3227

3328
# Double click inside name field and select a saved address entry from the dropdown
3429
address_autofill.double_click("form-field", labels=["name"])
30+
autofill_popup.ensure_autofill_dropdown_visible()
3531

3632
# Click on the first element from the autocomplete dropdown
37-
first_item = autofill_popup.get_nth_element(1)
38-
autofill_popup.click_on(first_item)
33+
autofill_popup.select_nth_element(1)
3934

35+
field_to_test = ["name", "organization"]
4036
# Verify the name and organization fields are highlighted
4137
address_autofill.verify_field_yellow_highlights(
42-
fields_to_test=["name", "organization"],
43-
expected_highlighted_fields=["name", "organization"],
38+
region,
39+
fields_to_test=field_to_test,
40+
expected_highlighted_fields=field_to_test,
4441
)

Diff for: l10n_CM/Unified/test_demo_ad_yellow_highlight_address.py renamed to l10n_CM/Unified/test_demo_ad_4b_highlight_address_fields.py

+13-23
Original file line numberDiff line numberDiff line change
@@ -23,34 +23,24 @@ def test_address_yellow_highlight_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)
26+
address_autofill.fill_and_save(util, autofill_popup, region)
2827

29-
# Click the "Save" button
30-
autofill_popup.click_doorhanger_button("save")
31-
32-
# Double click inside street address field and select a saved address entry from the dropdown
28+
# Double click inside name field and select a saved address entry from the dropdown
3329
address_autofill.double_click("form-field", labels=["street-address"])
30+
autofill_popup.ensure_autofill_dropdown_visible()
3431

3532
# Click on the first element from the autocomplete dropdown
36-
first_item = autofill_popup.get_nth_element(1)
37-
autofill_popup.click_on(first_item)
33+
autofill_popup.select_nth_element(1)
34+
35+
field_to_test = [
36+
"street-address",
37+
"address-level2",
38+
"address-level1",
39+
"postal-code",
40+
"country",
41+
]
3842

3943
# Verify the address fields are highlighted
4044
address_autofill.verify_field_yellow_highlights(
41-
region=region,
42-
fields_to_test=[
43-
"street-address",
44-
"address-level2",
45-
"address-level1",
46-
"postal-code",
47-
"country",
48-
],
49-
expected_highlighted_fields=[
50-
"street-address",
51-
"address-level2",
52-
"address-level1",
53-
"postal-code",
54-
"country",
55-
],
45+
region, fields_to_test=field_to_test, expected_highlighted_fields=field_to_test
5646
)

Diff for: l10n_CM/Unified/test_demo_ad_yellow_highlight_phone_email.py renamed to l10n_CM/Unified/test_demo_ad_4c_highlight_phone_email_fields.py

+7-11
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,19 @@ def test_address_yellow_highlight_address_fields(
2121
"""
2222
C2888570 - Verify the yellow highlight appears on autofilled fields for the email and phone fields.
2323
"""
24-
2524
# Create fake data and fill it in
2625
address_autofill.open()
27-
address_autofill_data = util.fake_autofill_data(region)
28-
address_autofill.save_information_basic(address_autofill_data)
29-
30-
# Click the "Save" button
31-
autofill_popup.click_doorhanger_button("save")
26+
address_autofill.fill_and_save(util, autofill_popup, region)
3227

33-
# Double click inside email field and select a saved address entry from the dropdown
28+
# Double click inside name field and select a saved address entry from the dropdown
3429
address_autofill.double_click("form-field", labels=["email"])
30+
autofill_popup.ensure_autofill_dropdown_visible()
3531

3632
# Click on the first element from the autocomplete dropdown
37-
first_item = autofill_popup.get_nth_element(1)
38-
autofill_popup.click_on(first_item)
33+
autofill_popup.select_nth_element(1)
3934

40-
# Verify the email and phone fields are highlighted
35+
field_to_test = ["email", "tel"]
36+
# Verify the address fields are highlighted
4137
address_autofill.verify_field_yellow_highlights(
42-
fields_to_test=["email", "tel"], expected_highlighted_fields=["email", "tel"]
38+
region, fields_to_test=field_to_test, expected_highlighted_fields=field_to_test
4339
)

Diff for: l10n_CM/Unified/test_demo_ad_clear_name_org.py renamed to l10n_CM/Unified/test_demo_ad_5a_clear_name_org_fields.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,7 @@ def test_demo_ad_clear_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"]

Diff for: l10n_CM/Unified/test_demo_ad_clear_address_fields.py renamed to l10n_CM/Unified/test_demo_ad_5b_clear_address_fields.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,7 @@ def test_demo_ad_clear_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 = [

Diff for: l10n_CM/Unified/test_demo_ad_clear_tel_email.py renamed to l10n_CM/Unified/test_demo_ad_5c_clear_phone_email_fields.py

+1-6
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,9 @@ def test_demo_ad_clear_tel_email(
2121
"""
2222
C2888571 - Verify clear functionality after selecting an entry from tele/email fields
2323
"""
24-
2524
# Create fake data and fill it in
2625
address_autofill.open()
27-
address_autofill_data = util.fake_autofill_data(region)
28-
address_autofill.save_information_basic(address_autofill_data)
29-
30-
# Click the "Save" button
31-
autofill_popup.click_doorhanger_button("save")
26+
address_autofill_data = address_autofill.fill_and_save(util, autofill_popup, region)
3227

3328
# List of field labels to be autofilled and verified
3429
fields_to_test = ["email", "tel"]

Diff for: l10n_CM/Unified/test_demo_ad_doorhanger_shown_on_valid_address_submission.py renamed to l10n_CM/Unified/test_demo_ad_6_capture_doorhanger_appearance.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ def test_address_doorhanger_displayed_after_entering_valid_address(
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)
26+
address_autofill.fill_and_save(util, autofill_popup, region, door_hanger=False)
2827

2928
# Check "Save Address?" door hanger appears in the Address bar
3029
autofill_popup.element_visible("address-save-doorhanger")

0 commit comments

Comments
 (0)