-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathaction.yml
70 lines (70 loc) · 2.48 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
63
64
65
66
67
68
69
70
name: Replay Cypress
author: Replay.io
description: Run and record Cypress tests with Replay
inputs:
api-Key:
required: true
description: "Replay.io API Key"
browser:
description: "Replay Browser to use"
default: Replay Firefox
command:
description: "Command to run tests"
default: npx cypress run
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
working-directory:
description: "Relative path to app"
default: "."
test-run-id:
description: "UUID used to group tests into a run"
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 --prefix $GITHUB_ACTION_PATH uuid
shell: bash
- name: Generate Test Run ID
id: test-run-id
uses: actions/github-script@v7
with:
result-encoding: string
script: |
const uuid = require(require('path').join(process.env.GITHUB_ACTION_PATH, 'node_modules', 'uuid'));
let value = "${{ inputs.test-run-id }}";
if (!uuid.validate(value)) {
console.error("test-run-id was invalid. Generating a new value.");
value = uuid.v4();
}
return value;
- name: Generate metadata file
id: metadata-file
run: echo "TMP_FILE=$(mktemp)" >> $GITHUB_OUTPUT
shell: bash
- run: ${{ inputs.command }} --browser "${{ inputs.browser }}"
shell: sh
working-directory: ${{ inputs.working-directory }}
env:
RECORD_REPLAY_DISABLE_REDUX_DEVTOOLS: 1
RECORD_REPLAY_TEST_RUN_ID: ${{ steps.test-run-id.outputs.result }}
RECORD_ALL_CONTENT: 1
RECORD_REPLAY_METADATA_FILE: ${{ steps.metadata-file.outputs.TMP_FILE }}
# TODO [ryanjduffy]: Include this later when we want to hide the command
# log in recordings.
# CYPRESS_NO_COMMAND_LOG: 1
- 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" }' }}