Skip to content

Commit b071af9

Browse files
committed
Merge main
2 parents 0af4e7a + 7ae738b commit b071af9

File tree

5 files changed

+90
-67
lines changed

5 files changed

+90
-67
lines changed

.github/workflows/check-beta-l10n.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Check new beta version - L10N
2+
3+
on:
4+
schedule:
5+
- cron: "40 */1 * * *"
6+
env:
7+
LATEST: ""
8+
permissions:
9+
contents: "write"
10+
11+
jobs:
12+
Check-Beta-Version:
13+
runs-on: ubuntu-latest
14+
outputs:
15+
win_reportable: ${{ steps.reportable.outputs.win }}
16+
mac_reportable: ${{ steps.reportable.outputs.mac }}
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 }}
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v4
23+
- name: Check if the l10n run is reportable
24+
id: l10n-reportable
25+
env:
26+
TESTRAIL_REPORT: true
27+
FX_L10N: true
28+
TESTRAIL_BASE_URL: ${{ secrets.TESTRAIL_BASE_URL }}
29+
TESTRAIL_API_KEY: ${{ secrets.TESTRAIL_API_KEY }}
30+
TESTRAIL_USERNAME: ${{ secrets.TESTRAIL_USERNAME }}
31+
run: |
32+
pip3 install 'pipenv==2023.11.15';
33+
pipenv install
34+
echo win_l10n=$(pipenv run python -c 'from modules import testrail_integration as tri; print(tri.reportable("Windows"))') >> "$GITHUB_OUTPUT"
35+
echo mac_l10n=$(pipenv run python -c 'from modules import testrail_integration as tri; print(tri.reportable("Darwin"))') >> "$GITHUB_OUTPUT"
36+
echo linux_l10n=$(pipenv run python -c 'from modules import testrail_integration as tri; print(tri.reportable("Linux"))') >> "$GITHUB_OUTPUT"
37+
38+
Run-L10N-Mac-Smoke:
39+
needs: Check-Beta-Version
40+
if: ${{ needs.Check-Beta-Version.outputs.mac_l10n_reportable == 'True' }}
41+
uses: ./.github/workflows/l10n.yml
42+
with:
43+
job_to_run: L10N-MacOS
44+
secrets: inherit
45+
46+
Run-L10N-Win-Smoke:
47+
needs: Check-Beta-Version
48+
if: ${{ needs.Check-Beta-Version.outputs.win_l10n_reportable == 'True' }}
49+
uses: ./.github/workflows/l10n.yml
50+
with:
51+
job_to_run: L10N-Windows
52+
secrets: inherit
53+
54+
Run-L10N-Linux-Smoke:
55+
needs: Check-Beta-Version
56+
if: ${{ needs.Check-Beta-Version.outputs.linux_l10n_reportable == 'True' }}
57+
uses: ./.github/workflows/l10n.yml
58+
with:
59+
job_to_run: L10N-Linux
60+
secrets: inherit

.github/workflows/check-beta.yml

Lines changed: 2 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Check new beta version
1+
name: Check new beta version - Smoke
22

33
on:
44
schedule:
@@ -32,18 +32,6 @@ jobs:
3232
pipenv install
3333
echo win=$(pipenv run python -c 'from modules import testrail_integration as tri; print(tri.reportable("Windows"))') >> "$GITHUB_OUTPUT"
3434
echo mac=$(pipenv run python -c 'from modules import testrail_integration as tri; print(tri.reportable("Darwin"))') >> "$GITHUB_OUTPUT"
35-
- name: Check if the l10n run is reportable
36-
id: l10n-reportable
37-
env:
38-
TESTRAIL_REPORT: true
39-
FX_L10N: true
40-
TESTRAIL_BASE_URL: ${{ secrets.TESTRAIL_BASE_URL }}
41-
TESTRAIL_API_KEY: ${{ secrets.TESTRAIL_API_KEY }}
42-
TESTRAIL_USERNAME: ${{ secrets.TESTRAIL_USERNAME }}
43-
run: |
44-
echo win_l10n=$(pipenv run python -c 'from modules import testrail_integration as tri; print(tri.reportable("Windows"))') >> "$GITHUB_OUTPUT"
45-
echo mac_l10n=$(pipenv run python -c 'from modules import testrail_integration as tri; print(tri.reportable("Darwin"))') >> "$GITHUB_OUTPUT"
46-
echo linux_l10n=$(pipenv run python -c 'from modules import testrail_integration as tri; print(tri.reportable("Linux"))') >> "$GITHUB_OUTPUT"
4735
4836
Run-Win-Smoke:
4937
needs: Check-Beta-Version
@@ -59,28 +47,4 @@ jobs:
5947
uses: ./.github/workflows/smoke.yml
6048
with:
6149
job_to_run: Smoke-MacOS
62-
secrets: inherit
63-
64-
Run-L10N-Mac-Smoke:
65-
needs: Check-Beta-Version
66-
if: ${{ needs.Check-Beta-Version.outputs.mac_l10n_reportable == 'True' }}
67-
uses: ./.github/workflows/l10n.yml
68-
with:
69-
job_to_run: L10N-MacOS
70-
secrets: inherit
71-
72-
Run-L10N-Win-Smoke:
73-
needs: Check-Beta-Version
74-
if: ${{ needs.Check-Beta-Version.outputs.win_l10n_reportable == 'True' }}
75-
uses: ./.github/workflows/l10n.yml
76-
with:
77-
job_to_run: L10N-Windows
78-
secrets: inherit
79-
80-
Run-L10N-Linux-Smoke:
81-
needs: Check-Beta-Version
82-
if: ${{ needs.Check-Beta-Version.outputs.linux_l10n_reportable == 'True' }}
83-
uses: ./.github/workflows/l10n.yml
84-
with:
85-
job_to_run: L10N-Linux
86-
secrets: inherit
50+
secrets: inherit

