Closed
Description
Hi 👋🏻 Thanks for writing this plugin!
Describe the bug
When the plugin determines the percentage of changed pixels, its calculation is incorrect:
As pixelmatch
returns the number of different pixels, this line should be:
imgDiff = diffPixels / (width * height);
To Reproduce
- Create an empty 100x100
<div>
element - Capture a snapshot of that element in a Cypress test with a threshold of
0.5
. - Modify the snapshot image so that just below 50% of the pixels are different.
- Re-run the test.
- Expected behavior: Test passes.
- Actual behavior: Test fails.