diff --git a/tests/e2e/base.js b/tests/e2e/base.js index 77771879..ffd2ef32 100644 --- a/tests/e2e/base.js +++ b/tests/e2e/base.js @@ -26,7 +26,7 @@ export const test = baseTest.extend({ await page.coverage.startCSSCoverage({ resetOnNavigation: false }); } // Fail on any request not explicitly mocked - await page.route("**/*", (route) => { + await page.context().route("**/*", (route) => { const url = route.request().url(); if (url.startsWith("http://localhost")) { return route.continue(); diff --git a/tests/e2e/mockServer.js b/tests/e2e/mockServer.js index 914a1124..47688d98 100644 --- a/tests/e2e/mockServer.js +++ b/tests/e2e/mockServer.js @@ -542,6 +542,22 @@ export class MockServer { }); } + // Stub the external destinations "open in bsky.app" / "translate" links + // point at. These open via window.open, and popups are separate pages that + // page-level routes don't apply to — so the route has to be on the context + // or the popup really loads over the network, and page.waitForEvent("popup") + // (which resolves once the popup's initial navigation commits) can outlast + // the test timeout. + await page + .context() + .route(/^https:\/\/(bsky\.app|translate\.google\.com)\//, (route) => + route.fulfill({ + status: 200, + contentType: "text/html", + body: "", + }), + ); + // Stub gif proxy fetches (gif embeds stream from these CDNs). await page.route( /https:\/\/(t\.gifs\.bsky\.app|.*\.klipy\.com)\/.*/,