Skip to content

Commit fcdd60f

Browse files
philimon-resetvsangereanMOZ
authored andcommitted
continued efforts with live site POC
1 parent 40a10a8 commit fcdd60f

File tree

12 files changed

+88
-14
lines changed

12 files changed

+88
-14
lines changed

l10n_CM/Unified/conftest.py

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ def region():
2121
@pytest.fixture()
2222
def site_data():
2323
live_site = os.environ.get("FX_SITE", None)
24-
# live_site = "amazon"
24+
# un comment to test a live site form
25+
# live_site = "walmart/walmart_ad"
2526
if live_site:
2627
path_to_site = parent_dir + "/constants/"
2728
with open(path_to_site + live_site + ".json", "r") as fp:
@@ -45,6 +46,16 @@ def field_mapping(site_data):
4546
return site_data.get("field_mapping", None)
4647

4748

49+
@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 {}
56+
)
57+
58+
4859
@pytest.fixture()
4960
def add_to_prefs_list(region: str):
5061
return []
@@ -64,17 +75,21 @@ def prefs_list(add_to_prefs_list: List[tuple[str, str | bool]], region: str):
6475

6576

6677
@pytest.fixture()
67-
def address_autofill(driver, url_template, fields, field_mapping):
68-
yield AddressFill(
78+
def address_autofill(driver, url_template, fields, field_mapping, submit_button):
79+
af = AddressFill(
6980
driver, url_template=url_template, field_mapping=field_mapping, fields=fields
7081
)
82+
af.elements |= submit_button
83+
yield af
7184

7285

7386
@pytest.fixture()
74-
def credit_card_autofill(driver, url_template, fields, field_mapping):
75-
yield CreditCardFill(
87+
def credit_card_autofill(driver, url_template, fields, field_mapping, submit_button):
88+
cf = CreditCardFill(
7689
driver, url_template=url_template, field_mapping=field_mapping, fields=fields
7790
)
91+
cf.elements |= submit_button
92+
yield cf
7893

7994

8095
@pytest.fixture()

l10n_CM/constants/amazon.json renamed to l10n_CM/constants/amazon/amazon_ad.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"url": "http://127.0.0.1:8000/amazon.html",
3+
"submit_button": "div[class='a-popover a-popover-modal a-declarative'] input[data-testid='bottom-continue-button'][type='{name}']",
34
"field_mapping": {
45
"name": "name",
56
"street_address": "address-ui-widgets-enterAddressLine1",
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"url": "http://127.0.0.1:8000/amazon.html",
3+
"submit_button": "div[class='a-popover a-popover-modal a-declarative'] input[data-testid='bottom-continue-button'][type='{name}']",
4+
"field_mapping": {
5+
"name": "name",
6+
"street_address": "address-ui-widgets-enterAddressLine1",
7+
"address_level_2": "address-ui-widgets-enterAddressLine2",
8+
"address_level_1": "address-ui-widgets-enterAddressCity",
9+
"postal_code": "address-ui-widgets-enterAddressPostalCode",
10+
"telephone": "tel"
11+
},
12+
"fields": [
13+
"name",
14+
"address-ui-widgets-enterAddressLine1",
15+
"address-ui-widgets-enterAddressLine2",
16+
"address-ui-widgets-enterAddressCity",
17+
"address-ui-widgets-enterAddressPostalCode",
18+
"tel"
19+
]
20+
}

l10n_CM/constants/ebay/ebay_ad.json

Whitespace-only changes.

l10n_CM/constants/ebay/ebay_cc.json

Whitespace-only changes.

l10n_CM/constants/homedepot/homedepot_ad.json

Whitespace-only changes.

l10n_CM/constants/homedepot/homedepot_cc.json

Whitespace-only changes.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"url": "http://127.0.0.1:8000/walmart.html",
3+
"field_mapping": {
4+
"name": "given-name",
5+
"street_address": "new-password",
6+
"address_level_2": "address-level2",
7+
"address_level_1": "address-level1",
8+
"postal_code": "postal-code",
9+
"telephone": "tel"
10+
},
11+
"fields": [
12+
"name",
13+
"new-password",
14+
"address-level2",
15+
"address-level1",
16+
"postal-code",
17+
"tel"
18+
]
19+
}

l10n_CM/constants/walmart/walmart_cc.json

Whitespace-only changes.

modules/data/address_fill.components.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
{
22
"do-not-cache": true,
33
"form-field": {
4-
"selectorData": "input[autocomplete='{name}']",
4+
"selectorData": "*[autocomplete='{name}']",
55
"strategy": "css",
66
"groups": []
77
},
88

99
"submit-button": {
10-
"selectorData": "input[type='{name}']",
10+
"selectorData": "*[type='{name}']",
11+
"strategy": "css",
12+
"groups": []
13+
},
14+
"base-submit-button": {
15+
"selectorData": "*[type='submit']",
1116
"strategy": "css",
1217
"groups": []
1318
},

0 commit comments

Comments
 (0)