From 46871fde01f88f00402423a100840f04c3494484 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roger=20Boixader=20G=C3=BCell?= Date: Sun, 17 Dec 2023 22:05:22 +0100 Subject: [PATCH] chore: cypress config --- e2e/cypress.config.js | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) 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: {