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:
parent
0ee091a6f9
commit
2371bdadc9
1 changed files with 14 additions and 1 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
const { defineConfig } = require("cypress");
|
const { defineConfig } = require("cypress");
|
||||||
|
const fs = require("fs");
|
||||||
|
|
||||||
module.exports = defineConfig({
|
module.exports = defineConfig({
|
||||||
projectId: "92odwv",
|
projectId: "92odwv",
|
||||||
|
|
@ -7,7 +8,6 @@ module.exports = defineConfig({
|
||||||
defaultCommandTimeout: 20000,
|
defaultCommandTimeout: 20000,
|
||||||
pageLoadTimeout: 15000,
|
pageLoadTimeout: 15000,
|
||||||
video: true,
|
video: true,
|
||||||
videoUploadOnPasses: false,
|
|
||||||
viewportHeight: 960,
|
viewportHeight: 960,
|
||||||
viewportWidth: 1400,
|
viewportWidth: 1400,
|
||||||
retries: {
|
retries: {
|
||||||
|
|
@ -18,6 +18,19 @@ module.exports = defineConfig({
|
||||||
// We've imported your old cypress plugins here.
|
// We've imported your old cypress plugins here.
|
||||||
// You may want to clean this up later by importing these.
|
// You may want to clean this up later by importing these.
|
||||||
setupNodeEvents(on, config) {
|
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);
|
return require("./cypress/plugins/index.js")(on, config);
|
||||||
},
|
},
|
||||||
testIsolation: false,
|
testIsolation: false,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue