Skip to content

Commit 4f1d7ad

Browse files
Merge branch 'main' into Hani/cm-newbalance-de
2 parents 3523c34 + d48c29f commit 4f1d7ad

File tree

19 files changed

+232
-6845
lines changed

19 files changed

+232
-6845
lines changed

.github/workflows/check-beta.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ jobs:
1414
outputs:
1515
win_reportable: ${{ steps.reportable.outputs.win }}
1616
mac_reportable: ${{ steps.reportable.outputs.mac }}
17-
mac_l10n_reportable: ${{ steps.reportable.outputs.mac_l10n }}
18-
win_l10n_reportable: ${{ steps.reportable.outputs.win_l10n }}
19-
linux_l10n_reportable: ${{ steps.reportable.outputs.linux_l10n }}
17+
mac_l10n_reportable: ${{ steps.l10n-reportable.outputs.mac_l10n }}
18+
win_l10n_reportable: ${{ steps.l10n-reportable.outputs.win_l10n }}
19+
linux_l10n_reportable: ${{ steps.l10n-reportable.outputs.linux_l10n }}
2020
steps:
2121
- name: Checkout repository
2222
uses: actions/checkout@v4
@@ -83,4 +83,4 @@ jobs:
8383
uses: ./.github/workflows/l10n.yml
8484
with:
8585
job_to_run: L10N-Linux
86-
secrets: inherit
86+
secrets: inherit

.github/workflows/l10n.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ name: L10N Test Execution
33

44
run-name: ${{ github.actor }} is running l10n tests
55
on:
6-
pull_request:
76
workflow_call:
87
inputs:
98
channel:

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 3 --reruns-delay 2 --html=artifacts/report_headed.html"
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"
1919

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

l10n_CM/Unified/test_demo_ad_0_add_new_address.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def test_verify_new_address_is_added(
5252
def data_sanitizer(util: Utilities, value: str, region: str, state_province: Dict):
5353
value = value.strip()
5454
if value[0] == "+":
55-
return util.normalize_phone_number(value)
55+
return util.normalize_regional_phone_numbers(value, region)
5656
elif len(value) == 2 and value != region:
5757
return state_province.get(value, value)
5858
return value
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:8080/ebay_ad.html",
3+
"field_mapping": {
4+
"country": "e9e70c93-e9d2-409b-b095-e77314197c7c",
5+
"given_name": "24d06c38-32ee-4355-8a51-f24a7670b6b2",
6+
"family_name": "9470868e-3a3e-47fb-b532-25f921d01c8b",
7+
"address_level_1": "56c8b6d4-3cd4-4109-bc1a-d464c51f30c0",
8+
"postal_code": "995c03c6-b354-4dc5-a891-fb3acefd11ff",
9+
"address_level_2": "701b8a55-61a8-4bfc-8c47-bc218ae1b6e1"
10+
},
11+
"form_field": "*[data-moz-autofill-inspect-id='{name}']",
12+
"fields": [
13+
"e9e70c93-e9d2-409b-b095-e77314197c7c",
14+
"24d06c38-32ee-4355-8a51-f24a7670b6b2",
15+
"9470868e-3a3e-47fb-b532-25f921d01c8b",
16+
"56c8b6d4-3cd4-4109-bc1a-d464c51f30c0",
17+
"995c03c6-b354-4dc5-a891-fb3acefd11ff",
18+
"701b8a55-61a8-4bfc-8c47-bc218ae1b6e1"
19+
]
20+
}
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": "be35322a-704d-4a43-ab5b-f5d072c34780",
5+
"given_name": "488f1f61-d1b3-4eaa-b7ec-fa4d58c570a2",
6+
"family_name": "b5422113-5346-404e-b4bd-046df6eb7390",
7+
"expiration_date": "06947c0b-6182-434f-8cf2-4c809211968e",
8+
"cvv":"e917ae39-68b2-40e3-8feb-259857c57884"
9+
},
10+
"form_field": "*[data-moz-autofill-inspect-id='{name}']",
11+
"fields": [
12+
"be35322a-704d-4a43-ab5b-f5d072c34780",
13+
"488f1f61-d1b3-4eaa-b7ec-fa4d58c570a2",
14+
"b5422113-5346-404e-b4bd-046df6eb7390",
15+
"06947c0b-6182-434f-8cf2-4c809211968e",
16+
"e917ae39-68b2-40e3-8feb-259857c57884"
17+
]
18+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"url": "http://127.0.0.1:8080/ebay_ad.html",
3+
"field_mapping": {
4+
"country": "d0b2c700-1d21-431c-9b63-15ce879bd1d4",
5+
"given_name": "02e8af39-63ef-4161-ba2a-037f1fc0d126",
6+
"family_name": "3bbcb88c-0eb3-44f3-97f8-6d53e1b6b3b0",
7+
"telephone": "d861a0fd-5093-4a9a-acf3-865630377e05",
8+
"address_level_1": "1fa78165-45eb-483a-850f-ede7d77fb276",
9+
"email": "81c4f8fa-69ba-435a-824e-d33170457fb2",
10+
"address_level_2": "96269fbd-c77b-4bcd-bf56-978d2c1196eb",
11+
"postal_code": "48149049-83a7-43b0-ad00-936a7b764257"
12+
},
13+
"form_field": "*[data-moz-autofill-inspect-id='{name}']",
14+
"fields": [
15+
"d0b2c700-1d21-431c-9b63-15ce879bd1d4",
16+
"02e8af39-63ef-4161-ba2a-037f1fc0d126",
17+
"3bbcb88c-0eb3-44f3-97f8-6d53e1b6b3b0",
18+
"d861a0fd-5093-4a9a-acf3-865630377e05",
19+
"1fa78165-45eb-483a-850f-ede7d77fb276",
20+
"81c4f8fa-69ba-435a-824e-d33170457fb2",
21+
"96269fbd-c77b-4bcd-bf56-978d2c1196eb",
22+
"48149049-83a7-43b0-ad00-936a7b764257"
23+
]
24+
}
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": "074f3242-21d4-4356-9309-f6c1a2d724e0",
5+
"given_name": "00467d92-b775-4596-966f-2bf3d1267c0c",
6+
"family_name": "fb594e12-3e59-4175-862f-cd403d982672",
7+
"expiration_date": "218d3d69-83f5-46e4-8adc-8251d12b9aa2",
8+
"cvv":"59c55fa4-c6fa-4212-896b-b7183182c092"
9+
},
10+
"form_field": "*[data-moz-autofill-inspect-id='{name}']",
11+
"fields": [
12+
"074f3242-21d4-4356-9309-f6c1a2d724e0",
13+
"00467d92-b775-4596-966f-2bf3d1267c0c",
14+
"fb594e12-3e59-4175-862f-cd403d982672",
15+
"218d3d69-83f5-46e4-8adc-8251d12b9aa2",
16+
"59c55fa4-c6fa-4212-896b-b7183182c092"
17+
]
18+
}

l10n_CM/region/US.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"lowes",
77
"etsy",
88
"calvinklein",
9+
"bestbuy",
910
"demo"
1011
],
1112
"tests": []

l10n_CM/run_l10n.py

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,19 @@
1313
valid_flags = {"--run-headless", "-n", "--reruns", "--fx-executable", "--ci"}
1414
flag_with_parameter = {"-n", "--reruns"}
1515
valid_region = {"US", "CA", "DE", "FR"}
16-
valid_sites = {"demo", "amazon", "walmart", "mediamarkt", "lowes", "etsy", "calvinklein", "bestbuy", "newbalance"}
16+
valid_sites = {
17+
"demo",
18+
"amazon",
19+
"walmart",
20+
"mediamarkt",
21+
"lowes",
22+
"etsy",
23+
"calvinklein",
24+
"bestbuy",
25+
"newbalance",
26+
"ebay",
27+
28+
}
1729
live_sites = []
1830

1931
LOCALHOST = "127.0.0.1"
@@ -80,6 +92,7 @@ def run_tests(reg, site, flg, all_tests):
8092
flg (list[str]): The list of pytest flags to be used.
8193
all_tests (list[str]): The list of test file paths to execute.
8294
"""
95+
all_tests = remove_skipped_tests(all_tests, site, reg)
8396
try:
8497
if len(all_tests) > 0:
8598
logging.info(f"Tests for {reg} region on {site} page.")
@@ -119,6 +132,59 @@ def get_region_tests(test_region: str) -> list[str]:
119132
)
120133

121134

135+
def remove_skipped_tests(extracted_tests, live_site, reg):
136+
"""
137+
Reads the mapping for the given region and site and removes any tests that are marked as skipped.
138+
139+
Args:
140+
extracted_tests (list[str]): The list of test file paths to execute.
141+
live_site (str): Page being tested.
142+
reg (str): The test region identifier.
143+
Returns:
144+
list[str]: A list of test file paths for the given region.
145+
"""
146+
mid_path = f"/{reg}/" if live_site != "demo" else "/"
147+
live_sites = [
148+
(f"{live_site}{mid_path}{live_site}_{suffix}", f"_{suffix}_")
149+
for suffix in ("ad", "cc")
150+
]
151+
for live_site, suffix in live_sites:
152+
skipped_tests = get_skipped_tests(live_site)
153+
if skipped_tests and skipped_tests != "All":
154+
skipped_tests = list(
155+
map(
156+
lambda test: os.path.join(current_dir, "Unified", test),
157+
skipped_tests,
158+
)
159+
)
160+
161+
def should_keep_test(test):
162+
return (
163+
suffix not in test
164+
if skipped_tests == "All"
165+
else test not in skipped_tests
166+
)
167+
168+
extracted_tests = list(filter(should_keep_test, extracted_tests))
169+
return extracted_tests
170+
171+
172+
def get_skipped_tests(live_site) -> list[str] | str:
173+
"""
174+
Read the mapping for the given region and site and return any tests that are marked as skipped.
175+
176+
Arg:
177+
live_site (str): The site is being tested.
178+
Returns:
179+
list[str] | str: A list of tests that should be skipped, or "All" if all tests should be skipped.
180+
"""
181+
with open(current_dir + "/constants/" + live_site + ".json", "r") as fp:
182+
live_site_data = load(fp)
183+
if live_site_data.get("skip"):
184+
return "All"
185+
return live_site_data.get("skipped", [])
186+
187+
122188
def get_flags_and_sanitize(flags_arguments: list[str]) -> list[str]:
123189
"""
124190
Extract and validate pytest flags from command-line arguments.

0 commit comments

Comments
 (0)