From c7a6640ebbe443a2a00c424f8dca178c2e61103c Mon Sep 17 00:00:00 2001 From: Matthew Paver Date: Tue, 6 Oct 2026 12:30:00 +0100 Subject: [PATCH] test: ignore optional precedent sidecar console errors in browser check Validate failed on 2026-10-02 because Chromium logs refused (CI) or CORS-blocked (local) fetches to the optional RAG sidecar on :8787 as console errors. The page already falls back offline and requestfailed already ignored the sidecar; apply the same rule to console errors. Co-Authored-By: Claude Opus 5.5 --- Processing/tests/browser_change_assurance.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Processing/tests/browser_change_assurance.py b/Processing/tests/browser_change_assurance.py index 7a8bb3a..dc32cc6 100644 --- a/Processing/tests/browser_change_assurance.py +++ b/Processing/tests/browser_change_assurance.py @@ -7,16 +7,28 @@ ROOT = Path(__file__).resolve().parents[2] BASE_URL = "http://127.0.0.1:8765/change-assurance.html" +# Optional precedent RAG sidecar (`make precedent-rag`); the page falls back offline when it is absent. +SIDECAR_HOSTS = ("127.0.0.1:8787", "localhost:8787") + + +def is_sidecar(text): + return any(host in text for host in SIDECAR_HOSTS) + + +def record_console_error(errors, message): + # Chromium logs refused/CORS-blocked sidecar fetches as console errors; those are expected. + if message.type == "error" and not is_sidecar(message.text) and not is_sidecar(message.location.get("url", "")): + errors.append(message.text) def run_desktop(browser): page = browser.new_page(viewport={"width": 1440, "height": 1000}, device_scale_factor=1) errors = [] failures = [] - page.on("console", lambda message: errors.append(message.text) if message.type == "error" else None) + page.on("console", lambda message: record_console_error(errors, message)) page.on("pageerror", lambda error: errors.append(str(error))) page.on("requestfailed", lambda request: failures.append(f"{request.method} {request.url}") - if "127.0.0.1:8787" not in request.url and "localhost:8787" not in request.url else None) + if not is_sidecar(request.url) else None) page.goto(BASE_URL) page.wait_for_load_state("networkidle")