From 77eb9e6788bc540a875673982526f9f00759af3a Mon Sep 17 00:00:00 2001 From: Kevin Cameron Date: Tue, 1 Dec 2026 10:50:09 -0800 Subject: [PATCH 1/2] run tests on build --- .github/workflows/static.yml | 9 +++++++++ README.md | 1 + playwright.config.ts | 10 +++++----- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index 83bab36..1d6faf5 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -31,6 +31,15 @@ jobs: - name: Install dependencies run: npm ci # install dependencies using lock file + - name: Audit dependencies + run: npm audit + + - name: Install Playwright browsers + run: npx playwright install --with-deps chromium + + - name: Run tests + run: npm test + # Build the SvelteKit project - name: Build project run: npm run build diff --git a/README.md b/README.md index 5a4ce1d..c7619c3 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,7 @@ There are automated tests using Playwright. - run this the first time, to install Playwright dependencies: `npx playwright install` - `npm run test` to run tests +- the test script will start a local web server ## Production build diff --git a/playwright.config.ts b/playwright.config.ts index e6dce8f..0339cd7 100644 --- a/playwright.config.ts +++ b/playwright.config.ts @@ -1,12 +1,12 @@ import { defineConfig } from '@playwright/test'; export default defineConfig({ - // webServer: { - // command: 'npm run build && npm run preview', - // port: 4173 - // }, + webServer: { + command: 'npm run dev -- --host 127.0.0.1', + port: 5173 + }, use: { - baseURL: "http://localhost:5173" + baseURL: "http://127.0.0.1:5173" }, testDir: 'e2e' }); From 2ccdc7c2a395614bc61a2df97acae39d77d7fd1c Mon Sep 17 00:00:00 2001 From: Kevin Cameron Date: Tue, 1 Dec 2026 10:52:12 -0800 Subject: [PATCH 2/2] run tests on PR --- .github/workflows/static.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index 1d6faf5..b418d80 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -3,6 +3,8 @@ name: Deploy SvelteKit to GitHub Pages on: push: branches: [main] + pull_request: + branches: [main] permissions: contents: read @@ -46,11 +48,13 @@ jobs: # Upload build output as artifact - uses: actions/upload-pages-artifact@v5 + if: github.event_name == 'push' with: path: ./build # SvelteKit static output folder deploy: needs: build # make the build artifact available here in deploy job + if: github.event_name == 'push' runs-on: ubuntu-latest environment: