Skip to content

Commit d11561c

Browse files
Merge branch 'main' into vs/Canadatire
2 parents 386dde9 + 4a506bc commit d11561c

File tree

5 files changed

+28
-17
lines changed

5 files changed

+28
-17
lines changed

.github/workflows/l10n.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ jobs:
8888
pipenv run python check_l10n_test_cases.py;
8989
while IFS= read -r line; do
9090
echo "Running tests for: $line";
91-
pipenv run python l10n_CM/run_l10n.py --fx-executable="$FX_EXECUTABLE" $line || SCRIPT_EXIT_CODE=$?;
91+
pipenv run python -m l10n_CM.run_l10n --fx-executable="$FX_EXECUTABLE" $line || SCRIPT_EXIT_CODE=$?;
9292
done < selected_l10n_mappings;
9393
mv artifacts artifacts-mac || true;
9494
EXIT_CODE=$(cat TEST_EXIT_CODE);
@@ -106,7 +106,7 @@ jobs:
106106
echo "0" > TEST_EXIT_CODE;
107107
while IFS= read -r line; do
108108
echo "Running tests for: $line";
109-
pipenv run python l10n_CM/run_l10n.py --fx-executable="$FX_EXECUTABLE" $line || SCRIPT_EXIT_CODE=$?;
109+
pipenv run python -m l10n_CM.run_l10n --fx-executable="$FX_EXECUTABLE" $line || SCRIPT_EXIT_CODE=$?;
110110
done < selected_l10n_mappings;
111111
mv -n artifacts/* artifacts-mac/ || true;
112112
EXIT_CODE=$(cat TEST_EXIT_CODE);
@@ -170,7 +170,7 @@ jobs:
170170
Xvfb :99 -screen 0 '1600x1200x24' > artifacts/xvfb.log &
171171
while IFS= read -r line; do
172172
echo "Running tests for: $line";
173-
DISPLAY=:99 pipenv run python l10n_CM/run_l10n.py --fx-executable="$FX_EXECUTABLE" $line || SCRIPT_EXIT_CODE=$?;
173+
DISPLAY=:99 pipenv run python -m l10n_CM.run_l10n --fx-executable="$FX_EXECUTABLE" $line || SCRIPT_EXIT_CODE=$?;
174174
done < selected_l10n_mappings;
175175
mv artifacts artifacts-linux || true;
176176
EXIT_CODE=$(cat TEST_EXIT_CODE);
@@ -188,7 +188,7 @@ jobs:
188188
echo "0" > TEST_EXIT_CODE;
189189
while IFS= read -r line; do
190190
echo "Running tests for: $line";
191-
DISPLAY=:99 pipenv run python l10n_CM/run_l10n.py --fx-executable="$FX_EXECUTABLE" $line || SCRIPT_EXIT_CODE=$?;
191+
DISPLAY=:99 pipenv run python -m l10n_CM.run_l10n --fx-executable="$FX_EXECUTABLE" $line || SCRIPT_EXIT_CODE=$?;
192192
done < selected_l10n_mappings;
193193
mv -n artifacts/* artifacts-linux/ || true;
194194
EXIT_CODE=$(cat TEST_EXIT_CODE);
@@ -284,7 +284,7 @@ jobs:
284284
$line = $_
285285
Write-Host "Running tests for: $line"
286286
try {
287-
pipenv run python l10n_CM/run_l10n.py --fx-executable="$env:FX_EXECUTABLE" $line
287+
pipenv run python -m l10n_CM.run_l10n --fx-executable="$env:FX_EXECUTABLE" $line
288288
} catch {
289289
$SCRIPT_EXIT_CODE = $_.Exception.HResult
290290
}
@@ -311,7 +311,7 @@ jobs:
311311
$line = $_
312312
Write-Host "Running tests for: $line"
313313
try {
314-
pipenv run python l10n_CM/run_l10n.py --fx-executable="$env:FX_EXECUTABLE" $line
314+
pipenv run python -m l10n_CM.run_l10n --fx-executable="$env:FX_EXECUTABLE" $line
315315
} catch {
316316
$SCRIPT_EXIT_CODE = $_.Exception.HResult
317317
}

l10n_CM/README.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ The harness relies on several configuration files:
7171
## Usage
7272

7373
```bash
74-
python run_l10n.py [FLAGS] [REGIONS] [SITES]
74+
python -m l10n_CM.run_l10n [FLAGS] [REGIONS] [SITES]
7575
```
7676

7777
### Parameters
@@ -92,22 +92,22 @@ python run_l10n.py [FLAGS] [REGIONS] [SITES]
9292

9393
```bash
9494
# Run tests for all regions and sites
95-
python run_l10n.py
95+
python -m l10n_CM.run_l10n
9696

9797
# Run all tests for US region only across all available sites
98-
python run_l10n.py US
98+
python -m l10n_CM.run_l10n US
9999

100100
# Run all tests for amazon site only across all regions
101-
python run_l10n.py US
101+
python -m l10n_CM.run_l10n US
102102

103103
# Run tests for US region on amazon site
104-
python run_l10n.py US amazon
104+
python -m l10n_CM.run_l10n US amazon
105105

106106
# Run tests for US and CA regions with 4 parallel workers
107-
python run_l10n.py -n 4 US CA
107+
python -m l10n_CM.run_l10n -n 4 US CA
108108

109109
# Run tests for US region on amazon site in headless mode
110-
python run_l10n.py --run-headless US amazon
110+
python -m l10n_CM.run_l10n --run-headless US amazon
111111
```
112112

113113
## Architecture
@@ -137,6 +137,7 @@ The framework sets the following environment variables during test execution:
137137
- `CM_SITE`: The site being tested
138138
- `FX_REGION`: The region being tested
139139
- `TEST_EXIT_CODE`: Exit code of the test execution
140+
- `FX_L10N`: Flag to check whether l10n workflow is being run.
140141

141142
## Adding New Tests
142143

@@ -153,6 +154,10 @@ The framework sets the following environment variables during test execution:
153154
5. Create the necessary mapping files in `constants/{site_name}/{region}/`
154155
* The naming convention for both the mapping files and the HTML files are `{site}_ad` for Address Pages and `{site}_cc` for Credit Card Pages.
155156

157+
## Useful Documents
158+
- [Sites/Regions to Automate](https://docs.google.com/spreadsheets/d/15_ejIC3YABnMGHafgkLeuuu_wakfpiLapOmUdBF2pVI/edit?usp=sharing)
159+
- [Skipped Automation Test Combinations](https://docs.google.com/document/d/18zYICZ3lbtUK7-LC-2Gt8jRbxQp0w0Is0ytM2BrcD7w/edit?usp=sharing)
160+
156161
## Troubleshooting
157162

158163
- **Invalid Arguments**: Ensure all region codes, site names, and flags are valid

l10n_CM/region/CA.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"demo",
77
"etsy",
88
"newbalance",
9-
"ebay",
10-
"canadatire"
9+
"canadatire",
10+
"ebay"
1111
],
1212
"tests": [
1313
]

l10n_CM/region/DE.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"region": "DE",
33
"sites": [
4-
54
"amazon",
65
"mediamarkt",
76
"demo"

l10n_CM/run_l10n.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99

1010
import requests
1111

12+
from check_l10n_test_cases import valid_l10n_mappings
13+
1214
current_dir = os.path.dirname(__file__)
1315
valid_flags = {"--run-headless", "-n", "--reruns", "--fx-executable", "--ci"}
1416
flag_with_parameter = {"-n", "--reruns"}
@@ -32,8 +34,13 @@
3234
"aldoshoes",
3335
"canadatire"
3436
}
37+
38+
loaded_valid_sites = valid_l10n_mappings().keys()
39+
valid_sites = valid_sites.union(set(loaded_valid_sites))
40+
3541
live_sites = []
3642

43+
3744
LOCALHOST = "127.0.0.1"
3845
PORT = 8080
3946
os.environ["TEST_EXIT_CODE"] = "0"
@@ -111,7 +118,7 @@ def run_tests(reg, site, flg, all_tests):
111118
logging.warning(f"Test run failed with exit code: {e.returncode}")
112119
# true failure instead of run not being reportable.
113120
if e.returncode != 2:
114-
if os.environ.get("TEST_EXIT_CODE") == "0":
121+
if os.environ.get("FX_L10N") and os.environ.get("TEST_EXIT_CODE") == "0":
115122
with open("TEST_EXIT_CODE", "w") as f:
116123
f.write(str(e.returncode))
117124
os.environ["TEST_EXIT_CODE"] = str(e.returncode)

0 commit comments

Comments
 (0)