This GitHub Action installs Playwright along with its dependencies. Playwright is a framework for browser-based automation and testing across multiple browsers. This action supports custom configurations for cache directories and the installation of specific browsers, tailored for efficient testing environments in CI workflows.
Create a new workflow file, for example, .github/workflows/test.yml
, and add the following code to it.
---
on:
push:
branches:
- master
pull_request:
name: 🧪 E2E testing for web app
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: 📦 Check out the codebase
uses: actions/checkout@v4
# ...
- name: 🎭 Install Playwright
uses: wayofdev/gh-actions/actions/playwright/install@master
with:
playwright-cache-folder: '~/.cache/ms-playwright'
cache-prefix: 'ci-tests'
browsers: 'chromium webkit'
# ...
...
For details, see actions/playwright/install/action.yml
.
Real-world examples can be found in the wayofdev/next-starter-tpl
repository.
playwright-cache-folder
, optional: Specifies the directory for caching Playwright installations. Defaults to~/.cache/ms-playwright
.cache-prefix
, optional: A prefix used to invalidate the cache in case of issues. Defaults todefault
.browsers
, optional: Specifies which browsers to install. Defaults to"chromium webkit"
.
none
- Custom configurations are used to set up the Playwright environment, specifically targeting cache management and browser installation.
- The caching mechanism is optimized with a dynamically generated cache key that considers the OS, Playwright version, browser selection, and any specified cache prefix.
- If the cache does not match the current requirements (e.g., due to a version update or change in selected browsers), Playwright will reinstall the necessary components.