Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion config.playwright-cli.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
#ddev-generated
hooks:
post-start:
# Ensure playwright-cli is installed.
- exec: "[ -x /var/www/html/node_modules/.bin/playwright-cli ] || npm install --save-dev @playwright/cli"
# Symlink so it can be called directly.
- exec: "ln -sf /var/www/html/node_modules/.bin/playwright-cli /usr/local/bin/playwright-cli"
# Install chromium and playwright-cli skills.
- exec: "playwright-cli install chromium"
- exec: "[[ -d /var/www/html/.claude/skills/playwright-cli ]] || playwright-cli install --skills"
# Configure the cert store for DDEV/mkcert from the host.
- exec: mkdir -p $HOME/.pki/nssdb && certutil -d sql:$HOME/.pki/nssdb -N --empty-password && certutil -d sql:$HOME/.pki/nssdb -A -t "C,," -n mkcert-ca -i $(mkcert -CAROOT)/rootCA.pem
web_environment:
- PLAYWRIGHT_MCP_BROWSER=chromium
- PLAYWRIGHT_BROWSERS_PATH=/mnt/ddev-global-cache/playwright-browsers
- PLAYWRIGHT_MCP_BROWSER=chromium
8 changes: 8 additions & 0 deletions tests/test.bats
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ health_checks() {
assert_line "### Page"
assert_line "- Page URL: https://example.com/"
assert_line "- Page Title: Example Domain"

# Check that it can be executed directly in the container.
DDEV_DEBUG=true run ddev exec playwright-cli open https://example.com/
assert_success
assert_line " - browser-type: chromium"
assert_line "### Page"
assert_line "- Page URL: https://example.com/"
assert_line "- Page Title: Example Domain"
}

teardown() {
Expand Down
6 changes: 2 additions & 4 deletions web-build/Dockerfile.playwright-cli
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#ddev-generated
RUN npm install -g @playwright/cli@latest
RUN npx playwright install-deps chromium
# Install chromium as the user.
RUN mkdir /.playwright && chmod 0777 /.playwright && sudo -u ${username} playwright-cli install chromium
# Install Chromium OS dependencies (version-independent).
RUN npx -y playwright install-deps chromium

# Add the mkcert certificate authority.
RUN apt-get update && apt-get install -y libnss3-tools
Expand Down