File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -152,12 +152,12 @@ jobs:
152152 CYPRESS_PROJECT_ID : ${{ steps.secrets.outputs.CYPRESS_CLOUD_PROJECT_ID }}
153153 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
154154 - name : " Move cypress videos"
155- if : ${{ github.ref != 'refs/heads/master' }} # useless on master bc Cypress Cloud
155+ if : always() && failure() && github.ref != 'refs/heads/master' # useless on master bc Cypress Cloud
156156 run : |
157157 mkdir -p cypress/videos/${{ github.ref }}/${{ github.sha }} && \
158158 mv cypress/videos/*.mp4 cypress/videos/${{ github.ref }}/${{ github.sha }}/
159159 - name : " Archive E2E results"
160- if : ${{ github.ref != 'refs/heads/master' }} # useless on master bc Cypress Cloud
160+ if : always() && failure() && github.ref != 'refs/heads/master' # useless on master bc Cypress Cloud
161161 uses : google-github-actions/upload-cloud-storage@v2
162162 with :
163163 path : " pro/cypress/videos"
Original file line number Diff line number Diff line change 11import { defineConfig } from 'cypress'
22import cypressFailFast = require( 'cypress-fail-fast/plugin' )
3+ import fs from 'fs'
34
45// ts-unused-exports:disable-next-line
56export default defineConfig ( {
67 e2e : {
78 setupNodeEvents ( on , config ) {
89 cypressFailFast ( on , config )
10+ on (
11+ 'after:spec' ,
12+ ( spec : Cypress . Spec , results : CypressCommandLine . RunResult ) => {
13+ if ( results && results . video ) {
14+ // Do we have failures for any retry attempts?
15+ const failures = results . tests . some ( ( test ) =>
16+ test . attempts . some ( ( attempt ) => attempt . state === 'failed' )
17+ )
18+ if ( ! failures ) {
19+ // delete the video if the spec passed and no tests retried
20+ fs . unlinkSync ( results . video )
21+ }
22+ }
23+ }
24+ )
925 // Make sure to return the config object as it might have been modified by the plugin.
1026 return config
1127 } ,
You can’t perform that action at this time.
0 commit comments