Skip to content

Commit 239b0de

Browse files
authored
Attempt to fix the "ghost runs" issue in scheduled beta (#473)
* bomb out if there is no config; don't count empty runs for reportable * update ruff version
1 parent 6e0242a commit 239b0de

32 files changed

+153
-140
lines changed

Pipfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ taskcluster-taskgraph = "==9.0.0"
1717
jsonpath-ng = "1.6.1"
1818
pillow = "<10.5"
1919
pyfxa = "0.7.0"
20-
ruff = "0.5.2"
20+
ruff = "0.9.6"
2121
pytest-rerunfailures = "14.0"
2222
slack-sdk = "3.31.0"
2323
google-cloud-storage = "2.18.0"

collect_executables.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,23 +111,23 @@ def get_gd_platform():
111111
minor = int(minor)
112112
beta = int(beta)
113113

114-
next_major = f"{major+1}.0b1"
114+
next_major = f"{major + 1}.0b1"
115115
fx_download_dir_url = f"https://archive.mozilla.org/pub/firefox/candidates/{next_major}-candidates/build1/"
116116
rs = requests.get(fx_download_dir_url)
117117
if rs.status_code < 300:
118118
latest_beta_ver = next_major
119119
this_beta = next_major
120120
continue
121121

122-
next_minor = f"{major}.{minor+1}b1"
122+
next_minor = f"{major}.{minor + 1}b1"
123123
fx_download_dir_url = f"https://archive.mozilla.org/pub/firefox/candidates/{next_minor}-candidates/build1/"
124124
rs = requests.get(fx_download_dir_url)
125125
if rs.status_code < 300:
126126
latest_beta_ver = next_minor
127127
this_beta = next_minor
128128
continue
129129

130-
next_beta = f"{major}.{minor}b{beta+1}"
130+
next_beta = f"{major}.{minor}b{beta + 1}"
131131
fx_download_dir_url = f"https://archive.mozilla.org/pub/firefox/candidates/{next_beta}-candidates/build1/"
132132
rs = requests.get(fx_download_dir_url)
133133
if rs.status_code < 300:

l10n_CM/Unified/test_demo_ad_address_data_captured_in_doorhanger_and_stored.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,6 @@ def test_demo_ad_address_data_captured_in_doorhanger_and_stored(
8989
found_address_data = any(
9090
all(value in element.text for value in expected_values) for element in elements
9191
)
92-
assert found_address_data, "Street, city, state (if applicable), zip, or country were not found in any of the address entries!"
92+
assert found_address_data, (
93+
"Street, city, state (if applicable), zip, or country were not found in any of the address entries!"
94+
)

l10n_CM/Unified/test_demo_ad_email_phone_captured_in_doorhanger_and_stored.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,17 @@
44
from modules.browser_object_autofill_popup import AutofillPopup
55
from modules.page_object_autofill import AddressFill
66
from modules.page_object_prefs import AboutPrefs
7-
from modules.util import Utilities, BrowserActions
7+
from modules.util import BrowserActions, Utilities
88

99

1010
@pytest.fixture()
1111
def test_case():
1212
return "2886581"
1313

1414

15-
def test_demo_ad_email_phone_captured_in_doorhanger_and_stored(driver: Firefox, region: str
16-
):
15+
def test_demo_ad_email_phone_captured_in_doorhanger_and_stored(
16+
driver: Firefox, region: str
17+
):
1718
"""
1819
C2888704 - Verify tele/email data are captured in the Capture Doorhanger and stored in about:preferences
1920
"""
@@ -38,7 +39,9 @@ def test_demo_ad_email_phone_captured_in_doorhanger_and_stored(driver: Firefox,
3839
# containing phone field
3940
expected_phone = address_autofill_data.telephone
4041
with driver.context(driver.CONTEXT_CHROME):
41-
actual_phone = address_autofill_popup.get_element("address-doorhanger-phone").text
42+
actual_phone = address_autofill_popup.get_element(
43+
"address-doorhanger-phone"
44+
).text
4245
normalize_expected = util.normalize_phone_number(expected_phone)
4346
normalized_actual = util.normalize_phone_number(actual_phone)
4447
assert normalized_actual == normalize_expected
@@ -55,9 +58,8 @@ def test_demo_ad_email_phone_captured_in_doorhanger_and_stored(driver: Firefox,
5558
elements = about_prefs.get_elements("saved-addresses-values")
5659
expected_values = [expected_phone, expected_email]
5760
found_email_phone = any(
58-
all(value in element.text for value in expected_values)
59-
for element in elements
61+
all(value in element.text for value in expected_values) for element in elements
62+
)
63+
assert found_email_phone, (
64+
"Email or phone were not found in any of the address entries!"
6065
)
61-
assert (
62-
found_email_phone
63-
), "Email or phone were not found in any of the address entries!"

l10n_CM/Unified/test_demo_ad_name_org_captured_in_doorhanger_and_stored.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,6 @@ def test_demo_ad_name_org_captured_in_doorhanger_and_stored(
5959
found_name_org = any(
6060
all(value in element.text for value in expected_values) for element in elements
6161
)
62-
assert (
63-
found_name_org
64-
), "Name or organization were not found in any of the address entries!"
62+
assert found_name_org, (
63+
"Name or organization were not found in any of the address entries!"
64+
)

modules/browser_object_tracker_panel.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,9 @@ def verify_tracker_shield_indicator(self, nav: Navigation) -> BasePage:
145145
assert (
146146
shield_icon.get_attribute("data-l10n-id")
147147
== "tracking-protection-icon-active-container"
148-
), "The label detected did not correspond to the expected one: tracking-protection-icon-active-container"
148+
), (
149+
"The label detected did not correspond to the expected one: tracking-protection-icon-active-container"
150+
)
149151
return self
150152

151153
def open_and_return_cross_site_trackers(self) -> List[WebElement]:

modules/page_base.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -437,9 +437,9 @@ def verify_opened_image_url(self, url_substr: str, pattern: str) -> Page:
437437
self.url_contains(url_substr)
438438
current_url = self.driver.current_url
439439

440-
assert re.match(
441-
pattern, current_url
442-
), f"URL does not match the expected pattern: {current_url}"
440+
assert re.match(pattern, current_url), (
441+
f"URL does not match the expected pattern: {current_url}"
442+
)
443443
return self
444444

445445
def fill(
@@ -490,9 +490,9 @@ def fetch(self, reference: Union[str, tuple, WebElement], labels=[]) -> WebEleme
490490
return self.find_element(*reference)
491491
elif isinstance(reference, WebElement):
492492
return reference
493-
assert (
494-
False
495-
), "Bad fetch: only selectors, selector names, or WebElements allowed."
493+
assert False, (
494+
"Bad fetch: only selectors, selector names, or WebElements allowed."
495+
)
496496

497497
def click_on(self, reference: Union[str, tuple, WebElement], labels=[]) -> Page:
498498
"""Click on an element, no matter the context, return the page"""

modules/testrail.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,9 @@ def matching_configs(self, testrail_project_id, config_group_id, config_name):
351351
matching_group = next(c for c in configs if c.get("id") == config_group_id)
352352
logging.info(f"matching group|| {matching_group}")
353353
cfgs = [
354-
c for c in matching_group.get("configs") if config_name in c.get("name")
354+
c
355+
for c in matching_group.get("configs")
356+
if config_name == c.get("name").strip()
355357
]
356358
return cfgs
357359

modules/testrail_integration.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def reportable():
124124
covered_suites = 0
125125
for entry in plan_entries:
126126
for run_ in entry.get("runs"):
127-
if platform in run_.get("config"):
127+
if run_.get("config") and platform in run_.get("config"):
128128
covered_suites += 1
129129

130130
num_suites = 0
@@ -378,6 +378,10 @@ def collect_changes(testrail_session: TestRail, report):
378378
release = ".".join(release.split(".")[:-1])
379379
config = f"{os_name} {release} {arch}"
380380

381+
logging.warning(f"Reporting for config: {config}")
382+
if not config.strip():
383+
raise ValueError("Config cannot be blank.")
384+
381385
with open(".tmp_testrail_info", "w") as fh:
382386
fh.write(f"{plan_title}|{config}")
383387

@@ -421,8 +425,7 @@ def collect_changes(testrail_session: TestRail, report):
421425
logging.info("Creating config...")
422426
testrail_session.add_config(CONFIG_GROUP_ID, config)
423427
tried = True
424-
if len(config_matches) >= 1:
425-
# TODO: change above to == 1
428+
if len(config_matches) == 1:
426429
config_id = config_matches[0].get("id")
427430
logging.info(f"config id: {config_id}")
428431
else:

tests/address_bar_and_search/test_adaptive_history_autofill.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ def test_add_adaptive_history_autofill(driver: Firefox):
6161
)
6262

6363
# Assertion to verify that the 'autofill_adaptive' type is found
64-
assert (
65-
autofill_adaptive_element.get_attribute("type") == "autofill_adaptive"
66-
), f"Expected element type to be 'autofill_adaptive' but found '{autofill_adaptive_element.get_attribute('type')}'"
64+
assert autofill_adaptive_element.get_attribute("type") == "autofill_adaptive", (
65+
f"Expected element type to be 'autofill_adaptive' but found '{autofill_adaptive_element.get_attribute('type')}'"
66+
)
6767

6868
# Assertion to check the autofilled URL is the expected one
69-
assert (
70-
"nationalgeographic.com/science" in autofill_adaptive_element.text
71-
), "URL 'https://www.nationalgeographic.com/science' not found in autofill suggestions."
69+
assert "nationalgeographic.com/science" in autofill_adaptive_element.text, (
70+
"URL 'https://www.nationalgeographic.com/science' not found in autofill suggestions."
71+
)

0 commit comments

Comments
 (0)