From 422a901104d7979730c730eaadc2fa98f6282c0d Mon Sep 17 00:00:00 2001 From: feder-cr <85809106+feder-cr@users.noreply.github.com> Date: Fri, 24 Jul 2026 12:58:24 +0200 Subject: [PATCH] tests: derive the expected Firefox version from the constant, not a literal The release e2e tests asserted the binary reported 'Firefox 150' / 'Firefox/150' and went red the moment firefox-18 (FF151) landed - the binary correctly reports 151.0. Same class as test_constants, but these live in the e2e workflow (not the unit run, which stayed green), so they slipped through. Now derived from FIREFOX_UPSTREAM_VERSION so they track whatever the wrapper actually ships. --- tests/test_release_e2e.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/tests/test_release_e2e.py b/tests/test_release_e2e.py index 28a54b2..516a98a 100644 --- a/tests/test_release_e2e.py +++ b/tests/test_release_e2e.py @@ -54,6 +54,12 @@ from pathlib import Path import pytest +# Version the shipped binary reports, derived from the same constant the wrapper +# uses so these assertions can never drift from what actually ships (they were +# hardcoded to "150" and went red the moment firefox-18 / FF151 landed). +from invisible_playwright.constants import FIREFOX_UPSTREAM_VERSION + +_FX_MAJOR = FIREFOX_UPSTREAM_VERSION.split(".")[0] REPO_URL = "https://github.com/feder-cr/invisible_playwright.git" REV = os.environ.get("INVPW_E2E_REV", "main") @@ -214,9 +220,9 @@ def test_binary_executes_after_fetch(clean_venv: Path, isolated_cache_env: dict) r = subprocess.run([str(binary_path), "--version"], capture_output=True, text=True, timeout=30) text = (r.stdout + r.stderr).lower() - assert "firefox" in text and "150." in text, ( - f"binary --version didn't report Firefox 150: rc={r.returncode} " - f"out={r.stdout!r} err={r.stderr!r}" + assert "firefox" in text and FIREFOX_UPSTREAM_VERSION in text, ( + f"binary --version didn't report Firefox {FIREFOX_UPSTREAM_VERSION}: " + f"rc={r.returncode} out={r.stdout!r} err={r.stderr!r}" ) @@ -246,8 +252,8 @@ def test_playwright_launch_against_real_site(clean_venv: Path, assert "TITLE=Example Domain" in out.stdout, ( f"page.title() didn't return expected text:\n{out.stdout[-1000:]}" ) - assert "UA=" in out.stdout and "Firefox/150" in out.stdout, ( - "navigator.userAgent doesn't report Firefox/150 — UA spoofing " + assert "UA=" in out.stdout and f"Firefox/{_FX_MAJOR}" in out.stdout, ( + f"navigator.userAgent doesn't report Firefox/{_FX_MAJOR} - UA spoofing " f"regression?\n{out.stdout[-1000:]}" )