l10n_CM/run_l10n.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,14 @@ def get_region_tests(test_region: str) -> list[str]:
135135
Returns:
136136
list[str]: A list of test file paths for the given region.
137137
"""
138-
path_to_region = current_dir + "/region/"
139-
with open(path_to_region + test_region + ".json", "r") as fp:
138+
path_to_region = os.path.join(current_dir, "region")
139+
with open(os.path.join(path_to_region, test_region) + ".json", "r") as fp:
140140
region_data = load(fp)
141141
raw_tests = region_data.get("tests", [])
142142
return (
143-
list(map(lambda test: current_dir + "/Unified/" + test, raw_tests))
143+
list(
144+
map(lambda test: os.path.join(current_dir, "Unified", test), raw_tests)
145+
)
144146
if len(raw_tests) > 0
145147
else raw_tests
146148
)

modules/testrail_integration.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -157,27 +157,25 @@ def reportable(platform_to_test=None):
157157
plan_entries = this_plan.get("entries")
158158
if os.environ.get("FX_L10N"):
159159
l10n_mappings = valid_l10n_mappings()
160-
covered_suites = 0
160+
covered_mappings = 0
161+
# keeping this logic to still see how many mappings are reported.
161162
for entry in plan_entries:
162163
if entry.get("name") in l10n_mappings:
163164
site = entry.get("name")
164165
for run_ in entry.get("runs"):
165166
if run_.get("config"):
166167
run_region, run_platform = run_.get("config").split("-")
167-
covered_suites += (
168+
covered_mappings += (
168169
1
169170
if run_region in l10n_mappings[site]
170171
and platform in run_platform
171172
else 0
172173
)
173-
num_suites = 0
174-
for site, regions in l10n_mappings.items():
175-
# each region for win and mac (linux not yet added)
176-
num_suites += len(regions)
177174
logging.warning(
178-
f"Potentially matching run found for {platform}, may be reportable. ({covered_suites} out of {num_suites} site/region mappings already reported.)"
175+
f"Potentially matching run found for {platform}, may be reportable. (Found {covered_mappings} site/region mappings reported.)"
179176
)
180-
return covered_suites < num_suites
177+
# Only report when there is a new beta and no other site/region mappings are reported.
178+
return covered_mappings == 0
181179
else:
182180
covered_suites = 0
183181
for entry in plan_entries:

tests/address_bar_and_search/test_search_suggestions.py

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
from time import sleep
2-
31
import pytest
42
from selenium.webdriver import Firefox
53

@@ -9,9 +7,8 @@
97

108
# Constants
119
SEARCH_TERM_SPONSORED = "iphone"
12-
SEARCH_TERM_NON_SPONSORED = "wikimedia"
10+
SEARCH_TERM_NON_SPONSORED = "wiki"
1311
RETRY_LIMIT = 5
14-
SECONDS = 3
1512

1613

1714
@pytest.fixture()
@@ -45,17 +42,10 @@ def test_search_suggests_enabled(driver: Firefox):
4542
)
4643

4744
# Check for sponsored suggestion
48-
# Trigger the suggests once. First time, it's not populated correctly in automation
49-
with driver.context(driver.CONTEXT_CHROME):
50-
actions.search(SEARCH_TERM_SPONSORED, with_enter=False)
51-
sleep(SECONDS)
52-
53-
# Then load up suggests again and check for sponsored suggestion
5445
found_sponsored = False
5546
retries = 0
5647
while not found_sponsored and retries < RETRY_LIMIT:
5748
actions.search(SEARCH_TERM_SPONSORED, with_enter=False)
58-
sleep(SECONDS) # Give Firefox time to populate suggests list
5949
with driver.context(driver.CONTEXT_CHROME):
6050
found_sponsored = any(
6151
item.get_attribute("aria-label") == "Sponsored"
@@ -67,10 +57,19 @@ def test_search_suggests_enabled(driver: Firefox):
6757
)
6858

6959
# Check for non-sponsored suggestion
70-
actions.search(SEARCH_TERM_NON_SPONSORED, with_enter=False)
71-
sleep(SECONDS) # Give Firefox time to populate suggests list
72-
with driver.context(driver.CONTEXT_CHROME):
73-
nav.get_element("firefox-suggest")
74-
titles = nav.get_elements("suggestion-titles")
75-
found_non_sponsored = any("Wikipedia" in title.text for title in titles)
76-
assert found_non_sponsored, "Non-sponsored suggestion not found"
60+
found_non_sponsored = False
61+
retries = 0
62+
while not found_non_sponsored and retries < RETRY_LIMIT:
63+
actions.search(SEARCH_TERM_NON_SPONSORED, with_enter=False)
64+
with driver.context(driver.CONTEXT_CHROME):
65+
try:
66+
nav.get_element("firefox-suggest")
67+
titles = nav.get_elements("suggestion-titles")
68+
found_non_sponsored = any("Wikipedia" in title.text for title in titles)
69+
break
70+
finally:
71+
retries = +1
72+
continue
73+
assert found_non_sponsored, (
74+
f"Non-sponsored suggestion not found after {RETRY_LIMIT} retries."
75+
)

0 commit comments

Comments
 (0)