Skip to content

Commit 28338f5

Browse files
committed
add new workflow for playwright
1 parent 192db32 commit 28338f5

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Generate New Playwright Screenshots
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
branch:
7+
description: 'The branch to checkout and run tests on'
8+
required: true
9+
type: string
10+
testFile:
11+
description: 'Optional specific test file to run'
12+
required: false
13+
type: string
14+
15+
jobs:
16+
screenshots:
17+
runs-on: ubuntu-latest
18+
container:
19+
image: mcr.microsoft.com/playwright:v1.55.0-noble
20+
env:
21+
HOME: /root
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@v4
25+
with:
26+
ref: ${{ github.event.inputs.branch }}
27+
28+
- uses: actions/setup-node@v4
29+
with:
30+
node-version: lts/*
31+
32+
- name: Install dependencies
33+
run: npm ci
34+
35+
- name: Build storybook
36+
run: npm run storybook:build
37+
38+
- name: Install Playwright Browsers
39+
run: npx playwright install --with-deps
40+
41+
- name: Run Playwright to generate screenshots
42+
run: |
43+
if [ -n "${{ github.event.inputs.testFile }}" ]; then
44+
npx playwright test "${{ github.event.inputs.testFile }}" --update-snapshots
45+
else
46+
npx playwright test --update-snapshots
47+
fi
48+
49+
- name: Upload new screenshots
50+
uses: actions/upload-artifact@v4
51+
with:
52+
name: playwright-snapshots
53+
path: tests/**/__screenshots__/
54+
retention-days: 30

0 commit comments

Comments
 (0)