Skip to content

Commit 93720d9

Browse files
authored
chore: add a playwright setup action (#155)
1 parent 61450a2 commit 93720d9

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Setup Playwright
2+
description: UDS Playwright Setup
3+
4+
inputs:
5+
testDir:
6+
description: The directory that contains the playwright tests
7+
default: tests
8+
9+
runs:
10+
using: composite
11+
steps:
12+
- name: Get installed Playwright version
13+
id: playwright-version
14+
run: echo "PLAYWRIGHT_VERSION=$(node -e "console.log(require('./package-lock.json').packages['node_modules/@playwright/test'].version)")" >> $GITHUB_ENV
15+
working-directory: ./${{ inputs.testDir }}
16+
shell: bash
17+
18+
- name: Cache playwright binaries
19+
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
20+
id: playwright-cache
21+
with:
22+
path: |
23+
~/.cache/ms-playwright
24+
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}
25+
26+
- name: Install npm packages
27+
run: npm ci
28+
working-directory: ./${{ inputs.testDir }}
29+
shell: bash
30+
31+
- name: Install playwright (and its dependencies) if needed
32+
run: npx playwright install --with-deps
33+
if: steps.playwright-cache.outputs.cache-hit != 'true'
34+
working-directory: ./${{ inputs.testDir }}
35+
shell: bash

0 commit comments

Comments
 (0)