diff --git a/alfa-client/apps/alfa-e2e/cypress.config.ts b/alfa-client/apps/alfa-e2e/cypress.config.ts index 21267ba661f94feac50bcb67f0d4beeee16b0c69..8b9ae40a5011b68aaa5f640053f7754911ddd5a0 100644 --- a/alfa-client/apps/alfa-e2e/cypress.config.ts +++ b/alfa-client/apps/alfa-e2e/cypress.config.ts @@ -10,9 +10,18 @@ export default defineConfig({ ...nxE2EPreset(__dirname), ...cypressConfig, setupNodeEvents(on, config) { + on('after:spec', (spec: Cypress.Spec, results: CypressCommandLine.RunResult) => { + if (results && results.video) { + const failures = results.tests.some((test) => + test.attempts.some((attempt) => attempt.state === 'failed'), + ); + if (!failures) { + fs.unlinkSync(results.video); + } + } + }); return cypressEvents(on, config); }, - videoUploadOnPasses: false, }, retries: { experimentalStrategy: 'detect-flake-and-pass-on-threshold',