fix(setup): pin Playwright browser install to bundled version so headed browse connect works (#1829)#1838
Open
jbetala7 wants to merge 1 commit into
Open
Conversation
…rrytan#1829) Headed `browse connect` fails with a missing full Chromium build (e.g. `chromium-1208/.../Google Chrome for Testing`) after a "successful" ./setup, while headless browse works fine. Two root causes in setup: 1. The browse binary is compiled against the lockfile-pinned Playwright (1.58.2 -> Chromium 1208), but `bunx playwright install chromium` resolves the *latest* Playwright at runtime (1.60.0 -> Chromium 1223) and downloads a different full build than the binary expects. 2. `ensure_playwright_browser()` only does a headless `chromium.launch()`, which passes off the cached headless shell even when the full Chrome-for-Testing build that headed mode needs is missing — so the mismatch is never caught. Fix: install browsers with the Playwright version bundled in node_modules (so install and runtime can never drift), and assert `chromium.executablePath()` exists before treating the browser as ready so a missing full build fails setup instead of being masked. Adds test/setup-playwright-pin.test.ts (static source assertions, no browser download) guarding both invariants. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Merging to
After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here |
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.
Fixes #1829
Problem
On a clean install/upgrade, headed
browse connectfails with a missing full Chromium build:even though
./setupreported success and headless browse works fine.Root cause (two issues in
setup)playwright@1.58.2→ Chromium revision 1208). But the browser-install step ranbunx playwright install chromium, which resolves the latest Playwright at runtime (currently1.60.0→ revision 1223) and downloads a different full build than the binary expects. The cache ends up withchromium-1223(wrong) andchromium_headless_shell-1208but notchromium-1208(full) — so headed launch fails.ensure_playwright_browser()only ran a defaultchromium.launch()(headless), which passes off the cachedchromium_headless_shelleven when the full Chrome-for-Testing build is absent. So setup reports success.Fix
node_modules(read fromplaywright/package.json) instead ofbunx-latest, so the installed Chromium revision always matches the compiled binary and the two can never drift. Falls back to the old behavior only if the version can't be resolved.ensure_playwright_browser()to assertchromium.executablePath()exists before treating the browser as ready (both the Node/Windows and Bun/Unix branches), so a missing full build fails setup instead of being silently masked by the cached headless shell.This matches the maintainer-suggested direction in the issue (pin the install to the bundled version; make verify catch a missing full build).
Testing
bun test test/setup-playwright-pin.test.ts— new static-source regression test (no browser download), 3 pass.bun test test/setup-windows-fallback.test.ts test/setup-emoji-font.test.ts— existing setup tests still green (20 pass).bash -n setup— syntax OK.1.58.2andchromium.executablePath()returns thechromium-1208full-build path the issue reports as missing.Relationship to other open Playwright PRs (not duplicates)
playwright installhangs on Node 24.16+ — bump pinned playwright from^1.58.2to^1.60.0#1703 (bump to^1.60.0for the Node 24.16+ yauzl hang) and fix(browse): bump Playwright to ^1.60.0 and pin full Chromium for extension loading #1565 (bump + runtimeexecutablePathpin inbrowser-manager.tsfor Flutter headless rendering) target different symptoms and code paths. A version bump only incidentally realigns revisions while npm's "latest" happens to equal the pinned range; the moment a newer Playwright ships,bunx-latest drifts again. This PR fixes the drift mechanism in the install/verify path and is complementary to those changes.