Sets up the runner for Playwright for PHP:
- install Playwright library globally
- download the browser binaries (default: Chrome)
# .github/workflows/test.yml
name: PHP Tests
on: [push]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: playwright-php/setup-playwright@v1
with:
browsers: chrome # default value
- uses: shivammathur/setup-php@v2
with:
php-version: '8.4'
- run: composer install
- run: vendor/bin/phpunit- uses: playwright-php/setup-playwright@v1
with:
browsers: '["chromium","firefox"]'- uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: browsers-${{ runner.os }}
- uses: playwright-php/setup-playwright@v1
with:
browsers-path: ~/.cache/ms-playwright- uses: playwright-php/setup-playwright@v1
with:
playwright-version: '1.48.2'
browsers: webkit
with-deps: falseThe action exposes two outputs:
playwright-version: the installed Playwright CLI versioninstalled-browsers: a JSON list of the browsers that were installed
| Option | Default | Allowed values | Notes |
|---|---|---|---|
browsers |
chrome |
chrome, chromium, firefox, webkit, msedge, all |
msedge only on Windows runners |
playwright-version |
latest |
Any valid npm specifier (for the playwright package) |
Leave latest to track upstream. |
with-deps |
auto |
true, false, auto |
auto appends Playwright's --with-deps flag on Linux runners. |
browsers-path |
Directory path | Exports PLAYWRIGHT_BROWSERS_PATH so downloads land in your cache. Leave blank for Playwright defaults (~/.cache/ms-playwright, %LOCALAPPDATA%\ms-playwright, etc.) |
- Trigger
.github/workflows/test.ymlviaworkflow_dispatchto exercise the action on hosted runners. - Run the same workflow with
actto catch issues locally before pushing. - In a scratch repo, reference the action with
uses: ./so every commit is validated before tagging a Marketplace release.
This package is released by the Playwright PHP project under the MIT License. See the LICENSE file for details.
