Merge pull request #364 from trails-cool/e2e-silent-drop-sentry
Silently drop Sentry envelope requests in e2e fixture
This commit is contained in:
commit
fc2d0a02d5
1 changed files with 16 additions and 0 deletions
|
|
@ -25,6 +25,18 @@ const EXTERNAL_ALLOWLIST: RegExp[] = [
|
||||||
/tiles\.wmflabs\.org/,
|
/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({
|
export const test = base.extend({
|
||||||
page: async ({ page }, use) => {
|
page: async ({ page }, use) => {
|
||||||
const blocked: string[] = [];
|
const blocked: string[] = [];
|
||||||
|
|
@ -39,6 +51,10 @@ export const test = base.extend({
|
||||||
await route.continue();
|
await route.continue();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (SILENT_DROP.some((re) => re.test(url))) {
|
||||||
|
await route.abort("failed");
|
||||||
|
return;
|
||||||
|
}
|
||||||
blocked.push(url);
|
blocked.push(url);
|
||||||
await route.abort("failed");
|
await route.abort("failed");
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue