Skip to content

Commit

Permalink
Use pixelmatch for image comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
sidharthv96 committed Jan 19, 2024
1 parent 97f9919 commit cb0ee5a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
1 change: 1 addition & 0 deletions cSpell.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
"pathe",
"pbrolin",
"phpbb",
"pixelmatch",
"plantuml",
"playfair",
"pnpm",
Expand Down
22 changes: 13 additions & 9 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,16 @@

import { addMatchImageSnapshotCommand } from 'cypress-image-snapshot/command';

addMatchImageSnapshotCommand({
comparisonMethod: 'ssim',
failureThreshold: 0.01,
failureThresholdType: 'percent',
customDiffConfig: {
ssim: 'fast',
},
blur: 1,
});
// The SSIM comparison method can be used if the pixelmatch is throwing lots of false positives.
// SSIM actually does not catch minute changes in the image, so it is not as accurate as pixelmatch.
// addMatchImageSnapshotCommand({
// comparisonMethod: 'ssim',
// failureThreshold: 0.01,
// failureThresholdType: 'percent',
// customDiffConfig: {
// ssim: 'fast',
// },
// blur: 1,
// });

addMatchImageSnapshotCommand();

0 comments on commit cb0ee5a

Please sign in to comment.