Skip to content

Enable video recording and upload on failure#230

Merged
lirantal merged 2 commits intoOWASP:masterfrom
rcowsill:feature/upload-cypress-errors
Mar 6, 2023
Merged

Enable video recording and upload on failure#230
lirantal merged 2 commits intoOWASP:masterfrom
rcowsill:feature/upload-cypress-errors

Conversation

@rcowsill
Copy link
Contributor

@rcowsill rcowsill commented Feb 24, 2021

This updates the E2E test workflow to record video of the cypress tests. The videos and screenshots for any failed test cases are uploaded as build artifacts. There will be an artifact called cypress-artifacts-node<version> for each workflow job where cypress tests failed.

Here's an example workflow run where I made the learn_spec.js fail: https://github.com/rcowsill/NodeGoat/runs/1987578217

Note that this currently uploads videos for every spec rather than just the failed ones. It should be possible to exclude the videos for successful specs, but the whole set is <5MB so this is ok for now. Fixed: see below

@rcowsill rcowsill mentioned this pull request Feb 24, 2021
6 tasks
@rcowsill rcowsill marked this pull request as draft February 25, 2021 13:44
@rcowsill
Copy link
Contributor Author

rcowsill commented Feb 25, 2021

Converted to draft as I have a plan for how to only upload videos for failed specs.

Also I forgot to add the videos folder to .gitignore. Once those changes are done I'll force-push this PR branch.

Done!

I added a "Prepare cypress artifacts" step, which searches for folders under test/e2e/screenshots and moves the corresponding video there (next to the corresponding screenshot files). The next step uploads the screenshots folder. Since cypress only makes screenshots for failed tests, that means only the videos for failed tests are uploaded as artifacts.

This enables Cypress video recording (only in the E2E CI workflow).
If the Cypress test fails then videos and screenshots for the failed
spec(s) are uploaded as build artifacts
@rcowsill rcowsill force-pushed the feature/upload-cypress-errors branch from 866ccd9 to a9e3703 Compare February 26, 2021 12:46
@rcowsill rcowsill marked this pull request as ready for review February 26, 2021 12:59
@lirantal
Copy link
Collaborator

lirantal commented Mar 6, 2023

Landing it.

@lirantal lirantal merged commit cdf0f7f into OWASP:master Mar 6, 2023
@rcowsill rcowsill deleted the feature/upload-cypress-errors branch May 28, 2023 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants