ci: skip videos for successful tests (#25083)

* ci: skip videos for successful tests

Nobody will spend hours watching successful test cases. We're only interested in the failing ones, so we can save some time here.

* ci: remove outdated cypress config

"The videoUploadOnPasses configuration option was removed in Cypress version 13.0.0."
This commit is contained in:
Raffael Meyer 2024-02-27 09:28:53 +01:00 committed by GitHub
parent 0ee091a6f9
commit 2371bdadc9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,4 +1,5 @@
const { defineConfig } = require("cypress");
const fs = require("fs");
module.exports = defineConfig({
projectId: "92odwv",
@ -7,7 +8,6 @@ module.exports = defineConfig({
defaultCommandTimeout: 20000,
pageLoadTimeout: 15000,
video: true,
videoUploadOnPasses: false,
viewportHeight: 960,
viewportWidth: 1400,
retries: {
@ -18,6 +18,19 @@ module.exports = defineConfig({
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
// Delete videos for specs without failing or retried tests
// https://docs.cypress.io/guides/guides/screenshots-and-videos#Delete-videos-for-specs-without-failing-or-retried-tests
on("after:spec", (spec, results) => {
if (results && results.video) {
const failures = results.tests.some((test) =>
test.attempts.some((attempt) => attempt.state === "failed")
);
if (!failures) {
fs.unlinkSync(results.video);
}
}
});
return require("./cypress/plugins/index.js")(on, config);
},
testIsolation: false,