🧱 ci: Block the PWA Service Worker Across the Mock E2E Profiles (#18063)

* 🧱 ci: Block the PWA Service Worker Across the Mock E2E Profiles

Every mock test opens a fresh browser context, so the app's service worker
installs and claims the page during each test's first load. A `page.route`
installed within a few milliseconds of that claim is never consulted: the
request it should hold goes to the server, and a test waiting on the route
times out. 113 mock spec files install routes and seven blocked the worker
themselves.

Set `serviceWorkers: 'block'` in the mock profile's shared `use`, which every
profile derived from it inherits. No spec asserts worker behavior; one that
does can opt back in with `test.use({ serviceWorkers: 'allow' })`.

* 🧪 test: Keep the Sandpack Preview Worker in the Plain Text Artifact Spec

`serviceWorkers: 'block'` stops every service worker in the browser context,
not only the app's. Sandpack's static template serves an artifact's files from
a service worker inside its preview iframe, so with the profile blocking
workers the preview stays empty and the spec that reads it fails every attempt.

Opt that one spec back in and say in the profile's comment that the setting
reaches third-party workers too.
This commit is contained in:
Danny Avila 2026-11-11 16:22:48 -05:00 • committed by GitHub
parent 5ca49b5f4e
commit f07750b089
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 0 deletions

View file

@ -549,6 +549,13 @@ export default defineConfig({
headless: true,
storageState: path.resolve(process.cwd(), 'e2e/storageState.json'),
screenshot: 'only-on-failure',
/** Each test opens a fresh context, so the PWA service worker installs and claims the page
* during that test's first load. A `page.route` installed within a few milliseconds of the
* claim is never consulted, and the request it was meant to hold reaches the server. This
* blocks every worker in the context, including the one Sandpack's static preview serves
* an artifact's files from, so a spec that needs one opts back in with
* `test.use({ serviceWorkers: 'allow' })`. Derived profiles inherit this through `use`. */
serviceWorkers: 'block',
},
expect: {
timeout: 10000,

View file

@ -16,6 +16,10 @@ const PLAIN_TEXT =
'plain notes body\n' +
':::';
/** The mock profile blocks every service worker in the context, and Sandpack's static preview
* serves the artifact's files from one inside the preview iframe. */
test.use({ serviceWorkers: 'allow' });
test.describe('plain text artifact row', () => {
test(
'announces a rendered preview for plain text artifacts ' +