Merge pull request #364 from trails-cool/e2e-silent-drop-sentry

Silently drop Sentry envelope requests in e2e fixture
This commit is contained in:
Ullrich Schäfer 2026-05-08 00:59:18 +02:00 committed by GitHub
commit fc2d0a02d5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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");
});