Skip to content

Commit d04fd96

Browse files
committed
Merge main
2 parents f123df2 + 6caeb92 commit d04fd96

19 files changed

+177
-46
lines changed

.github/workflows/smoke.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ jobs:
115115
$env:FX_EXECUTABLE = "C:\Program Files\Custom Firefox\firefox.exe"
116116
Start-Process -FilePath $env:FX_EXECUTABLE -ArgumentList "--version" -Wait -NoNewWindow
117117
pipenv run python choose_ci_set.py
118-
pipenv run pytest -n 4 $(cat selected_tests)
118+
pipenv run pytest $(cat selected_tests)
119119
$env:TEST_EXIT_CODE = $LASTEXITCODE
120120
mv artifacts artifacts-win || true
121121
exit $env:TEST_EXIT_CODE
@@ -202,7 +202,7 @@ jobs:
202202
run: |
203203
"$FX_EXECUTABLE" --version
204204
pipenv run python choose_ci_set.py
205-
pipenv run pytest --fx-executable="$FX_EXECUTABLE" -n 4 $(cat selected_tests) || TEST_EXIT_CODE=$?
205+
pipenv run pytest --fx-executable="$FX_EXECUTABLE" $(cat selected_tests) || TEST_EXIT_CODE=$?
206206
mv artifacts artifacts-mac || true
207207
exit $TEST_EXIT_CODE
208208
- name: Run Smoke Tests in MacOS (Headed)
@@ -271,7 +271,7 @@ jobs:
271271
"$FX_EXECUTABLE" --version;
272272
pipenv run python choose_ci_set.py;
273273
Xvfb :99 -screen 0 '1600x1200x24' > artifacts/xvfb.log &
274-
DISPLAY=:99 pipenv run pytest --fx-executable="$FX_EXECUTABLE" -n 4 $(cat selected_tests) || TEST_EXIT_CODE=$?
274+
DISPLAY=:99 pipenv run pytest --fx-executable="$FX_EXECUTABLE" $(cat selected_tests) || TEST_EXIT_CODE=$?
275275
exit $TEST_EXIT_CODE
276276
- name: Run Smoke Tests in Ubuntu (Headed)
277277
if: steps.setup.conclusion == 'success' && always()

