From 86780ed0e933c5bca96a2e58ce25a246d244ebad Mon Sep 17 00:00:00 2001 From: Matias Arriola Date: Wed, 22 Dec 2021 12:23:42 -0300 Subject: [PATCH] Set threshold for cypress-image-snapshot --- packages/mindplot/cypress/support/commands.js | 5 ++++- packages/web2d/cypress/support/commands.js | 5 ++++- packages/webapp/cypress/support/commands.ts | 7 ++++--- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/packages/mindplot/cypress/support/commands.js b/packages/mindplot/cypress/support/commands.js index bcb624c8..85cef3a6 100644 --- a/packages/mindplot/cypress/support/commands.js +++ b/packages/mindplot/cypress/support/commands.js @@ -3,7 +3,10 @@ import { addMatchImageSnapshotCommand } from 'cypress-image-snapshot/command'; // make matchImageSnapshot() call the real implementation only if CYPRESS_imageSnaphots is set // otherwise it calls a noop if (Cypress.env('imageSnaphots')) { - addMatchImageSnapshotCommand(); + addMatchImageSnapshotCommand({ + failureThreshold: 0.001, + failureThresholdType: 'percent', + }); } else { Cypress.Commands.add( 'matchImageSnapshot', diff --git a/packages/web2d/cypress/support/commands.js b/packages/web2d/cypress/support/commands.js index cf3e92fd..77d192ad 100644 --- a/packages/web2d/cypress/support/commands.js +++ b/packages/web2d/cypress/support/commands.js @@ -3,7 +3,10 @@ import { addMatchImageSnapshotCommand } from 'cypress-image-snapshot/command'; // make matchImageSnapshot() call the real implementation only if CYPRESS_imageSnaphots is set // otherwise it calls a noop if (Cypress.env('imageSnaphots')) { - addMatchImageSnapshotCommand(); + addMatchImageSnapshotCommand({ + failureThreshold: 0.001, + failureThresholdType: 'percent', + }); } else { Cypress.Commands.add( 'matchImageSnapshot', diff --git a/packages/webapp/cypress/support/commands.ts b/packages/webapp/cypress/support/commands.ts index 5a2a7981..4f1ceb2d 100644 --- a/packages/webapp/cypress/support/commands.ts +++ b/packages/webapp/cypress/support/commands.ts @@ -1,12 +1,13 @@ import { addMatchImageSnapshotCommand } from 'cypress-image-snapshot/command'; import '@testing-library/cypress/add-commands'; -addMatchImageSnapshotCommand(); - // make matchImageSnapshot() call the real implementation only if CYPRESS_imageSnaphots is set // otherwise it calls a noop if (Cypress.env('imageSnaphots')) { - addMatchImageSnapshotCommand(); + addMatchImageSnapshotCommand({ + failureThreshold: 0.001, + failureThresholdType: 'percent', + }); } else { Cypress.Commands.add( 'matchImageSnapshot',