Install the chromium browser via the install-browser hook#4
Merged
Conversation
077a09c to
70f3dc0
Compare
The post-start hook ran `playwright-cli install chromium`, which isn't a valid command — `install` initializes a workspace and takes no positional arguments, so it errored on every start and installed no browser. The add-on's own test suite masked this: it runs in a brand-new project, so hook 1's `npm install --save-dev @playwright/cli` provisions a browser as a side effect. In an already-initialized project (e.g. one already depending on @playwright/cli) the npm install/ci hooks are skipped, leaving the broken hook as the only provisioner — so no browser is installed and `playwright-cli open` fails. Use the correct `playwright-cli install-browser chromium`, and install the full build rather than `--only-shell`: the full chromium download includes the headless shell, so a single install satisfies both headless consumers (Vitest/Storybook browser tests sharing this cache) and configs that select the full Chrome-for-Testing build via `channel: "chromium"`. Add a regression test (run in both the directory and release pipelines) that wipes the shared browser cache and restarts, so the install-browser hook — not npm's install-time download — must provision the browser, mirroring the already-initialized-project path. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
70f3dc0 to
946a5e6
Compare
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.
Problem
The post-start hook ran
playwright-cli install chromium, which isn't a valid command —installinitializes a workspace and takes no positional arguments, so it errored on every start and installed no browser.The add-on's own test suite masked this: it runs in a brand-new project, so hook 1's
npm install --save-dev @playwright/cliprovisions a browser as a side effect. In an already-initialized project (one already depending on@playwright/cli), the npm install/ci hooks are skipped, leaving the broken hook as the only provisioner — so no browser is installed andplaywright-cli openfails withBrowser "…" is not installed.Fix
Use the correct
playwright-cli install-browser chromium, and install the full build rather than--only-shell.The full chromium download includes the headless shell, so a single install satisfies:
channel: "chromium"(which resolves tochrome-for-testing).--only-shellinstalls only the headless shell, which can't satisfy achannel: "chromium"config — so it's dropped.Test
assert_browser_reinstalled_by_hook, run in both the directory and release pipelines: wipes the shared browser cache and restarts (npm install/ci are skipped becausenode_modulesis intact), so theinstall-browserhook — not npm's install-time download — must provision the browser. This mirrors the already-initialized-project path and removes the masking that hid the bug.config-printassertion to match"browserName": "chromium"specifically, instead of a barechromiumsubstring that also matcheschromiumSandbox.🤖 Generated with Claude Code