Skip to content

Install the chromium browser via the install-browser hook#4

Merged
andrewbelcher merged 1 commit into
mainfrom
chromium-install
Jun 22, 2026
Merged

Install the chromium browser via the install-browser hook#4
andrewbelcher merged 1 commit into
mainfrom
chromium-install

Conversation

@andrewbelcher

@andrewbelcher andrewbelcher commented May 30, 2026

Copy link
Copy Markdown
Contributor

Problem

The post-start hook ran playwright-cli install chromium, which isn't a valid commandinstall 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 (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 with Browser "…" 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:

  • headless consumers sharing this cache (Vitest/Storybook browser tests — the add-on's whole reason for existing), and
  • configs that select the full Chrome-for-Testing build via channel: "chromium" (which resolves to chrome-for-testing).

--only-shell installs only the headless shell, which can't satisfy a channel: "chromium" config — so it's dropped.

Test

  • Adds 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 because node_modules is intact), so the install-browser hook — 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.
  • Tightens the config-print assertion to match "browserName": "chromium" specifically, instead of a bare chromium substring that also matches chromiumSandbox.

🤖 Generated with Claude Code

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>
@andrewbelcher andrewbelcher changed the title Fix chromium install Install the chromium browser via the install-browser hook Jun 22, 2026
@andrewbelcher andrewbelcher merged commit 588ccce into main Jun 22, 2026
2 checks passed
@andrewbelcher andrewbelcher deleted the chromium-install branch June 22, 2026 14:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant