feat(web)!: pin playwright-core and add a browser install command
Merged
OK
2mo ago+396+396+012345678901234567890123456789-183-183-012345678901234567890123456789
@e2e-dev/web now depends on playwright-core pinned to 1.63.0 instead of peering on playwright >=1.63 <2. Same model as @e2e-dev/mobile pinning agent-device: the engine always runs the Playwright it was tested against, and it already reaches into Playwright internals (cdp-selectors.ts uses _channel), which only an exact pin makes safe.
- All
packages/webimports move to'playwright-core'.playwright(the test runner on top of core, ~5 MB) is gone from the lockfile. e2e initno longer writesplaywrightinto new projects (packages/e2e/src/cli/init/engines.ts,scripts/write-sibling-versions.ts).- New
e2e-webbin, so users install browsers for the pinned version without having Playwright as a direct dependency:
npx @e2e-dev/web install chromium --with-deps # npm, also bunx
pnpm exec e2e-web install chromium --with-deps # pnpm cannot exec by package name
install [chromium|firefox|webkit ...] [--with-deps]only, chromium by default. It forwards to the bundledplaywright-core/cli.jsand passes SIGINT/SIGTERM on to it, so a cancelled CI job does not leave a download running (packages/web/src/install.ts).- The engine's
BROWSER_INSTALL_FAILEDmessage now points at the new command. - Docs (
reference/web#installing-browsers,browser,ci,migrate/playwright), the README, andskills/e2edrop the peer-dependency story. ThecheckCI job installs browsers through the built bin.
Breaking for existing projects: remove playwright unless the app uses it for its own tests, and swap npx playwright install for the command above. Changeset included (@e2e-dev/web minor, e2e patch).
Known gap: the trace docs still say npx playwright-core@1.63.0 show-trace, and nothing keeps that version in sync with the pin. Left on purpose: Playwright traces are slated for removal.
Verified
Ran it locally: yes
- Packed
e2eand@e2e-dev/webinto a scratch npm project under/tmp:e2e init --yeswrites noplaywright,npx @e2e-dev/web install chromiumfills an emptyPLAYWRIGHT_BROWSERS_PATHwith revision 1243, and the scaffolded test then runs on that cache with no download:
$ npx @e2e-dev/web install chromium
Chrome for Testing 153.0.8010.12 (playwright chromium v1243) downloaded to <tmp>/browsers/chromium-1243
FFmpeg (playwright ffmpeg v1011) downloaded to <tmp>/browsers/ffmpeg-1011
Chrome Headless Shell 153.0.8010.12 (playwright chromium-headless-shell v1243) downloaded to <tmp>/browsers/chromium_headless_shell-1243
$ npx e2e run --video
✓ |web| tests/example.e2e.ts (1 test) 1.22s
✓ app opens 1.22s
Test Files 1 passed (1)
- Same in pnpm (
pnpm exec e2e-web, plusnpx @e2e-dev/webinside a pnpm project) and bun (bunx @e2e-dev/web). - Failure path, download host pointed at a dead port with an empty cache:
ERROR infrastructure error BROWSER_INSTALL_FAILED (launch)
playwright-core install chromium exited with code 1; run "npx @e2e-dev/web install chromium" (pnpm: "pnpm exec e2e-web install chromium") manually
- SIGTERM to the command mid-download: exits 143, the downloader's socket closes, no Playwright process left.
packages/web/tests/integration/cli.test.tscovers this against a local server that never answers, and fails when the forwarding is removed. - Testbed and web benchmark suites pass on the built packages.
- Docs page,
mint dev: