Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 23 additions & 4 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,15 @@ jobs:
- name: List package contents
run: npm pack --dry-run

browser-tests:
# One job per engine, in parallel.
browser-engines:
name: browser-tests (${{ matrix.browser }})
runs-on: ubuntu-26.04
timeout-minutes: 10
strategy:
fail-fast: false # report every engine
matrix:
browser: [chromium, firefox, webkit]
steps:
- uses: actions/checkout@v7.0.1
with:
Expand All @@ -46,7 +52,20 @@ jobs:
- run: npm ci

# Not cached: Playwright's docs say restoring takes about as long as downloading.
- name: Install browsers
run: npx playwright install --with-deps --only-shell chromium firefox webkit
- name: Install the browser
run: npx playwright install --with-deps --only-shell ${{ matrix.browser }}

- run: npm run test:browsers -- --project="${{ matrix.browser }} *"

- run: npm run test:browsers
# The required check: passes only if every engine passed, so the required
# checks stay the same when engines change.
browser-tests:
needs: browser-engines
if: always()
runs-on: ubuntu-26.04
timeout-minutes: 1
steps:
- name: Check that every engine passed
env:
RESULT: ${{ needs.browser-engines.result }}
run: test "$RESULT" = success
10 changes: 6 additions & 4 deletions playwright.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,22 @@ import { defineConfig, devices } from '@playwright/test';

const CI = Boolean(process.env.CI);

// CI runs every engine; locally only Chromium (npx playwright install --only-shell chromium).
// CI runs every engine (one job each, picked with --project); locally only Chromium
// (npx playwright install --only-shell chromium).
const browsers = CI ? ['chromium', 'firefox', 'webkit'] : ['chromium'];
const devicesByBrowser = { chromium: 'Desktop Chrome', firefox: 'Desktop Firefox', webkit: 'Desktop Safari' };

// Every test runs against both the source and the minified build.
const files = ['pace.js', 'pace.min.js'];
// The minified build, which sites load, runs in every engine; the source, which differs only
// by minification, in Chromium.
const filesByBrowser = { chromium: ['pace.js', 'pace.min.js'], firefox: ['pace.min.js'], webkit: ['pace.min.js'] };

export default defineConfig({
testDir: 'tests',
forbidOnly: CI,
workers: CI ? 1 : undefined,
reporter: CI ? [['github'], ['list']] : 'list',
projects: browsers.flatMap((browser) =>
files.map((paceFile) => ({
filesByBrowser[browser].map((paceFile) => ({
name: `${browser} ${paceFile}`,
use: { ...devices[devicesByBrowser[browser]], paceFile },
})),
Expand Down
Loading