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) <noreply@anthropic.com>
This commit is contained in:
parent
f1963aab7a
commit
796dbea804
1 changed files with 16 additions and 0 deletions
|
|
@ -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");
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue