Skip to content

Commit

Permalink
Parallelise tests by browser
Browse files Browse the repository at this point in the history
  • Loading branch information
w0rm committed Apr 1, 2024
1 parent 662540b commit 5004cca
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 13 deletions.
20 changes: 17 additions & 3 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,34 @@ on:
branches: [main]
jobs:
test:
name: "Playwright Tests - ${{ matrix.project }}"
strategy:
fail-fast: false
matrix:
project: [chromium, firefox, webkit]
timeout-minutes: 60
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./testing
steps:
- uses: actions/cache@v2
id: playwright-cache
with:
path: |
~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ hashFiles('**/package-lock.json') }}
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
node-version: "18"
- run: npm ci
- run: npx playwright install --with-deps
- run: npm run precompile-elm-app
- run: npm test
if: steps.playwright-cache.outputs.cache-hit != 'true'
- run: npx playwright install-deps
if: steps.playwright-cache.outputs.cache-hit == 'true'
- run: npx elm make TestApp.elm --output=TestApp.html
- run: npx playwright test --project=${{ matrix.project }}
- uses: actions/upload-artifact@v4
if: always()
with:
Expand Down
19 changes: 14 additions & 5 deletions testing/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
# Snapshot testing

```bash
npm ci # installs the dependencies
npx playwright install --with-deps # installs automated browsers
npm run precompile-elm-app # precompiles the test app to `TestApp.html`
npm test # runs the snapshot tests
npm run update-snapshots # updates snapshots with chromium
# install the dependencies
npm ci

# install playwright browsers
npx playwright install --with-deps

# precompile the test app to `TestApp.html`
npx elm make TestApp.elm --output=TestApp.html

# run the snapshot tests
npx playwright test

# updates snapshots with chromium
npx playwright test --project=chromium --update-snapshots
```

- The tests are using [Playwright](https://playwright.dev)
Expand Down
6 changes: 1 addition & 5 deletions testing/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"precompile-elm-app": "elm make TestApp.elm --output=TestApp.html",
"test": "npx playwright test",
"update-snapshots": "npx playwright test --project=chromium --update-snapshots"
},
"scripts": {},
"keywords": [],
"author": "",
"devDependencies": {
Expand Down

0 comments on commit 5004cca

Please sign in to comment.