From 341d398c1b4a3902cbc635d5bfb6de393de2b0b5 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 5 Aug 2026 14:44:42 +0000 Subject: [PATCH] fix: default playwright-cli to the chromium it ships MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pulling the published image and driving it showed the feature installed a browser nobody could reach: playwright-cli opens the branded "chrome" channel by default and looks for it at /opt/google/chrome/chrome, so "playwright-cli open" died with Chromium distribution 'chrome' is not found at /opt/google/chrome/chrome while a working Chromium sat in /usr/local/share/ms-playwright. Setting PLAYWRIGHT_MCP_BROWSER in containerEnv points the default at the bundled build; --browser still overrides per command. The scenario now opens and closes a browser with no flag, which is the only check that would have caught this — every existing check passed against the broken image. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01MB7zNmdzPYMpwkUWxAjSFt --- src/playwright/NOTES.md | 6 ++++++ src/playwright/README.md | 6 ++++++ src/playwright/devcontainer-feature.json | 5 +++-- test/playwright/ubuntu.sh | 2 ++ 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/playwright/NOTES.md b/src/playwright/NOTES.md index c3ecc5e..56c612e 100644 --- a/src/playwright/NOTES.md +++ b/src/playwright/NOTES.md @@ -21,3 +21,9 @@ downloaded. They live in `/usr/local/share/ms-playwright` rather than Playwright's default `$HOME/.cache`, and `PLAYWRIGHT_BROWSERS_PATH` is set through `containerEnv` to match. Nothing to configure, and it keeps working when `HOME` is replaced at run time. + +`PLAYWRIGHT_MCP_BROWSER=chromium` is set for the same reason. Left alone, `playwright-cli` opens the +branded `chrome` channel and looks for it at `/opt/google/chrome/chrome`, which nothing installs — +so `playwright-cli open` would fail with *"Chromium distribution 'chrome' is not found"* despite a +perfectly good Chromium sitting in the image. Callers can still override it per command with +`--browser`. diff --git a/src/playwright/README.md b/src/playwright/README.md index f6faee0..40702ca 100644 --- a/src/playwright/README.md +++ b/src/playwright/README.md @@ -41,6 +41,12 @@ They live in `/usr/local/share/ms-playwright` rather than Playwright's default ` `PLAYWRIGHT_BROWSERS_PATH` is set through `containerEnv` to match. Nothing to configure, and it keeps working when `HOME` is replaced at run time. +`PLAYWRIGHT_MCP_BROWSER=chromium` is set for the same reason. Left alone, `playwright-cli` opens the +branded `chrome` channel and looks for it at `/opt/google/chrome/chrome`, which nothing installs — +so `playwright-cli open` would fail with *"Chromium distribution 'chrome' is not found"* despite a +perfectly good Chromium sitting in the image. Callers can still override it per command with +`--browser`. + --- diff --git a/src/playwright/devcontainer-feature.json b/src/playwright/devcontainer-feature.json index 033fe30..61f3091 100644 --- a/src/playwright/devcontainer-feature.json +++ b/src/playwright/devcontainer-feature.json @@ -1,6 +1,7 @@ { "containerEnv": { - "PLAYWRIGHT_BROWSERS_PATH": "/usr/local/share/ms-playwright" + "PLAYWRIGHT_BROWSERS_PATH": "/usr/local/share/ms-playwright", + "PLAYWRIGHT_MCP_BROWSER": "chromium" }, "description": "Installs the Playwright CLI and Chromium. Requires the node feature.", "id": "playwright", @@ -16,5 +17,5 @@ "type": "string" } }, - "version": "1.0.0" + "version": "1.1.0" } diff --git a/test/playwright/ubuntu.sh b/test/playwright/ubuntu.sh index fffdef3..7193cc6 100755 --- a/test/playwright/ubuntu.sh +++ b/test/playwright/ubuntu.sh @@ -6,6 +6,8 @@ source \ dev-container-features-test-lib check 'check if playwright-cli exists' bash -c "command -v playwright-cli" check 'check if the browsers path is exported' bash -c "test \"${PLAYWRIGHT_BROWSERS_PATH:-}\" = /usr/local/share/ms-playwright" +check 'check if the default browser is chromium' bash -c "test \"${PLAYWRIGHT_MCP_BROWSER:-}\" = chromium" check 'check if chromium was downloaded' bash -c "ls /usr/local/share/ms-playwright | grep -q chromium" check 'check if the browsers are readable by the remote user' bash -c "test -r /usr/local/share/ms-playwright && test -x /usr/local/share/ms-playwright" +check 'check if the browser opens with no --browser flag' bash -c "PLAYWRIGHT_CLI_SESSION=featuretest playwright-cli open && PLAYWRIGHT_CLI_SESSION=featuretest playwright-cli close" reportResults