Skip to content

Commit a7cd47f

Browse files
committed
Merge branch 'main' into anca/cm-ca-staples
2 parents 73f653c + f6c020b commit a7cd47f

File tree

109 files changed

+1794
-538
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+1794
-538
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
---
2+
name: L10N output mapping splits
3+
4+
run-name: ${{ github.actor }} is writing L10N mapping splits
5+
on:
6+
schedule:
7+
- cron: "0 0 * * 1"
8+
9+
permissions:
10+
contents: "write"
11+
12+
jobs:
13+
Select-Channels:
14+
runs-on: ubuntu-latest
15+
outputs:
16+
channels: ${{ steps.splits.outputs.channels }}
17+
steps:
18+
- name: Create app token
19+
uses: actions/create-github-app-token@v1
20+
id: app-token
21+
with:
22+
app-id: ${{ secrets.BOT_CLIENT_ID }}
23+
private-key: ${{ secrets.BOT_PRIVATE_KEY }}
24+
- name: Checkout repository
25+
uses: actions/checkout@v4
26+
with:
27+
token: ${{ steps.app-token.outputs.token }}
28+
- name: Select test channels
29+
id: splits
30+
run: |
31+
python3 choose_l10n_beta_split.py

.github/workflows/l10n.yml

Lines changed: 0 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -92,25 +92,6 @@ jobs:
9292
exit $EXIT_CODE;
9393
fi
9494
exit $SCRIPT_EXIT_CODE;
95-
- name: Run L10N Tests in MacOS (Headed)
96-
if: steps.setup.conclusion == 'success' && always()
97-
env:
98-
FX_EXECUTABLE: /Volumes/${{ steps.setup.outputs.app_name }}/${{ steps.setup.outputs.app_name }}.app/Contents/MacOS/firefox
99-
REPORTABLE: ${{ env.TESTRAIL_REPORT == 'true' }}
100-
run: |
101-
mv ./ci_l10n_pyproject_headed.toml ./pyproject.toml;
102-
echo "0" > TEST_EXIT_CODE;
103-
while IFS= read -r line; do
104-
echo "Running tests for: $line";
105-
pipenv run python -m l10n_CM.run_l10n --fx-executable="$FX_EXECUTABLE" $line || SCRIPT_EXIT_CODE=$?;
106-
done < selected_l10n_mappings;
107-
ls artifacts-mac/* &>/dev/null || echo "No mappings to report" >> artifacts-mac/placeholder.txt
108-
mv -n artifacts/* artifacts-mac/ || true;
109-
EXIT_CODE=$(cat TEST_EXIT_CODE);
110-
if [ $EXIT_CODE != 0 ]; then
111-
exit $EXIT_CODE;
112-
fi
113-
exit $SCRIPT_EXIT_CODE;
11495
- name: Upload artifacts
11596
if: ${{ always() && github.event_name == 'pull_request' }}
11697
uses: actions/upload-artifact@v4
@@ -167,25 +148,6 @@ jobs:
167148
exit $EXIT_CODE;
168149
fi
169150
exit $SCRIPT_EXIT_CODE;
170-
- name: Run Smoke Tests in Ubuntu (Headed)
171-
if: steps.setup.conclusion == 'success' && always()
172-
env:
173-
REPORTABLE: ${{ env.TESTRAIL_REPORT == 'true' }}
174-
FX_EXECUTABLE: ./firefox/firefox
175-
run: |
176-
mv ./ci_l10n_pyproject_headed.toml ./pyproject.toml;
177-
echo "0" > TEST_EXIT_CODE;
178-
while IFS= read -r line; do
179-
echo "Running tests for: $line";
180-
DISPLAY=:99 pipenv run python -m l10n_CM.run_l10n --fx-executable="$FX_EXECUTABLE" $line || SCRIPT_EXIT_CODE=$?;
181-
done < selected_l10n_mappings;
182-
ls artifacts-linux/* &>/dev/null || echo "No mappings to report" >> artifacts-linux/placeholder.txt
183-
mv -n artifacts/* artifacts-linux/ || true;
184-
EXIT_CODE=$(cat TEST_EXIT_CODE);
185-
if [ $EXIT_CODE != 0 ]; then
186-
exit $EXIT_CODE;
187-
fi
188-
exit $SCRIPT_EXIT_CODE;
189151
- name: Upload artifacts
190152
if: ${{ always() && inputs.is_pull_request == true }}
191153
uses: actions/upload-artifact@v4
@@ -277,47 +239,6 @@ jobs:
277239
exit [int]$EXIT_CODE
278240
}
279241
exit $env:SCRIPT_EXIT_CODE
280-
- name: Run L10N Tests in Win (Headed)
281-
if: steps.setup.conclusion == 'success' && always()
282-
env:
283-
REPORTABLE: ${{ env.TESTRAIL_REPORT == 'true' }}
284-
run: |
285-
rm ./pyproject.toml;
286-
mv ./ci_l10n_pyproject_headed.toml ./pyproject.toml;
287-
$env:FX_EXECUTABLE = 'C:\Program Files\Custom Firefox\firefox.exe'
288-
Write-Host "FX_EXECUTABLE: $FX_EXECUTABLE"
289-
pipenv run python choose_l10n_ci_set.py
290-
"0" | Set-Content -Path "TEST_EXIT_CODE"
291-
$SCRIPT_EXIT_CODE = 0
292-
Get-Content "selected_l10n_mappings" | ForEach-Object {
293-
$line = $_
294-
Write-Host "Running tests for: $line"
295-
try {
296-
pipenv run python -m l10n_CM.run_l10n --fx-executable="$env:FX_EXECUTABLE" $line
297-
} catch {
298-
$SCRIPT_EXIT_CODE = $_.Exception.HResult
299-
}
300-
}
301-
rm artifacts/assets -r -Force -ErrorAction SilentlyContinue
302-
Get-ChildItem -Path "artifacts" -ErrorAction SilentlyContinue | ForEach-Object {
303-
$destPath = "artifacts-win\" + $_.Name
304-
if (-not (Test-Path -Path $destPath)) {
305-
try {
306-
Move-Item -Path $_.FullName -Destination $destPath
307-
} catch {
308-
# Ignore errors and continue
309-
}
310-
}
311-
}
312-
mkdir artifacts-win -Force
313-
if (-not (Test-Path -Path "artifacts-win\*")) {
314-
New-Item -Path "artifacts-win\placeholder.txt" -ItemType File -Value "no mappings to report."
315-
}
316-
$EXIT_CODE = Get-Content -Path "TEST_EXIT_CODE"
317-
if ($EXIT_CODE -ne 0) {
318-
exit [int]$EXIT_CODE
319-
}
320-
exit $env:SCRIPT_EXIT_CODE
321242
- name: Upload artifacts
322243
if: ${{ always() && inputs.is_pull_request == true }}
323244
uses: actions/upload-artifact@v4

Pipfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pypom = "2.2.4"
1616
taskcluster-taskgraph = "==9.0.0"
1717
jsonpath-ng = "1.6.1"
1818
pillow = "<10.5"
19-
pyfxa = "0.7.0"
19+
pyfxa = "0.8.1"
2020
ruff = "0.9.6"
2121
pytest-rerunfailures = "14.0"
2222
slack-sdk = "3.31.0"

SELECTOR_INFO.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2042,6 +2042,34 @@ Location: In the FxA signin page flow
20422042
Path to .json: modules/data/fxa_home.components.json
20432043
```
20442044
```
2045+
Selector Name: do-it-later-button
2046+
Selector Data: "inline_recovery_key_setup_create_do_it_later"
2047+
Description: Coninute fxa account creation flow
2048+
Location: In the FxA signin page flow
2049+
Path to .json: modules/data/fxa_home.components.json
2050+
```
2051+
```
2052+
Selector Name: login-password-input
2053+
Selector Data: "choice-pair-not-now"
2054+
Description: Dont pair with phone now
2055+
Location: In the FxA signin page flow
2056+
Path to .json: modules/data/fxa_home.components.json
2057+
```
2058+
```
2059+
Selector Name: signed-in-status
2060+
Selector Data: "div[role='status']"
2061+
Description: Sign in status
2062+
Location: In the FxA signin page flow
2063+
Path to .json: modules/data/fxa_home.components.json
2064+
```
2065+
```
2066+
Selector Name: manage-sync-button
2067+
Selector Data: "signup_confirmed_sync_manage_sync_button"
2068+
Description: sign up and sync confirmation
2069+
Location: In the FxA signin page flow
2070+
Path to .json: modules/data/fxa_home.components.json
2071+
```
2072+
```
20452073
Selector Name: signin-otp-input
20462074
Selector Data: "[data-testid='signin-token-code-input-field']"
20472075
Description: The FxAccount One Time Password entry field
@@ -2994,7 +3022,7 @@ Path to .json: modules/data/navigation.components.json
29943022
```
29953023
```
29963024
Selector Name: searchmode-switcher-settings
2997-
Selector Data: searchmode-switcher-popup-search-settings-button
3025+
Selector Data: menuitem[data-l10n-id='urlbar-searchmode-popup-search-settings-menuitem']
29983026
Description: Search settings button in the searchmode switcher dropdown
29993027
Location: Address bar
30003028
Path to .json: modules/data/navigation.components.json

choose_l10n_beta_split.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import json
2+
import logging
3+
import sys
4+
from collections import defaultdict
5+
6+
from choose_l10n_ci_set import valid_l10n_mappings
7+
8+
9+
def distribute_mappings_evenly(mappings):
10+
"""
11+
Distribute the selected mappings into 3 splits and return the container.
12+
13+
Args:
14+
mappings (dict): A dictionary of mappings, where the keys are sites and the values are sets of regions.
15+
"""
16+
if not mappings:
17+
return {}
18+
# sort the mappings by the length of the regions per site
19+
mappings = dict(sorted(mappings.items(), key=lambda val: len(val[1]), reverse=True))
20+
# place the mappings into 3 containers evenly according to the load
21+
loads = [0, 0, 0]
22+
balanced_splits = [defaultdict(list) for _ in range(3)]
23+
for site, regions in mappings.items():
24+
min_idx = loads.index(min(loads))
25+
balanced_splits[min_idx][site] = list(regions)
26+
loads[min_idx] += len(regions)
27+
return balanced_splits
28+
29+
30+
if __name__ == "__main__":
31+
l10n_mappings = valid_l10n_mappings()
32+
all_splits = distribute_mappings_evenly(l10n_mappings)
33+
if not all_splits:
34+
logging.warning("No valid l10n mappings")
35+
sys.exit(1)
36+
for idx, split in enumerate(all_splits, start=1):
37+
with open(f"l10n_CM/beta_run_splits/l10n_split_{idx}.json", "w") as f:
38+
json.dump(split, f)

choose_l10n_ci_set.py

Lines changed: 20 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -34,35 +34,6 @@ def valid_l10n_mappings():
3434
return mapping
3535

3636

37-
def distribute_mappings_evenly(mappings, version):
38-
"""
39-
Distribute the selected mappings if its a reportable run.
40-
41-
Args:
42-
mappings (dict): A dictionary of mappings, where the keys are sites and the values are sets of regions.
43-
version (int): The beta_version of the beta.
44-
"""
45-
if not mappings:
46-
return {}
47-
if os.environ.get("TESTRAIL_REPORT"):
48-
# sort the mappings by the length of the regions per site
49-
mappings = dict(
50-
sorted(mappings.items(), key=lambda val: len(val[1]), reverse=True)
51-
)
52-
# place the mappings into 3 containers evenly according to the load
53-
loads = [0, 0, 0]
54-
containers = [defaultdict(set) for _ in range(3)]
55-
for key, value in mappings.items():
56-
min_idx = loads.index(min(loads))
57-
containers[min_idx][key] = value
58-
loads[min_idx] += len(value)
59-
# get container index according to beta beta_version
60-
run_idx = version % 3
61-
return containers[run_idx]
62-
else:
63-
return mappings
64-
65-
6637
def process_changed_file(f, selected_mappings):
6738
"""
6839
process the changed file to add the site/region mappings.
@@ -108,6 +79,22 @@ def save_mappings(selected_container):
10879
f.writelines(current_running_mappings)
10980

11081

82+
def select_l10n_mappings(beta_version):
83+
"""
84+
Select the correct l10n mappings.
85+
86+
Args:
87+
beta_version: the current beta version.
88+
"""
89+
beta_split = (beta_version % 3) + 1
90+
if os.path.exists(f"l10n_CM/beta_run_splits/l10n_split_{beta_split}.json"):
91+
with open(f"l10n_CM/beta_run_splits/l10n_split_{beta_split}.json", "r") as f:
92+
current_split_mappings = {k: set(v) for k, v in json.load(f).items()}
93+
return current_split_mappings
94+
else:
95+
return valid_l10n_mappings()
96+
97+
11198
if __name__ == "__main__":
11299
if os.path.exists(".env"):
113100
with open(".env") as fh:
@@ -134,11 +121,12 @@ def save_mappings(selected_container):
134121
except ValueError:
135122
# failsafe beta_version
136123
beta_version = 0
137-
l10n_mappings = valid_l10n_mappings()
124+
# choose split number
125+
l10n_mappings = select_l10n_mappings(beta_version)
138126
sample_mappings = {k: v for k, v in l10n_mappings.items() if k.startswith("demo")}
139127
if os.environ.get("TESTRAIL_REPORT") or os.environ.get("MANUAL"):
140128
# Run all tests if this is a scheduled beta or a manual run
141-
save_mappings(distribute_mappings_evenly(l10n_mappings, beta_version))
129+
save_mappings(l10n_mappings)
142130
sys.exit(0)
143131

144132
re_set_all = [
@@ -199,5 +187,5 @@ def save_mappings(selected_container):
199187
selected_mappings |= sample_mappings
200188
break
201189

202-
save_mappings(distribute_mappings_evenly(selected_mappings, beta_version))
190+
save_mappings(selected_mappings)
203191
sys.exit(0)

ci_l10n_pyproject_headed.toml

Lines changed: 0 additions & 21 deletions
This file was deleted.

l10n_CM/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ The harness relies on several configuration files:
3131
]
3232
}
3333
```
34+
**NOTE**: If both the address and credit card tests are skipped for the site, do not add it to the region files.
35+
3436
- **Site Test Configuration**: Located in `constants/{site_name}.json` or `constants/{site_name}/{region}.json`, defining site-specific test configurations and skipped tests. Here we map the attributes for either `AutofillAddressBase` or `CreditCardBase` to the corresponding selectors.
3537

3638
```aiignore

l10n_CM/Unified/conftest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,9 @@ def cc_site_data(live_site, region):
106106
@pytest.fixture
107107
def is_live_site(live_site, region):
108108
"""Determine if the site is live.
109-
Treat demo IT and ES as a live site until the doorhanger bug is fixed.
109+
Treat demo IT, ES and BE as a live site until the doorhanger bug is fixed.
110110
"""
111-
return live_site != "demo" or region in {"IT", "ES"}
111+
return live_site != "demo" or region in {"IT", "ES", "BE"}
112112

113113

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

l10n_CM/Unified/test_demo_ad_4a_highlight_name_org_fields.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def test_address_yellow_highlight_on_name_organization_fields(
3838
autofill_popup.ensure_autofill_dropdown_visible()
3939

4040
# Click on the first element from the autocomplete dropdown
41-
autofill_popup.select_nth_element(1)
41+
autofill_popup.select_autofill_panel()
4242

4343
field_to_test = ["given_name", "family_name", "name", "organization"]
4444
# Verify the name and organization fields are highlighted

0 commit comments

Comments
 (0)