Skip to content

GitHub Action to setup Playwright PHP environment: install Playwright and optionally download browsers

License

Notifications You must be signed in to change notification settings

playwright-php/setup-playwright

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Playwright PHP

  CI   Release   License

Setup Playwright (for PHP)

Sets up the runner for Playwright for PHP:

  • install Playwright library globally
  • download the browser binaries (default: Chrome)

Usage

# .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

Examples

Install multiple browsers

- uses: playwright-php/setup-playwright@v1
  with:
    browsers: '["chromium","firefox"]'

Reuse cached browser downloads

- 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

Pin the Playwright CLI version and skip deps

- uses: playwright-php/setup-playwright@v1
  with:
    playwright-version: '1.48.2'
    browsers: webkit
    with-deps: false

Outputs

The action exposes two outputs:

  • playwright-version: the installed Playwright CLI version
  • installed-browsers: a JSON list of the browsers that were installed

Configuration

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.)

Testing the action

  1. Trigger .github/workflows/test.yml via workflow_dispatch to exercise the action on hosted runners.
  2. Run the same workflow with act to catch issues locally before pushing.
  3. In a scratch repo, reference the action with uses: ./ so every commit is validated before tagging a Marketplace release.

License

This package is released by the Playwright PHP project under the MIT License. See the LICENSE file for details.

About

GitHub Action to setup Playwright PHP environment: install Playwright and optionally download browsers

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Sponsor this project