From 4a705cd2a53146ea79ca20c27bffa4d33cdf9354 Mon Sep 17 00:00:00 2001 From: Robbert Gurdeep Singh Date: Fri, 30 Apr 2021 17:24:51 +0200 Subject: [PATCH] WIP: stop if too many fails --- cypress/integration/oddname.spec.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cypress/integration/oddname.spec.js b/cypress/integration/oddname.spec.js index e395b9c0c..20f3ae33b 100644 --- a/cypress/integration/oddname.spec.js +++ b/cypress/integration/oddname.spec.js @@ -44,6 +44,13 @@ function naughtyFileName(realName) { ); } + +let failsLeft = 5; +Cypress.on('fail', (error, runnable) => { + failsLeft--; + throw error // throw error to have test still fail +}) + for (let [file, type] of [ ["image1.jpg", "image/jpeg"], ["image.gif", "image/gif"], @@ -56,6 +63,7 @@ for (let [file, type] of [ ["video.ogv", "video/ogv"], ["video.webm", "video/webm"], ]) { + const placedName = naughtyFileName(file); // We'll escape all the characters in the name to match it with css @@ -82,6 +90,9 @@ for (let [file, type] of [ cy.wait(1000); cy.openFile(folderName); cy.wait(1000); + if(failsLeft < 0){ + throw new Error(`Skipped test due to too many fails`) + } }); after(function () { // no need to log out we do this in the test to check the public link