NodeGoat icon indicating copy to clipboard operation
NodeGoat copied to clipboard

Enable video recording and upload on failure

Open rcowsill opened this issue 3 years ago • 1 comments

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 avatar Feb 24 '21 16:02 rcowsill

~~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.

rcowsill avatar Feb 25 '21 13:02 rcowsill

Landing it.

lirantal avatar Mar 06 '23 10:03 lirantal