Skip to content
Snippets Groups Projects
Commit 93ca3ae2 authored by OZGCloud's avatar OZGCloud
Browse files

E2E delete recorded video if spec passed

parent 33d92029
No related branches found
No related tags found
No related merge requests found
......@@ -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);
},
},
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment