-
Notifications
You must be signed in to change notification settings - Fork 6
75 lines (64 loc) · 3.11 KB
/
Copy pathreusable-playwright-tests.yml
File metadata and controls
75 lines (64 loc) · 3.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: Playwright
on:
workflow_call:
inputs:
webapp-artifact:
required: false
description: Name of the artifact containing the webapp bundle to test, only intended for downstream testing from element-web.
type: string
reporter:
default: html
description: The reporter to use. `html` report will be uploaded as `playwright-html-report`, `blob` report will be uploaded as `blob-report-modules`.
type: string
permissions: {}
jobs:
playwright:
name: Run Playwright end-to-end tests & upload html report
runs-on: ubuntu-24.04-arm
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
repository: ${{ inputs.webapp-artifact && 'element-hq/element-modules' || github.repository }}
- uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6
with:
cache: "yarn"
node-version: "lts/*"
- name: Install Deps
run: "yarn install --frozen-lockfile"
- name: Get installed Playwright version
id: playwright
run: echo "version=$(yarn list --pattern @playwright/test --depth=0 --json --non-interactive --no-progress | jq -r '.data.trees[].name')" >> "$GITHUB_OUTPUT"
- name: Cache playwright binaries
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5
id: playwright-cache
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-${{ runner.arch }}-playwright-${{ steps.playwright.outputs.version }}
- name: Install Playwright browsers
if: steps.playwright-cache.outputs.cache-hit != 'true'
run: yarn playwright install --with-deps --no-shell
- name: Fetch webapp
if: inputs.webapp-artifact
uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8
with:
name: ${{ inputs.webapp-artifact }}
path: webapp
- name: Run Playwright tests
run: yarn playwright test --reporter="$REPORTER"
env:
REPORTER: ${{ inputs.reporter }}
WEBAPP_PATH: ${{ inputs.webapp-artifact && './webapp' || '' }}
- name: Upload html report to GitHub Actions Artifacts
if: always() && inputs.reporter == 'html'
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7
with:
name: playwright-html-report
path: playwright-report
retention-days: 14
- name: Upload blob report to GitHub Actions Artifacts
if: always() && inputs.reporter == 'blob'
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7
with:
name: blob-report-modules
path: blob-report
retention-days: 1