From 796dbea8041233f6ef0e4d7e9a6a694cf95f7ceb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ullrich=20Sch=C3=A4fer?= Date: Fri, 8 May 2026 00:53:41 +0200 Subject: [PATCH] Silently drop Sentry envelope requests in e2e fixture Two e2e tests intermittently failed with "unmocked external request" when the Sentry browser SDK emitted an envelope to the real ingest endpoint despite `enabled: false`. The BrowserTracing integration captures the page-load transaction before init's enabled flag fully propagates, so a single envelope leaks on cold start. Add a SILENT_DROP list that aborts matching requests without recording them as blocked, so legitimate missing-mock failures still surface. Co-Authored-By: Claude Opus 4.7 (1M context) --- e2e/fixtures/test.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/e2e/fixtures/test.ts b/e2e/fixtures/test.ts index 379d559..8f27f1b 100644 --- a/e2e/fixtures/test.ts +++ b/e2e/fixtures/test.ts @@ -25,6 +25,18 @@ const EXTERNAL_ALLOWLIST: RegExp[] = [ /tiles\.wmflabs\.org/, ]; +/** + * External requests we silently drop (no allowlist, no failure). The + * Sentry browser SDK emits an envelope on first navigation even when + * `enabled: false` (the BrowserTracing integration captures the page + * load transaction before `init`'s enabled flag fully propagates). We + * don't want to allow it through to the real ingest endpoint, but we + * also don't want every test to fail with "blocked unmocked request". + */ +const SILENT_DROP: RegExp[] = [ + /ingest\.[a-z]+\.sentry\.io/, +]; + export const test = base.extend({ page: async ({ page }, use) => { const blocked: string[] = []; @@ -39,6 +51,10 @@ export const test = base.extend({ await route.continue(); return; } + if (SILENT_DROP.some((re) => re.test(url))) { + await route.abort("failed"); + return; + } blocked.push(url); await route.abort("failed"); });