choose_l10n_ci_set.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,18 @@ def process_changed_file(f, selected_mappings):
5353
selected_mappings: the selected mappings dictionary (updated in place).
5454
"""
5555
split = f.split(SLASH)
56-
if f.startswith("l10n_CM/sites/") or f.startswith("l10n_CM/constants/"):
56+
57+
if f.startswith(os.path.join("l10n_CM", "sites")) or f.startswith(
58+
os.path.join("l10n_CM", "constants")
59+
):
5760
# if constants or sites are changed, add a single site/region mapping entry.
5861
site = split[2]
5962
region = split[3]
6063
region_path = os.path.join("l10n_CM", "region", f"{region}.json")
6164
# make sure the region mapping file exists before adding the mapping
6265
if os.path.exists(region_path):
6366
selected_mappings[site].add(region)
64-
elif f.startswith("l10n_CM/region/"):
67+
elif f.startswith(os.path.join("l10n_CM", "region")):
6568
# if a region file is changed, add the region to each site mapping.
6669
region = split[-1].split(".")[0]
6770
with open(f, "r+") as f:
@@ -128,24 +131,22 @@ def process_changed_file(f, selected_mappings):
128131
)
129132
main_conftest = "conftest.py"
130133
base_page = os.path.join("modules", "page_base.py")
131-
134+
selected_mappings = defaultdict(set)
132135
if main_conftest in committed_files or base_page in committed_files:
133136
# Run sample tests for all mappings if main conftest or basepage changed
134-
add_selected_mappings(sample_mappings)
135-
sys.exit(0)
137+
selected_mappings |= sample_mappings
136138

137139
# Run sample tests for all mappings if any core l10n model, component, conftest, or tests are changed.
138-
selected_mappings = defaultdict(set)
139140
for f in committed_files:
140-
for re_val in re_set_all:
141-
if re_val.match(f):
142-
add_selected_mappings(sample_mappings)
143-
sys.exit(0)
144141
# check if constants, sites or region directory files were changed or added.
145142
# if so, add the site/region mappings.
146143
for re_val in re_set_select:
147144
if re_val.match(f):
148145
process_changed_file(f, selected_mappings)
146+
for re_val in re_set_all:
147+
if re_val.match(f):
148+
selected_mappings |= sample_mappings
149+
break
149150

150151
add_selected_mappings(selected_mappings)
151152
sys.exit(0)

ci_l10n_pyproject_headed.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ markers = [
1515
"noxvfb: tests that should not run in xvfb sessions"
1616
]
1717

18-
addopts = "-vs --ci --json-report --json-report-file artifacts/report_headed.json -n auto --reruns 4 --reruns-delay 3 --html=artifacts/report_headed.html"
18+
addopts = "-vs --ci --json-report --json-report-file artifacts/report_headed.json -n auto --reruns 5 --reruns-delay 3 --html=artifacts/report_headed.html"
1919

2020
[tool.ruff]
2121
target-version = "py310"

l10n_CM/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ The harness relies on several configuration files:
6868
# list of OS platforms to skip for this configuration run.
6969
# "Darwin", "Linux" or "Windows"
7070
"skip_os": []
71+
# regions to skip the tests for
72+
"skip_region": []
7173
}
7274
7375
```

l10n_CM/Unified/conftest.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ def prefs_list(add_to_prefs_list: List[tuple[str, str | bool]], region: str):
6161
prefs = [
6262
("extensions.formautofill.creditCards.reauth.optout", False),
6363
("extensions.formautofill.reauth.enabled", False),
64+
("extensions.formautofill.addresses.supportedCountries", region),
6465
("browser.aboutConfig.showWarning", False),
6566
("browser.search.region", region),
6667
]
@@ -103,9 +104,11 @@ def cc_site_data(live_site, region):
103104

104105

105106
@pytest.fixture
106-
def is_live_site(live_site):
107-
"""Determine if the site is live."""
108-
return live_site != "demo"
107+
def is_live_site(live_site, region):
108+
"""Determine if the site is live.
109+
Treat demo IT as a live site until the doorhanger bug is fixed.
110+
"""
111+
return live_site != "demo" or region in {"IT"}
109112

110113

111114
@pytest.fixture(scope="session")

l10n_CM/Unified/test_demo_ad_0_add_new_address.py

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,30 @@ def test_verify_new_address_is_added(
3636

3737
# address autofill data
3838
address_autofill_data = populate_saved_addresses
39+
address_values = {str(val) for val in address_autofill_data.__dict__.values()}
3940
about_prefs_privacy.open_and_switch_to_saved_addresses_popup()
4041

4142
# verify that the address saved is the same.
42-
# The address saved in step 2 is listed in the "Saved addresses" modal: name and organization
4343
elements = about_prefs_privacy.get_element("saved-addresses-values").text.split(",")
44-
address_match = all(
45-
data_sanitizer(util, element, region, inverted_state_province_abbr)
46-
in address_autofill_data.__dict__.values()
47-
for element in elements
48-
)
49-
assert address_match, "Address found is not equal to address created!"
44+
total_address_match = True
45+
for element in elements:
46+
sanitized_element = data_sanitizer(
47+
util, element, region, inverted_state_province_abbr
48+
)
49+
# temporary fix until Italian province mappings are added.
50+
if (
51+
len(sanitized_element) == 2
52+
and sanitized_element != region
53+
and region not in ["US", "CA"]
54+
):
55+
continue
56+
address_match = False
57+
for val in address_values:
58+
if sanitized_element in val:
59+
address_match = True
60+
break
61+
total_address_match = total_address_match and address_match
62+
assert total_address_match, "Address found is not equal to address created!"
5063

5164

5265
def data_sanitizer(util: Utilities, value: str, region: str, state_province: Dict):
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"url": "http://127.0.0.1:8080/ebay_ad.html",
3+
"field_mapping": {
4+
"country": "country",
5+
"given_name": "firstName",
6+
"family_name": "lastName",
7+
"telephone": "phoneNumber",
8+
"street_address": "addressLine1",
9+
"address_level_1": "stateOrProvince",
10+
"email": "email",
11+
"address_level_2": "city",
12+
"postal_code": "postalCode"
13+
},
14+
"form_field": "*[id='{name}']",
15+
"fields": [
16+
"country",
17+
"firstName",
18+
"lastName",
19+
"phoneNumber",
20+
"addressLine1",
21+
"stateOrProvince",
22+
"email",
23+
"city",
24+
"postalCode"
25+
],
26+
"skip_os": ["Linux"]
27+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"url": "http://127.0.0.1:8080/ebay_cc.html",
3+
"field_mapping": {
4+
"card_number": "733a34b7-dee2-4117-8c2f-071b524132cc",
5+
"given_name": "4f011f17-0752-4f0d-816f-e6b3c4576aaa",
6+
"family_name": "ec81a5b7-c1a3-4f87-b139-514ceddbf070",
7+
"expiration_date": "71861c8c-6842-40f3-8de5-0cca4cbbbd04",
8+
"cvv":"87f69f19-0c97-4fe3-b0e9-67a9a0a8902f"
9+
},
10+
"form_field": "*[data-moz-autofill-inspect-id='{name}']",
11+
"fields": [
12+
"733a34b7-dee2-4117-8c2f-071b524132cc",
13+
"4f011f17-0752-4f0d-816f-e6b3c4576aaa",
14+
"ec81a5b7-c1a3-4f87-b139-514ceddbf070",
15+
"71861c8c-6842-40f3-8de5-0cca4cbbbd04",
16+
"87f69f19-0c97-4fe3-b0e9-67a9a0a8902f"
17+
]
18+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"url": "http://127.0.0.1:8080/ebay_ad.html",
3+
"field_mapping": {
4+
"country": "139f9745-aa36-410f-8f74-b034d2e68cc9",
5+
"given_name": "eeb50a23-2faf-40cf-939f-9f6a96d57a1e",
6+
"family_name": "4b5f7dbd-ef96-4362-a6d6-799f1514e24e",
7+
"street_address": "1accdedb-5ac4-403f-848c-07dbae40086a",
8+
"telephone": "62d794bf-b73a-4065-b494-8abb6388b3ce",
9+
"email": "35fe569e-aa96-4f38-8b16-a2b3859ba154",
10+
"address_level_1": "9d7ea453-7e6a-4f94-b35c-671d5ac7c134",
11+
"postal_code": "b82b85a9-f315-4d04-8f5d-daa0285a2676"
12+
},
13+
"skip": "True",
14+
"form_field": "*[data-moz-autofill-inspect-id='{name}']",
15+
"fields": [
16+
"139f9745-aa36-410f-8f74-b034d2e68cc9",
17+
"eeb50a23-2faf-40cf-939f-9f6a96d57a1e",
18+
"62d794bf-b73a-4065-b494-8abb6388b3ce",
19+
"4b5f7dbd-ef96-4362-a6d6-799f1514e24e",
20+
"1accdedb-5ac4-403f-848c-07dbae40086a",
21+
"35fe569e-aa96-4f38-8b16-a2b3859ba154",
22+
"9d7ea453-7e6a-4f94-b35c-671d5ac7c134",
23+
"b82b85a9-f315-4d04-8f5d-daa0285a2676"
24+
]
25+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"url": "http://127.0.0.1:8080/ebay_cc.html",
3+
"field_mapping": {
4+
"card_number": "8099b7a0-ce11-494b-9f24-0d284c42c246",
5+
"given_name": "8f3f684a-9c92-4d16-8c99-ceffcb7c07dd",
6+
"family_name": "880fff76-4961-4a90-ae12-e2193204d006",
7+
"expiration_date": "c5a40569-5110-44e8-a95c-53c1bf142e05",
8+
"cvv":"0fa5b961-e429-46e9-a68b-3e0e7cacddfd"
9+
},
10+
"form_field": "*[data-moz-autofill-inspect-id='{name}']",
11+
"fields": [
12+
"8099b7a0-ce11-494b-9f24-0d284c42c246",
13+
"8f3f684a-9c92-4d16-8c99-ceffcb7c07dd",
14+
"880fff76-4961-4a90-ae12-e2193204d006",
15+
"c5a40569-5110-44e8-a95c-53c1bf142e05",
16+
"0fa5b961-e429-46e9-a68b-3e0e7cacddfd"
17+
]
18+
}

0 commit comments

Comments
 (0)