diff --git a/web/e2e/smoke.spec.js b/web/e2e/smoke.spec.js index 412f461..d70f44a 100644 --- a/web/e2e/smoke.spec.js +++ b/web/e2e/smoke.spec.js @@ -320,7 +320,12 @@ test('manifestet og service workeren findes, og ikonerne findes også', async ({ * back to the app rather than to a dead tab. The retry in api.js covers the write * side of the same drop; this covers the read side. */ -test('appen overlever et netværksudfald og åbner fra cachen', async ({ page, context }) => { +test.describe('med service worker', () => { + // The rest of the suite blocks the worker (see playwright.config.js); this one + // test is about the worker, so it turns it back on for its own context. + test.use({ serviceWorkers: 'allow' }); + + test('appen overlever et netværksudfald og åbner fra cachen', async ({ page, context }) => { // First load, online: the worker installs, and once it controls the page the // shell and the reads it serves are in the cache. await page.goto('/'); @@ -351,6 +356,7 @@ test('appen overlever et netværksudfald og åbner fra cachen', async ({ page, c // Never leave the shared context offline for whatever test runs next. await context.setOffline(false); } + }); }); /** diff --git a/web/playwright.config.js b/web/playwright.config.js index 810aa7e..2994396 100644 --- a/web/playwright.config.js +++ b/web/playwright.config.js @@ -51,6 +51,12 @@ export default defineConfig({ use: { baseURL, + // Off by default. The app now ships a caching service worker, and once it + // controls a page Playwright's page.route() no longer sees the fetches it + // makes — so a test that forces a 500 to check the error path gets the real + // 200 through the worker instead, and reads as a broken feature. The one test + // that needs the real worker turns it back on for its own context. + serviceWorkers: 'block', trace: 'retain-on-failure', screenshot: 'only-on-failure', // Pinned, because the app reads both. The sign-up form sends