Use pixelmatch for image comparison

This commit is contained in:
Sidharth Vinod
2024-01-19 13:17:14 +05:30
parent 97f9919250
commit cb0ee5aa41
2 changed files with 14 additions and 9 deletions

View File

@@ -102,6 +102,7 @@
"pathe", "pathe",
"pbrolin", "pbrolin",
"phpbb", "phpbb",
"pixelmatch",
"plantuml", "plantuml",
"playfair", "playfair",
"pnpm", "pnpm",

View File

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