diff --git a/alfa-client/apps/alfa-e2e/cypress.config.ts b/alfa-client/apps/alfa-e2e/cypress.config.ts index 8b9ae40a5011b68aaa5f640053f7754911ddd5a0..4b0131d939bd00653756bf755fe393a486217740 100644 --- a/alfa-client/apps/alfa-e2e/cypress.config.ts +++ b/alfa-client/apps/alfa-e2e/cypress.config.ts @@ -10,16 +10,6 @@ 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); }, }, diff --git a/alfa-client/apps/alfa-e2e/src/support/cypress-tasks.ts b/alfa-client/apps/alfa-e2e/src/support/cypress-tasks.ts index a82b4f736601daf7f1b3164cbb45818a609e29de..827b7b3d31d21f7c991796b5256302ae28354466 100644 --- a/alfa-client/apps/alfa-e2e/src/support/cypress-tasks.ts +++ b/alfa-client/apps/alfa-e2e/src/support/cypress-tasks.ts @@ -67,6 +67,13 @@ module.exports = (on: any, config: any) => { }, }); + on('after:spec', (spec: Cypress.Spec, results: CypressCommandLine.RunResult) => { + if (results && results.video && results.stats.failures === 0) { + console.log(`Delete recorded video because spec passed: ${results.video}`); + fs.unlinkSync(results.video); + } + }); + // Workaround für Angular 13 und Cypress mit Webpack 4, // Siehe https://github.com/cypress-io/cypress/issues/19066#issuecomment-1012055705 // Entfernen, sobald Cypress Webpack 5 nutzt - https://github.com/cypress-io/cypress/issues/19555