Skip to content

Commit

Permalink
[cypress-tools]: cypress plugin snapshot added
Browse files Browse the repository at this point in the history
  • Loading branch information
Yaroslav committed Apr 20, 2022
1 parent 5fa8acb commit 6258b6c
Show file tree
Hide file tree
Showing 4 changed files with 285 additions and 0 deletions.
4 changes: 4 additions & 0 deletions cypress-tools/plugins/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
const injectDevServer = require('@cypress/react/plugins/react-scripts');
const {
addMatchImageSnapshotPlugin,
} = require('cypress-image-snapshot/plugin');

module.exports = (on, config) => {
addMatchImageSnapshotPlugin(on, config);
injectDevServer(on, config);

return config;
Expand Down
7 changes: 7 additions & 0 deletions cypress-tools/support/commands.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
import { addMatchImageSnapshotCommand } from 'cypress-image-snapshot/command';

Cypress.Commands.add('getByDataCy', (selector) => {
cy.get(`[data-cy="${selector}"]`);
});

addMatchImageSnapshotCommand({
failureThreshold: 3.0,
failureThresholdType: 'percent'
});
273 changes: 273 additions & 0 deletions mate-scripts/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions mate-scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"@types/jest": "^26.0.20",
"@types/node": "^14.14.35",
"@types/sinon": "^9.0.10",
"cypress-image-snapshot": "^4.0.1",
"jest": "^26.6.3",
"jest-sinon": "^1.0.4",
"react-scripts": "4.0.3",
Expand Down

0 comments on commit 6258b6c

Please sign in to comment.