docs(claude-code): document executablePath wiring for every Playwright consumer (#91)#92
Merged
Merged
Conversation
…t consumer (#91) - README Playwright Strategy: replace the single playwright.config.ts snippet with a per-consumer wiring matrix (table) covering @playwright/ test, @vitest/browser-playwright (incl. @storybook/addon-vitest), direct playwright-core / playwright use, and agent-browser. Each gets its own pasteable snippet. Includes the misleading "npx playwright install" symptom + correct fix for the vitest case. - Dockerfile (default target): add AGENT_BROWSER_EXECUTABLE_PATH=/usr/ bin/chromium so agent-browser shares the system chromium. agent-browser is a Rust CLI with its own env-var family; PLAYWRIGHT_* vars are ignored. Eliminates auto-detection ambiguity and prevents a Chrome-for- Testing download on first run (which would fail in firewalled setups and waste bandwidth elsewhere). - README skills section: rename "Optional: Claude Code skill for Playwright" to "Recommended:" — the wiring matrix is now documented, but the skill encodes how Claude Code drives those entry points. - sandbox-playwright SKILL.md: add @vitest/browser-playwright and direct playwright-core to the path-picker table; expand discovery step #1 to find vitest.config.* alongside playwright.config.* (RTK-safe single- predicate finds); add the "don't run npx playwright install" red flag + fix instruction; broaden the maintainer footer to enumerate the full env-var family (including AGENT_BROWSER_EXECUTABLE_PATH). - CI verify: assert AGENT_BROWSER_EXECUTABLE_PATH is set to /usr/bin/ chromium in the published default image (not added to sandbox — agent- browser isn't installed there).
gatezh
added a commit
that referenced
this pull request
Apr 30, 2026
…pansion (#93) The verify-command from #92 used `test "$AGENT_BROWSER_EXECUTABLE_PATH" = /usr/bin/chromium`. When GitHub Actions interpolates that string into `bash -c "..."`, the runner's bash expands `$AGENT_BROWSER_EXECUTABLE_PATH` from the **runner's** environment (where it's unset) before docker runs, leaving the container's bash to evaluate `test = /usr/bin/chromium` — malformed, exit 2. Replace with `printenv AGENT_BROWSER_EXECUTABLE_PATH | grep -qx /usr/bin/chromium`. No shell metacharacters in the substituted string, so the runner shell has nothing to expand; the entire command reaches the container's bash intact, and `printenv` reads the env var from inside the container. Verified end-to-end against the published image — exits 0 with the expected env var, exits 1 if unset. The image's ENV instruction itself was correct (confirmed via `docker inspect`); only the CI verify step was broken.
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.
What
Close the documentation gap that left
@vitest/browser-playwright, directplaywright-coreuse, andagent-browserundocumented as Playwright entry points in the README. Plus an opportunistic Dockerfile fix that makesagent-browserreliably use the system chromium.Why
A consumer (the project that filed #91) followed the README end-to-end — wired
playwright.config.ts, set upinit-plugins.sh, copied the skills — and then their storybook test suite failed at first run with a misleading message:The hint pointed at the wrong fix. The actual fix was wiring
launchOptions.executablePathinvitest.config.ts— exactly whatplaywright.config.tsalready does. The README only documented one Playwright entry point; this PR documents all of them, with copy-paste snippets, against the latest upstream APIs.Closes #91.
Changes
claude-code/README.md— Playwright Strategy sectionplaywright.config.tssnippet with a per-consumer wiring matrix (table) covering:@playwright/mcp,@playwright/test,@vitest/browser-playwright, directplaywright-core/playwright,agent-browser.@playwright/test—use.launchOptions.executablePath@vitest/browser-playwright—playwright({ launchOptions: { executablePath } })(verified againstPlaywrightProviderOptionsin current vitest source;mergeConfig(viteConfig, …)form is canonical for Vite-based projects)chromium.launch({ executablePath })for scripts/codegen"Please run npx playwright install"symptom and the correct fix.AGENT_BROWSER_EXECUTABLE_PATH=/usr/bin/chromiumto the Dockerfile-set env-vars listing.claude-code/.devcontainer/Dockerfile— default target onlyAGENT_BROWSER_EXECUTABLE_PATH=/usr/bin/chromiumto the existingENVblock. agent-browser is a Rust CLI with its own env-var family —PLAYWRIGHT_*vars are silently ignored. This is the canonical, documented agent-browser env var per the upstream README. Without it: agent-browser would auto-detect/usr/bin/chromium(works most of the time) or fall back to a Chrome-for-Testing download on first use (fails in firewall, wastes bandwidth elsewhere). Sandbox target is unchanged — agent-browser isn't installed there.claude-code/.claude/skills/sandbox-playwright/SKILL.md@vitest/browser-playwrightand directplaywright-coreuse alongside MCP and@playwright/test.vitest.config.*alongsideplaywright.config.*(using two single-predicatefindcalls — safe across RTK's compound-predicate rejection).AGENT_BROWSER_EXECUTABLE_PATH.claude-code/README.md— section heading### Optional: Claude Code skill for Playwright→### Recommended: Claude Code skill for Playwright. The wiring matrix is now well-documented, but the skill encodes how Claude Code actually drives the wired-up entry points..github/workflows/build-claude-code.yml\$AGENT_BROWSER_EXECUTABLE_PATH = /usr/bin/chromium. Sandbox lines unchanged.Notes
The "150MB savings" was overstated — agent-browser's npm postinstall only downloads its Rust binary, not Chromium. Chromium download would only happen on first run; setting
AGENT_BROWSER_EXECUTABLE_PATHprevents that fallback. The real wins are reliability (no first-run download attempt, works in firewalled sandbox without surprise) and explicitness (no implicit auto-detection).API verification:
@vitest/browser-playwrightPlaywrightProviderOptions { launchOptions?: Omit<LaunchOptions, 'tracesDir'>; ... }— verified current against vitest's source.playwright({ launchOptions: { executablePath } })is the canonical 2026 form.mergeConfig(viteConfig, …)— current, not deprecated for single-config setups.chromium.launch({ executablePath })— canonical PlaywrightBrowserType.launch()API.AGENT_BROWSER_EXECUTABLE_PATH— verified canonical in agent-browser's official README (one of ~30+ documentedAGENT_BROWSER_*env vars).Pre-merge verification:
bash -cwill see correctly-quotedtestcommands)Why one PR, not many — issue #91 explicitly authorized bundling the agent-browser optimization and the skill update with the README expansion, since they're all consequences of the same Playwright-consumer-completeness pass. Splitting would mean three PRs against overlapping files for one logical change.