Skip to content

Commit 2cbddde

Browse files
Wrote GitHub Actions workflow
1 parent 3357553 commit 2cbddde

2 files changed

Lines changed: 59 additions & 1 deletion

File tree

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Run Playwright Tests
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
workflow_dispatch:
8+
9+
jobs:
10+
playwright:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- uses: actions/setup-node@v4
19+
with:
20+
node-version: lts/*
21+
22+
- name: Cache node modules
23+
uses: actions/cache@v4
24+
with:
25+
path: node_modules
26+
key: node-${{ hashFiles('package-lock.json') }}
27+
28+
- name: Cache Playwright browsers
29+
uses: actions/cache@v4
30+
with:
31+
path: ~/.cache/ms-playwright
32+
key: playwright-${{ hashFiles('package-lock.json') }}
33+
34+
- name: Install dependencies
35+
run: npm ci
36+
37+
- name: Install Playwright browsers
38+
run: npx playwright install --with-deps
39+
40+
- name: Run Playwright tests
41+
run: npm test
42+
43+
- name: Upload Playwright HTML report
44+
if: always()
45+
uses: actions/upload-artifact@v4
46+
with:
47+
name: playwright-report
48+
path: playwright-report/
49+
retention-days: 14
50+
51+
- name: Upload Playwright test results
52+
if: always()
53+
uses: actions/upload-artifact@v4
54+
with:
55+
name: playwright-test-results
56+
path: test-results/
57+
if-no-files-found: ignore
58+
retention-days: 14

playwright.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default defineConfig({
2323
/* Opt out of parallel tests on CI. */
2424
workers: process.env.CI ? 1 : undefined,
2525
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
26-
reporter: 'list',
26+
reporter: process.env.CI ? [['list'], ['html']] : 'list',
2727
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
2828
use: {
2929
/* Base URL to use in actions like `await page.goto('')`. */

0 commit comments

Comments
 (0)