diff --git a/e2e/cypress.config.js b/e2e/cypress.config.js index da53853..b5bf459 100644 --- a/e2e/cypress.config.js +++ b/e2e/cypress.config.js @@ -1,12 +1,24 @@ const { defineConfig } = require('cypress') +const fs = require('fs') module.exports = defineConfig({ e2e: { setupNodeEvents(on, config) { - return config + on('after:spec', (spec, results) => { + if (results && results.video) { + // Do we have failures for any retry attempts? + const failures = results.tests.some((test) => + test.attempts.some((attempt) => attempt.state === 'failed') + ) + if (!failures) { + // delete the video if the spec passed and no tests retried + fs.unlinkSync(results.video) + } + } + }) }, baseUrl: 'http://localhost:4173/?path=', - videoUploadOnPasses: false, + video: true, experimentalFetchPolyfill: true, chromeWebSecurity: false, env: {