Cache Playwright browsers in CI (#33) - #37
Merged
Conversation
Cache ~/.cache/ms-playwright by OS and @playwright/test version so browser install is skipped on hit, with a 15-minute timeout on miss. On cache hit, still install Chromium OS deps. Also stub Vite .svg imports during Playwright collection so CI can get past Unknown file extension errors that blocked the #31 merge deploy. Co-authored-by: Pat Needham <p@patn.dev>
This was referenced Aug 25, 2026
goodeats
marked this pull request as ready for review
August 25, 2026 17:29
Drop build.external, the Babel SVG transform, and the ESM loader. Those extras caused GHA collection to fail with Unknown file extension .svg; Epic Stack does not stub this and their config does not externalize SVG. Keep the versioned Playwright browser cache. Co-authored-by: Pat Needham <p@patn.dev>
Matching Epic Stack’s playwright.config on Playwright 1.51 made GHA parse sprite.svg as JS (SyntaxError). Keep the #24 Babel rewrite so collection never loads the SVG file, but do not mark **/*.svg as external (that caused Unknown file extension .svg). Cache unchanged. Co-authored-by: Pat Needham <p@patn.dev>
PW_TEST_SOURCE_TRANSFORM set inside playwright.config.ts never reached the loader thread on GHA, so collection still parsed sprite.svg as JS. Pass the plugin via '@playwright/test'.babelPlugins (copied over the loader channel) and set the env vars on the workflow test step before Playwright starts. Cache unchanged. Co-authored-by: Pat Needham <p@patn.dev>
GHA already injects PW_TEST_SOURCE_TRANSFORM before Playwright starts. Also passing it as babelPlugins made Babel error: Duplicate plugin/preset. Keep the workflow env; config only sets the vars if they are unset. Co-authored-by: Pat Needham <p@patn.dev>
SVG collection is past the sprite SyntaxError. Node 22.18+ then fails on constructor parameter properties (tests/pom/base/page.pom.ts) in strip-only mode. Set NODE_OPTIONS=--no-experimental-strip-types on the test step so Playwright's Babel transform runs instead. Co-authored-by: Pat Needham <p@patn.dev>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #33
Caches Playwright Chromium so the e2e job can get past Install Playwright Browsers instead of hanging until the 60-minute job timeout.
What changed
~/.cache/ms-playwrightby OS +@playwright/testversioninstall-deps chromiumCollection (Playwright 1.51 on Node 22.18)
sprite.svgis not JS — stub withtests/svg-import-stub.cjs, env set before Playwright starts (PW_TEST_SOURCE_TRANSFORM)NODE_OPTIONS=--no-experimental-strip-typesso Playwright’s own TS transform runsNot bumping
@playwright/test(#29). Epic Stack avoids this via Playwright 1.58.Test Plan
dev, staging deploy can proceed