wisemapping-frontend/packages/webapp/cypress/support/commands.ts

20 lines
567 B
TypeScript
Raw Permalink Normal View History

import { addMatchImageSnapshotCommand } from 'cypress-image-snapshot/command';
import '@testing-library/cypress/add-commands';
// make matchImageSnapshot() call the real implementation only if CYPRESS_imageSnaphots is set
// otherwise it calls a noop
if (Cypress.env('imageSnaphots')) {
2022-07-13 03:45:36 +02:00
addMatchImageSnapshotCommand({
failureThreshold: 0.001,
failureThresholdType: 'percent',
});
} else {
2022-07-13 03:45:36 +02:00
Cypress.Commands.add(
'matchImageSnapshot',
{
prevSubject: ['optional', 'element', 'window', 'document'],
},
() => Promise.resolve(),
);
}