Skip to content

Commit b931cc0

Browse files
Merge branch 'main' into philimon/l10n_flow_optimize
2 parents 6edcf30 + 72b1839 commit b931cc0

File tree

11 files changed

+61
-30
lines changed

11 files changed

+61
-30
lines changed

.github/workflows/l10n.yml

Lines changed: 8 additions & 10 deletions
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:
@@ -38,7 +37,7 @@ env:
3837

3938
jobs:
4039
L10N-MacOS:
41-
if: ${{ inputs.job_to_run == 'L10N-MacOS' || github.event_name == 'pull_request' || inputs.mac_installer_link }}
40+
if: ${{ inputs.job_to_run == 'L10N-MacOS' || inputs.mac_installer_link }}
4241
runs-on: macos-latest
4342
steps:
4443
- name: Create app token
@@ -86,7 +85,7 @@ jobs:
8685
run: |
8786
"$FX_EXECUTABLE" --version;
8887
echo "0" > TEST_EXIT_CODE;
89-
pipenv run python choose_l10n_ci_set.py;
88+
pipenv run python check_l10n_test_cases.py;
9089
while IFS= read -r line; do
9190
echo "Running tests for: $line";
9291
pipenv run python -m l10n_CM.run_l10n --fx-executable="$FX_EXECUTABLE" $line || SCRIPT_EXIT_CODE=$?;
@@ -122,7 +121,7 @@ jobs:
122121
name: artifacts-mac
123122
path: artifacts-mac
124123
L10N-Linux:
125-
if: ${{ inputs.job_to_run == 'L10N-Linux' || github.event_name == 'pull_request' || inputs.linux_tarball_link }}
124+
if: ${{ inputs.job_to_run == 'L10N-Linux' || inputs.linux_tarball_link }}
126125
runs-on: ubuntu-latest
127126
steps:
128127
- name: Create app token
@@ -167,7 +166,7 @@ jobs:
167166
run: |
168167
"$FX_EXECUTABLE" --version;
169168
echo "0" > TEST_EXIT_CODE;
170-
pipenv run python choose_l10n_ci_set.py;
169+
pipenv run python check_l10n_test_cases.py;
171170
Xvfb :99 -screen 0 '1600x1200x24' > artifacts/xvfb.log &
172171
while IFS= read -r line; do
173172
echo "Running tests for: $line";
@@ -204,7 +203,7 @@ jobs:
204203
name: artifacts-linux
205204
path: artifacts-linux
206205
L10N-Windows:
207-
if: ${{ inputs.job_to_run == 'L10N-Windows' || github.event_name == 'pull_request' || inputs.win_installer_link }}
206+
if: ${{ inputs.job_to_run == 'L10N-Windows' || inputs.win_installer_link }}
208207
runs-on: windows-latest
209208
steps:
210209
- name: Create app token
@@ -278,7 +277,7 @@ jobs:
278277
pipenv run python -c "import sys; print(sys.platform)"
279278
$env:FX_EXECUTABLE = 'C:\Program Files\Custom Firefox\firefox.exe'
280279
Start-Process -FilePath $env:FX_EXECUTABLE -ArgumentList "--version" -Wait -NoNewWindow
281-
pipenv run python choose_l10n_ci_set.py
280+
pipenv run python check_l10n_test_cases.py
282281
"0" | Set-Content -Path "TEST_EXIT_CODE"
283282
$SCRIPT_EXIT_CODE = 0
284283
Get-Content "selected_l10n_mappings" | ForEach-Object {
@@ -305,7 +304,7 @@ jobs:
305304
mv ./ci_l10n_pyproject_headed.toml ./pyproject.toml;
306305
$env:FX_EXECUTABLE = 'C:\Program Files\Custom Firefox\firefox.exe'
307306
Write-Host "FX_EXECUTABLE: $FX_EXECUTABLE"
308-
pipenv run python choose_l10n_ci_set.py
307+
pipenv run python check_l10n_test_cases.py
309308
"0" | Set-Content -Path "TEST_EXIT_CODE"
310309
$SCRIPT_EXIT_CODE = 0
311310
Get-Content "selected_l10n_mappings" | ForEach-Object {
@@ -317,8 +316,7 @@ jobs:
317316
$SCRIPT_EXIT_CODE = $_.Exception.HResult
318317
}
319318
}
320-
mkdir artifacts -Force
321-
rm artifacts/assets -r -Force -ErrorAction SilentlyContinue
319+
rm artifacts/assets -r -Force
322320
Get-ChildItem -Path "artifacts" | ForEach-Object {
323321
$destPath = "artifacts-win\" + $_.Name
324322
if (-not (Test-Path -Path $destPath)) {

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,9 +192,6 @@ drivers/
192192
temp.py
193193
tests/test_scratch.py
194194

195-
# L10N files
196-
selected_l10n_mappings
197-
198195
# Credentials
199196
credentials.json
200197
testrail_credentials.env

check_l10n_test_cases.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import json
2+
import os
3+
import sys
4+
from collections import defaultdict
5+
6+
OUTPUT_FILE = "selected_l10n_mappings"
7+
8+
9+
def valid_l10n_mappings():
10+
mapping = defaultdict(set)
11+
region_paths = [d for d in os.listdir("./l10n_CM/region/")]
12+
for region_path in region_paths:
13+
if region_path != "Unified.json":
14+
region = region_path.split(".")[0]
15+
with open(f"./l10n_CM/region/{region_path}", "r+") as f:
16+
region_file = json.load(f)
17+
if region_file.get("sites"):
18+
for site in region_file.get("sites"):
19+
mapping[site].add(region)
20+
return mapping
21+
22+
23+
if __name__ == "__main__":
24+
l10n_mappings = valid_l10n_mappings()
25+
with open(OUTPUT_FILE, "w") as file:
26+
pass # File is created or cleared
27+
for site, regions in l10n_mappings.items():
28+
with open(OUTPUT_FILE, "a+") as fh:
29+
fh.write(f"{site} {' '.join(regions)}\n")
30+
sys.exit(0)

l10n_CM/constants/bestbuy/US/bestbuy_ad.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212

1313
},
1414
"form_field": "*[data-moz-autofill-inspect-id='{name}']",
15-
"skip": "True",
1615
"fields": [
1716
"24fa9bb9-032c-4aa5-a829-8f3c8950cba3",
1817
"ca35b256-a76c-476b-bc50-5e651c0a20fe",
@@ -22,5 +21,14 @@
2221
"1f396341-9cfb-400a-9946-80ac1a721c09",
2322
"afe0ae5c-f224-46f2-9331-aa9b3053dcc8",
2423
"b9c75b09-1531-479e-8823-45d212333bd2"
25-
]
24+
],
25+
"skipped": [
26+
"test_demo_ad_1c_dropdown_phone_email_fields.py",
27+
"test_demo_ad_2c_preview_phone_email_fields.py",
28+
"test_demo_ad_3a_autofill_address_fields.py",
29+
"test_demo_ad_3b_autofill_name_org_fields.py",
30+
"test_demo_ad_3c_autofill_phone_email_fields.py",
31+
"test_demo_ad_4c_highlight_phone_email_fields.py",
32+
"test_demo_ad_5c_clear_phone_email_fields.py"
33+
]
2634
}

