Skip to content

Commit be7f2c8

Browse files
philimon-resetvsangereanMOZ
authored andcommitted
broken change to ignore doorhanger
1 parent fcdd60f commit be7f2c8

20 files changed

+288
-252
lines changed

SELECTOR_INFO.md

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -571,13 +571,6 @@ Location: about:preferences#privacy popup dialog
571571
Path to .json: modules/data/about_prefs.components.json
572572
```
573573
```
574-
Selector Name: dialog-close-button
575-
Selector Data: "dialogClose"
576-
Description: The close button of the popup dialog
577-
Location: top right corner of about:preferences popup dialog
578-
Path to .json: modules/data/about_prefs.components.json
579-
```
580-
```
581574
Selector Name: saved-addresses
582575
Selector Data: "addresses"
583576
Description: The element that contains the saved addresses
@@ -1368,14 +1361,7 @@ Location: Inside any autofill-eligible form field, triggered by user interaction
13681361
Path to .json: modules/data/autofill_popup.components.json
13691362
```
13701363
```
1371-
Selector Name: address-preview-form-container
1372-
Selector Data: "address-save-update-notification-content"
1373-
Description: Form container that is hidden in chrome context. Used to verify hover preview data
1374-
Location: Inside chrome context, holds the data that would be showed as a preview when autofill is hovered.
1375-
Path to .json: modules/data/autofill_popup.components.json
1376-
```
1377-
```
1378-
Selector Name: cc-preview-form-container
1364+
Selector Name: preview-form-container
13791365
Selector Data: ".autocomplete-richlistbox richlistitem"
13801366
Description: Form container that is hidden in chrome context. Used to verify hover preview data
13811367
Location: Inside chrome context, holds the data that would be showed as a preview when autofill is hovered.

l10n_CM/Unified/conftest.py

Lines changed: 88 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,24 @@ def region():
1818
return os.environ.get("FX_REGION", "US")
1919

2020

21+
@pytest.fixture()
22+
def add_to_prefs_list(region: str):
23+
return []
24+
25+
26+
@pytest.fixture()
27+
def prefs_list(add_to_prefs_list: List[tuple[str, str | bool]], region: str):
28+
"""List of prefs to send to main conftest.py driver fixture"""
29+
prefs = [
30+
("extensions.formautofill.creditCards.reauth.optout", False),
31+
("extensions.formautofill.reauth.enabled", False),
32+
("browser.aboutConfig.showWarning", False),
33+
("browser.search.region", region),
34+
]
35+
prefs.extend(add_to_prefs_list)
36+
return prefs
37+
38+
2139
@pytest.fixture()
2240
def site_data():
2341
live_site = os.environ.get("FX_SITE", None)
@@ -47,66 +65,98 @@ def field_mapping(site_data):
4765

4866

