From 2f7ff72fd1e67c0a80e9c20b206d600e75c4e6b5 Mon Sep 17 00:00:00 2001 From: Sebastian Sdorra Date: Wed, 26 Aug 2020 08:48:43 +0200 Subject: [PATCH] Remove videos of successful runs --- scm-ui/e2e-tests/cypress.json | 3 ++- scm-ui/e2e-tests/package.json | 6 ++++-- scm-ui/e2e-tests/src/index.js | 22 ++++++++++++++++++++++ 3 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 scm-ui/e2e-tests/src/index.js diff --git a/scm-ui/e2e-tests/cypress.json b/scm-ui/e2e-tests/cypress.json index 03e8546581..fc4d8586ac 100644 --- a/scm-ui/e2e-tests/cypress.json +++ b/scm-ui/e2e-tests/cypress.json @@ -1,3 +1,4 @@ { - "baseUrl": "http://localhost:8081/scm" + "baseUrl": "http://localhost:8081/scm", + "videoUploadOnPasses": false } diff --git a/scm-ui/e2e-tests/package.json b/scm-ui/e2e-tests/package.json index f4b6898bc9..b2214d9496 100644 --- a/scm-ui/e2e-tests/package.json +++ b/scm-ui/e2e-tests/package.json @@ -8,10 +8,12 @@ "private": false, "scripts": { "headless": "cypress run", - "ci": "cypress run --reporter junit --reporter-options \"mochaFile=../target/cypress-reports/TEST-[hash].xml\"" + "ci": "node src/index.js" + }, + "dependencies": { + "cypress": "^4.12.0" }, "devDependencies": { - "cypress": "^4.12.0", "eslint-plugin-cypress": "^2.11.1" }, "prettier": "@scm-manager/prettier-config", diff --git a/scm-ui/e2e-tests/src/index.js b/scm-ui/e2e-tests/src/index.js new file mode 100644 index 0000000000..a7650f549f --- /dev/null +++ b/scm-ui/e2e-tests/src/index.js @@ -0,0 +1,22 @@ +const cypress = require("cypress"); +const fs = require("fs"); +const path = require("path"); + +const options = { + reporter: "junit", + reporterOptions: { + mochaFile: path.join("..", "target", "cypress-reports", "TEST-[hash].xml") + } +}; + +cypress + .run(options) + .then(results => { + results.runs.forEach(run => { + // remove videos of successful runs + if (!run.shouldUploadVideo) { + fs.unlinkSync(run.video); + } + }); + }) + .catch(err => console.error(err));