Skip to content

Open source, composable payments platform | PCI compliant | SaaS and Self-host options | Enables connectivity to multiple payment, payout, fraud, vault and tokenization providers | Uplifts authorization with intelligent routing and revenue recovery | Reduce payment processing costs with cost observability | Reduces payment ops with reconciliation

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

Pa1NarK52154cbbe2fa
diff --git a/cypress-tests/cypress.config.js b/cypress-tests/cypress.config.js
index e36f68e80e..2e132c74d3 100644
--- a/cypress-tests/cypress.config.js
+++ b/cypress-tests/cypress.config.js
@@ -21,4 +21,5 @@ module.exports = {
chromeWebSecurity: false,
defaultCommandTimeout: 10000,
pageLoadTimeout: 20000,
+ trashAssetsBeforeRuns: false,
};
diff --git a/cypress-tests/cypress/support/e2e.js b/cypress-tests/cypress/support/e2e.js
index 3a25224388..e3108016d8 100644
--- a/cypress-tests/cypress/support/e2e.js
+++ b/cypress-tests/cypress/support/e2e.js
@@ -15,6 +15,7 @@
// Import commands.js using ES2015 syntax:
import "./commands";
+import "./screenshotConfigs";
// Alternatively you can use CommonJS syntax:
// require('./commands')
diff --git a/cypress-tests/cypress/support/screenshotConfigs.js b/cypress-tests/cypress/support/screenshotConfigs.js
new file mode 100644
index 0000000000..a9f790c0b7
--- /dev/null
+++ b/cypress-tests/cypress/support/screenshotConfigs.js
@@ -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();
+ }
+ },
+});