diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index 83bab36..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 @@ -31,17 +33,28 @@ 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 # 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: 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' });