From 7bcc6dac00b85e0d2053259b41edfe17286ce67c Mon Sep 17 00:00:00 2001 From: Karolina Rakoczy Date: Thu, 1 Dec 2022 10:46:59 +0100 Subject: [PATCH] Remove vidoes after cypress tests (#2729) * remove video if test passed, decrease video compression * do not compress videos * always remove videos --- cypress.config.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/cypress.config.js b/cypress.config.js index da65a33a0..dc6bdd7ed 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -1,10 +1,11 @@ /* eslint-disable @typescript-eslint/no-var-requires */ +/* eslint-disable no-console */ const { defineConfig } = require("cypress"); +const fs = require("fs"); module.exports = defineConfig({ projectId: "51ef7c", chromeWebSecurity: false, - videoUploadOnPasses: false, defaultCommandTimeout: 20000, requestTimeout: 20000, viewportWidth: 1400, @@ -20,6 +21,17 @@ module.exports = defineConfig({ setupNodeEvents(on, config) { config = require("./cypress/support/cypress-grep/plugin")(config); config = require("./cypress/plugins/index.js")(on, config); + on("after:spec", (spec, results) => { + if (results && results.video) { + return fs.unlink(results.video, function(err) { + if (err) { + console.warn(`Could not remove video - ${err}`); + } else { + console.log("File removed:", results.video); + } + }); + } + }); return config; }, baseUrl: "http://localhost:9000/",