-
Notifications
You must be signed in to change notification settings - Fork 1
/
action.yml
62 lines (62 loc) · 2.28 KB
/
action.yml
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
name: Replay Playwright
author: Replay.io
description: Run and record Playwright tests with Replay
inputs:
working-directory:
description: "Relative path to app"
default: "."
command:
description: "Command to run tests"
default: "npx playwright test"
project:
description: "Project for replay browser"
default: "replay-chromium"
api-key:
required: true
description: "Replay.io API Key"
public:
description: "Makes the uploaded replay viewable by everyone"
default: false
upload-all:
description: "Upload all recordings instead of only recordings of failed tests"
default: false
include-summary:
description: "Display links to uploaded replays on the workflow summary page"
default: true
runs:
using: composite
steps:
- name: Install Dependencies
run: npm install --silent --prefix $GITHUB_ACTION_PATH uuid
shell: sh
- name: Generate Test Run ID
id: test-run-id
uses: actions/github-script@v7
with:
result-encoding: string
script: |
return require(require('path').join(process.env.GITHUB_ACTION_PATH, 'node_modules', 'uuid')).v4()
- name: Install @replayio/playwright if necessary
id: playwright-path
shell: sh
working-directory: ${{ inputs.working-directory }}
run: |
npm ls @replayio/playwright > /dev/null 2>&1 || ( \
npm i --silent --prefix $GITHUB_ACTION_PATH @replayio/playwright@latest && \
echo "value=$GITHUB_ACTION_PATH/@replayio/playwright" >> "$GITHUB_OUTPUT" \
)
- name: Run Tests
run: ${{ inputs.command }} --project ${{ inputs.project }} --reporter=line,${{ steps.playwright-path.value || '@replayio/playwright' }}/reporter
shell: sh
working-directory: ${{ inputs.working-directory }}
env:
RECORD_REPLAY_TEST_RUN_ID: ${{ steps.test-run-id.outputs.result }}
- name: "Upload Recordings"
id: "upload-recordings"
uses: replayio/[email protected]
if: ${{ always() }}
with:
api-key: ${{ inputs.api-key }}
public: ${{ inputs.public }}
include-summary: ${{ inputs.include-summary }}
filter: ${{ inputs.upload-all == 'true' && 'function($v) { $v.metadata.test.result }' || 'function($v) { $v.metadata.test.result = "failed" }' }}