feat(cypress): add configs for not overriding screenshots (#5524)

This commit is contained in:
Pa1NarK
2024-08-07 14:00:29 +05:30
committed by GitHub
parent a8ba21c1d1
commit 52154cbbe2
3 changed files with 23 additions and 0 deletions

View File

@ -21,4 +21,5 @@ module.exports = {
chromeWebSecurity: false,
defaultCommandTimeout: 10000,
pageLoadTimeout: 20000,
trashAssetsBeforeRuns: false,
};

View File

@ -15,6 +15,7 @@
// Import commands.js using ES2015 syntax:
import "./commands";
import "./screenshotConfigs";
// Alternatively you can use CommonJS syntax:
// require('./commands')

View File

@ -0,0 +1,21 @@
Cypress.Screenshot.defaults({
blackout: [".secret-info", "[data-hide=true]"],
capture: "runner",
overwrite: false,
onBeforeScreenshot($el) {
const $clock = $el.find(".clock");
if ($clock) {
$clock.hide();
}
},
onAfterScreenshot($el, props) {
const $clock = $el.find(".clock");
if ($clock) {
$clock.show();
}
},
});