Run Playwright tests on GitHub Actions
Перейти к файлу
Max Schmitt 6cd86f33a9
chore: bump dependencies (#68)
2022-06-10 00:55:35 +02:00
.github/workflows chore: add support for Ubuntu 22.04 (#66) 2022-06-10 00:31:16 +02:00
dist chore: bump dependencies (#68) 2022-06-10 00:55:35 +02:00
sample fix: fix missing libraries for Firefox and WebKit (#25) 2020-07-29 10:38:23 -07:00
.eslintignore chore: bump dependencies (#68) 2022-06-10 00:55:35 +02:00
.eslintrc.json feat: initial setup 2020-04-08 08:47:46 -07:00
.gitignore chore: added lock file (#60) 2022-03-14 19:49:58 +01:00
CODE_OF_CONDUCT.md Initial CODE_OF_CONDUCT.md commit 2020-03-04 12:37:42 -08:00
CONTRIBUTING.md docs: update readme and development docs (#9) 2020-04-15 15:46:30 -07:00
DEVELOPMENT.md docs: update development docs (#62) 2022-03-14 12:08:07 -07:00
LICENSE Initial LICENSE commit 2020-03-04 12:37:45 -08:00
README.md docs: make it more visible that the GitHub Action is not needed (#50) 2021-07-12 04:03:13 -07:00
SECURITY.md Initial SECURITY.md commit 2020-03-04 12:37:43 -08:00
action.yml feat: update name in action.yml 2020-05-05 15:05:44 -07:00
index.js chore: add support for Ubuntu 22.04 (#66) 2022-06-10 00:31:16 +02:00
package-lock.json chore: bump dependencies (#68) 2022-06-10 00:55:35 +02:00
package.json chore: bump dependencies (#68) 2022-06-10 00:55:35 +02:00

README.md

Playwright GitHub Action

ubuntu windows macos

Set up GitHub Actions to run cross-browser tests on Chromium, WebKit and Firefox with Playwright.

⚠️ You don't need this GitHub Action ⚠️

We recommend using Playwright CLI instead of this action.

Since v1.8.0 Playwright includes CLI that installs all required browser dependencies. To install dependencies with CLI:

$ npx playwright install-deps # install dependencies for all browsers
$ npx playwright install-deps chromium # install dependencies for Chromium only

If something doesn't work, please let us know!

Usage

Add uses: microsoft/playwright-github-action@v1 to the GitHub workflow definition before running your tests.

on:
  push:
    branches:
    - main

jobs:
  e2e-tests:
    runs-on: ubuntu-latest # or macos-latest, windows-latest

    steps:
      - uses: actions/checkout@v2

      - uses: actions/setup-node@v1

      - uses: microsoft/playwright-github-action@v1

      - name: Install dependencies and run tests
        run: npm install && npm test

Upload artifacts

This GitHub Action can be combined with the Upload Artifact action to upload test artifacts (like screenshots or logs).

steps:
- uses: microsoft/playwright-github-action@v1

- name: Install dependencies and run tests
  run: npm install && npm test

- uses: actions/upload-artifact@v2
  if: ${{ always() }}
  with:
    name: test-artifacts
    path: path/to/artifacts

Run in headful mode

This GitHub Action can also execute tests in headful mode. To do this, use xvfb-run on a Linux agent.

# Windows/macOS
$ npm test

# Linux
$ xvfb-run --auto-servernum -- npm test

Resources