l10n_CM/constants/calvinklein/CA/calvinklein_ad.json

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
"telephone": "57aab032-b31d-4bf9-8b7a-3fc5f265f6fc"
1212
},
1313
"form_field": "*[data-moz-autofill-inspect-id='{given_name}']",
14-
"skip": "True",
1514
"fields": [
1615
"7d7a6c7c-7084-477e-afda-b27c826032a8",
1716
"179a5ec2-4a98-45e9-9806-abb5496700d0",
@@ -21,5 +20,14 @@
2120
"a2d9e97a-4dab-44cf-960f-f5bbc1db447a",
2221
"e4ebe951-0ed1-4ea9-b2c2-518b7b2ec034",
2322
"57aab032-b31d-4bf9-8b7a-3fc5f265f6fc"
24-
]
23+
],
24+
"skipped": [
25+
"test_demo_ad_1c_dropdown_phone_email_fields.py",
26+
"test_demo_ad_2c_preview_phone_email_fields.py",
27+
"test_demo_ad_3a_autofill_address_fields.py",
28+
"test_demo_ad_3b_autofill_name_org_fields.py",
29+
"test_demo_ad_3c_autofill_phone_email_fields.py",
30+
"test_demo_ad_4c_highlight_phone_email_fields.py",
31+
"test_demo_ad_5c_clear_phone_email_fields.py"
32+
]
2533
}

l10n_CM/constants/cdiscount/FR/cdiscount_cc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"card_number": "03b45e0e-3ee5-4588-bb52-11c51280b1a1",
55
"expiration_date": "1f545e96-cf5e-4bdd-8f70-8d307f9de357",
66
"cvv": "963fd1a5-05f5-4464-adba-71c1529dc983",
7-
"cardholder_name": "e9f9c0b6-2960-47f0-91ca-74b18b3f1056"
7+
"name": "e9f9c0b6-2960-47f0-91ca-74b18b3f1056"
88
},
99
"form_field": "*[data-moz-autofill-inspect-id='{name}']",
1010
"fields": [

l10n_CM/region/DE.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
"sites": [
44
"amazon",
55
"mediamarkt",
6-
"newbalance",
7-
"ebay",
8-
"zalando",
96
"demo"
107
],
118
"tests": [

l10n_CM/region/FR.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
"region": "FR",
33
"sites": [
44
"amazon",
5-
"cdiscount",
6-
"decathlon",
7-
"ebay",
8-
"vans",
95
"demo"
106
],
117
"tests": [

l10n_CM/run_l10n.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
import requests
1111

12-
from choose_l10n_ci_set import valid_l10n_mappings
12+
from check_l10n_test_cases import valid_l10n_mappings
1313

1414
current_dir = os.path.dirname(__file__)
1515
valid_flags = {"--run-headless", "-n", "--reruns", "--fx-executable", "--ci"}

modules/testrail_integration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import subprocess
55
import sys
66

7-
from choose_l10n_ci_set import valid_l10n_mappings
7+
from check_l10n_test_cases import valid_l10n_mappings
88
from modules import taskcluster as tc
99
from modules import testrail as tr
1010
from modules.testrail import TestRail

0 commit comments

Comments
 (0)