diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml
index 7c52a342..1e868a86 100644
--- a/.github/workflows/gh-pages.yml
+++ b/.github/workflows/gh-pages.yml
@@ -14,20 +14,24 @@ jobs:
deploy:
runs-on: ubuntu-20.04
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.branch }}
- - name: Use Node.js 16.x
- uses: actions/setup-node@v3
+ - name: Enable pnpm
+ run: "corepack enable"
+ - name: Use Node.js 22.x
+ uses: actions/setup-node@v4
with:
- node-version: 16.x
- cache: npm
+ node-version: 22.x
+ cache: pnpm
- name: Install dependencies
- run: "cd docs && npm ci"
+ working-directory: docs
+ run: "pnpm i --frozen-lockfile"
- name: Build
- run: "cd docs && npm run build"
+ working-directory: docs
+ run: "npm run build"
- name: Deploy
- uses: peaceiris/actions-gh-pages@v3
+ uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/_site
diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml
new file mode 100644
index 00000000..0922c7cc
--- /dev/null
+++ b/.github/workflows/playwright.yml
@@ -0,0 +1,47 @@
+name: Playwright Tests
+on:
+ push:
+ branches: [ main ]
+ pull_request:
+ branches: [ main ]
+jobs:
+ test:
+ timeout-minutes: 60
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - run: corepack enable
+ - uses: actions/setup-node@v4
+ with:
+ node-version: lts/*
+ cache: pnpm
+ - name: Install dependencies
+ run: pnpm i -r
+ - name: build
+ run: npm run build
+ - name: Get installed Playwright version
+ id: playwright-version
+ run: echo "PLAYWRIGHT_VERSION=$(pnpm ls @playwright/test --parseable | tail -1)" >> $GITHUB_ENV
+ working-directory: web-test
+ - name: Cache playwright binaries
+ uses: actions/cache@v3
+ id: playwright-cache
+ with:
+ path: |
+ ~/.cache/ms-playwright
+ key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}
+ - run: npx playwright install --with-deps
+ if: steps.playwright-cache.outputs.cache-hit != 'true'
+ working-directory: web-test
+ - run: npx playwright install-deps
+ if: steps.playwright-cache.outputs.cache-hit == 'true'
+ working-directory: web-test
+ - name: Run Playwright tests
+ run: npm run test
+ working-directory: web-test
+ - uses: actions/upload-artifact@v4
+ if: failure()
+ with:
+ name: playwright-report
+ path: web/playwright-report/
+ retention-days: 30
diff --git a/.gitignore b/.gitignore
index 18bae93f..248276cf 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,10 +1,10 @@
+.nyc_output
+.vscode/
+*.map
browser/
build/
coverage/
+docs/_site
examples/*.js
node_modules/
yarn.lock
-.nyc_output
-*.map
-docs/_site
-.vscode/
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 9cf282ad..7d085873 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,8 @@ Unreleased
- [#507](https://github.com/peggyjs/peggy/pull/507) Remove stray semicolon in CSS
- [#508](https://github.com/peggyjs/peggy/pull/508) Fix broken text input
- [#520](https://github.com/peggyjs/peggy/pull/520) Grammar with token "constructor" fails to generate
+- [#522](https://github.com/peggyjs/peggy/pull/522) Switched from puppeteer
+ to playwright for web tests, and added them to CI.
### Documentation
- [#506](https://github.com/peggyjs/peggy/pull/506) Added END OF INPUT (`!.`).
diff --git a/docs/development/test.html b/docs/development/test.html
index 739a55fa..76a686cd 100644
--- a/docs/development/test.html
+++ b/docs/development/test.html
@@ -2,11 +2,11 @@
title: 'Test'
permalink: "/development/test.html"
layout: main-layout
-stylesheets: ["https://cdnjs.cloudflare.com/ajax/libs/mocha/8.3.2/mocha.css"]
+stylesheets: ["https://cdnjs.cloudflare.com/ajax/libs/mocha/10.4.0/mocha.css"]
scripts:
[
- "https://cdnjs.cloudflare.com/ajax/libs/mocha/8.3.2/mocha.min.js",
- "https://cdnjs.cloudflare.com/ajax/libs/chai/4.3.4/chai.min.js",
+ "https://cdnjs.cloudflare.com/ajax/libs/mocha/10.4.0/mocha.min.js",
+ "https://cdnjs.cloudflare.com/ajax/libs/chai/4.4.1/chai.min.js",
]
---
@@ -14,7 +14,14 @@
// Modern browsers don't need whatwgURL.
// source-map looks for it with this name, as configured in rollup.config.mjs
window.whatwgURL = { URL };
- mocha.setup('bdd');
+ mocha.setup({
+ ui: "bdd",
+ global: [
+ "TextEncoder", // Not really a leak, we put it back after deleting
+ "peggyVersion", // Intentional
+ ],
+ });
+ mocha.checkLeaks();