4967
@pytest.fixture()
50-
def submit_button(site_data):
51-
submit = site_data.get("submit_button", None)
52-
return (
53-
{"submit-button": {"selectorData": submit, "strategy": "css", "groups": []}}
54-
if submit
55-
else {}
68+
def address_autofill(driver, url_template, fields, field_mapping):
69+
return AddressFill(
70+
driver, url_template=url_template, field_mapping=field_mapping, fields=fields
5671
)
5772

5873

5974
@pytest.fixture()
60-
def add_to_prefs_list(region: str):
61-
return []
75+
def credit_card_autofill(driver, url_template, fields, field_mapping):
76+
return CreditCardFill(
77+
driver, url_template=url_template, field_mapping=field_mapping, fields=fields
78+
)
6279

6380

6481
@pytest.fixture()
65-
def prefs_list(add_to_prefs_list: List[tuple[str, str | bool]], region: str):
66-
"""List of prefs to send to main conftest.py driver fixture"""
67-
prefs = [
68-
("extensions.formautofill.creditCards.reauth.optout", False),
69-
("extensions.formautofill.reauth.enabled", False),
70-
("browser.aboutConfig.showWarning", False),
71-
("browser.search.region", region),
72-
]
73-
prefs.extend(add_to_prefs_list)
74-
return prefs
82+
def autofill_popup(driver):
83+
return AutofillPopup(driver)
7584

7685

7786
@pytest.fixture()
78-
def address_autofill(driver, url_template, fields, field_mapping, submit_button):
79-
af = AddressFill(
80-
driver, url_template=url_template, field_mapping=field_mapping, fields=fields
81-
)
82-
af.elements |= submit_button
83-
yield af
87+
def util():
88+
return Utilities()
8489

8590

8691
@pytest.fixture()
87-
def credit_card_autofill(driver, url_template, fields, field_mapping, submit_button):
88-
cf = CreditCardFill(
89-
driver, url_template=url_template, field_mapping=field_mapping, fields=fields
90-
)
91-
cf.elements |= submit_button
92-
yield cf
92+
def about_prefs_privacy(driver):
93+
return AboutPrefs(driver, category="privacy")
9394

9495

9596
@pytest.fixture()
96-
def autofill_popup(driver):
97-
yield AutofillPopup(driver)
97+
def about_prefs(driver):
98+
return AboutPrefs(driver)
9899

99100

100101
@pytest.fixture()
101-
def util():
102-
yield Utilities()
102+
def populate_saved_payments(
103+
about_prefs_privacy: AboutPrefs, util: Utilities, region: str
104+
):
105+
"""Fixture to add cc data through saved payments method."""
106+
# Go to about:preferences#privacy and open Saved Payment Methods
107+
about_prefs_privacy.open()
108+
about_prefs_privacy.open_and_switch_to_saved_payments_popup()
109+
110+
# Save CC information using fake data
111+
credit_card_sample_data = util.fake_credit_card_data(region)
112+
113+
# Add a new CC profile
114+
about_prefs_privacy.click_add_on_dialog_element()
115+
about_prefs_privacy.add_entry_to_saved_payments(credit_card_sample_data)
116+
return credit_card_sample_data
103117

104118

105119
@pytest.fixture()
106-
def about_prefs_privacy(driver):
107-
yield AboutPrefs(driver, category="privacy")
120+
def populate_saved_addresses(
121+
about_prefs_privacy: AboutPrefs, util: Utilities, region: str
122+
):
123+
"""Fixture to add cc data through saved payments method."""
124+
# Go to about:preferences#privacy and open Saved Addresses Methods
125+
about_prefs_privacy.open()
126+
about_prefs_privacy.open_and_switch_to_saved_addresses_popup()
127+
128+
# Save address information using fake data
129+
address_data_sample_data = util.fake_autofill_data(region)
130+
131+
# Add a new address profile
132+
about_prefs_privacy.click_add_on_dialog_element()
133+
about_prefs_privacy.add_entry_to_saved_addresses(address_data_sample_data)
134+
return address_data_sample_data
108135

109136

110137
@pytest.fixture()
111-
def about_prefs(driver):
112-
yield AboutPrefs(driver)
138+
def fill_and_save_address(
139+
address_autofill: AddressFill, url_template: str | None, region: str, request
140+
):
141+
"""
142+
Fixture to populate address entry depending on whether the url is a live site.
143+
If live site, populate data through about:prefs, if not fill directly through page.
144+
"""
145+
if url_template:
146+
return request.getfixturevalue("populate_saved_addresses")
147+
address_autofill.open()
148+
return address_autofill.fill_and_save(region)
149+
150+
151+
@pytest.fixture()
152+
def fill_and_save_payments(
153+
credit_card_autofill: CreditCardFill, url_template: str | None, region: str, request
154+
):
155+
"""
156+
Fixture to populate cc entry depending on whether the url is a live site.
157+
If live site, populate data through about:prefs, if not fill directly through page.
158+
"""
159+
if url_template:
160+
return request.getfixturevalue("populate_saved_payments")
161+
credit_card_autofill.open()
162+
return credit_card_autofill.fill_and_save(region)

l10n_CM/Unified/test_demo_ad_0_add_new_address.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import pytest
44
from selenium.webdriver import Firefox
55

6+
from modules.classes.autofill_base import AutofillAddressBase
67
from modules.page_object_prefs import AboutPrefs
78
from modules.util import Utilities
89

@@ -21,23 +22,21 @@ def add_to_prefs_list(region: str):
2122

2223

2324
def test_verify_new_address_is_added(
24-
driver: Firefox, region: str, about_prefs_privacy: AboutPrefs, util: Utilities
25+
driver: Firefox,
26+
region: str,
27+
about_prefs_privacy: AboutPrefs,
28+
util: Utilities,
29+
populate_saved_addresses: AutofillAddressBase,
2530
):
2631
"""
2732
C2886580: Verify that a new Address can be added
2833
"""
2934
# invert state_province_abbr to help with verification
3035
inverted_state_province_abbr = {v: k for k, v in util.state_province_abbr.items()}
31-
# generate fake data for region
32-
address_autofill_data = util.fake_autofill_data(region)
3336

34-
# open saved addresses
35-
about_prefs_privacy.open()
37+
# address autofill data
38+
address_autofill_data = populate_saved_addresses
3639
about_prefs_privacy.open_and_switch_to_saved_addresses_popup()
37-
# add new entry to saved addresses
38-
about_prefs_privacy.click_add_on_dialog_element()
39-
about_prefs_privacy.add_entry_to_saved_addresses(address_autofill_data)
40-
about_prefs_privacy.switch_to_saved_addresses_popup_iframe()
4140

4241
# verify that the address saved is the same.
4342
# The address saved in step 2 is listed in the "Saved addresses" modal: name and organization

l10n_CM/Unified/test_demo_ad_1a_dropdown_name_org_fields.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from selenium.webdriver import Firefox
33

44
from modules.browser_object_autofill_popup import AutofillPopup
5+
from modules.classes.autofill_base import AutofillAddressBase
56
from modules.page_object_autofill import AddressFill
67
from modules.util import Utilities
78

@@ -17,15 +18,14 @@ def test_dropdown_presence_name_organization(
1718
address_autofill: AddressFill,
1819
util: Utilities,
1920
autofill_popup: AutofillPopup,
21+
fill_and_save_address: AutofillAddressBase,
2022
):
2123
"""
2224
C2888556 - Verify that the autofill dropdown is displayed for the name and organization fields after an address was
2325
previously saved
2426
"""
25-
26-
# Create fake data and fill it in
27+
# open address filling url page
2728
address_autofill.open()
28-
address_autofill.fill_and_save(region)
2929

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

l10n_CM/Unified/test_demo_ad_1b_dropdown_address_fields.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from selenium.webdriver import Firefox
33

44
from modules.browser_object_autofill_popup import AutofillPopup
5+
from modules.classes.autofill_base import AutofillAddressBase
56
from modules.page_object_autofill import AddressFill
67
from modules.util import Utilities
78

@@ -17,15 +18,14 @@ def test_dropdown_presence_address_field(
1718
address_autofill: AddressFill,
1819
util: Utilities,
1920
autofill_popup: AutofillPopup,
21+
fill_and_save_address: AutofillAddressBase,
2022
):
2123
"""
2224
C2888561 - Verify that the autofill dropdown is displayed for the eligible address fields after an address was
2325
previously saved
2426
"""
25-
26-
# Create fake data and fill it in
27+
# open address filling url page
2728
address_autofill.open()
28-
address_autofill.fill_and_save(region)
2929

3030
fields_to_test = [
3131
"street_address",

l10n_CM/Unified/test_demo_ad_1c_dropdown_phone_email_fields.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from selenium.webdriver import Firefox
33

44
from modules.browser_object_autofill_popup import AutofillPopup
5+
from modules.classes.autofill_base import AutofillAddressBase
56
from modules.page_object_autofill import AddressFill
67
from modules.util import Utilities
78

@@ -17,15 +18,15 @@ def test_dropdown_presence_email_phone_field(
1718
address_autofill: AddressFill,
1819
util: Utilities,
1920
autofill_popup: AutofillPopup,
21+
fill_and_save_address: AutofillAddressBase,
2022
):
2123
"""
2224
C2888567 - Verify that the autofill dropdown is displayed for the email and phone fields
2325
after the contact information was previously saved.
2426
"""
2527

26-
# Open autofill page and fill fake data
28+
# Open autofill page
2729
address_autofill.open()
28-
address_autofill.fill_and_save(region)
2930

3031
fields_to_test = ["email", "telephone"]
3132

l10n_CM/Unified/test_demo_ad_2a_preview_name_org_fields.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from selenium.webdriver import Firefox
33

44
from modules.browser_object_autofill_popup import AutofillPopup
5+
from modules.classes.autofill_base import AutofillAddressBase
56
from modules.page_object_autofill import AddressFill
67
from modules.util import Utilities
78

@@ -17,13 +18,16 @@ def test_demo_ad_hover_name_org(
1718
address_autofill: AddressFill,
1819
util: Utilities,
1920
autofill_popup: AutofillPopup,
21+
fill_and_save_address: AutofillAddressBase,
2022
):
2123
"""
2224
C2888557 - Verify Autofill Preview on hover over dropdown entries for name/org fields
2325
"""
24-
# Create fake data and fill it in
26+
# Create fake data
2527
address_autofill.open()
26-
autofill_data = address_autofill.fill_and_save(region)
28+
29+
# created fake data
30+
autofill_data = fill_and_save_address
2731

2832
# Hover over each field and check data preview
2933
fields_to_test = ["name", "organization"]

l10n_CM/Unified/test_demo_ad_2b_preview_address_fields.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from selenium.webdriver import Firefox
33

44
from modules.browser_object_autofill_popup import AutofillPopup
5+
from modules.classes.autofill_base import AutofillAddressBase
56
from modules.page_object_autofill import AddressFill
67
from modules.page_object_prefs import AboutPrefs
78
from modules.util import Utilities
@@ -27,13 +28,16 @@ def test_hover_address_is_previewed(
2728
address_autofill: AddressFill,
2829
autofill_popup: AutofillPopup,
2930
util: Utilities,
31+
fill_and_save_address: AutofillAddressBase,
3032
):
3133
"""
3234
C2888562: Verify that hovering over address fields will preview all fields
3335
"""
34-
# Create fake data and fill it in
36+
# Create fake data
3537
address_autofill.open()
36-
autofill_data = address_autofill.fill_and_save(region)
38+
39+
# created fake data
40+
autofill_data = fill_and_save_address
3741

3842
# Hover over each field and check data preview
3943
fields_to_test = [

0 commit comments

Comments
 (0)