simonsmith / cypress-image-snapshot

Catch visual regressions in Cypress with jest-image-snapshot
MIT License
64 stars 15 forks source link

Snapshots with images randomly fails on firefox #63

Closed maximegheraille closed 2 months ago

maximegheraille commented 2 months ago

Hi,

we currently have components where we have assets some text. All snapshots are taken on firefox, chrome and edge.

Both edge and chrome are always fine, but firefox keeps randomly failing them because the image seems different (which is not case).

my setting are as follows

const options: CypressImageSnapshotOptions = {
            failureThreshold: 0.01,
            allowSizeMismatch: true,
            failureThresholdType: 'percent',
            capture: 'viewport',
            comparisonMethod: 'ssim',
            customSnapshotsDir: `./cypress/reports/mochareports/snapshots/${Cypress.spec.fileName}`,
            e2eSpecDir: Cypress.spec.relative,
            snapFilenameExtension: '.snap',
};

when using just the cypress screenshot without the plugging and comparing multiples run screenshots, it works. those are never different, so something must be wrong with this package.

test1 diff test2 diff

simonsmith commented 2 months ago

The image comparison is handled by jest-image-snapshot so if you think you have a reproducible issue I'd report it there as this package simply calls it with your options

maximegheraille commented 2 months ago

Hi @simonsmith, i created a repo where the issue is reproducible. here are the steps to reproduce the issue:

  1. build the docker image
  2. run the docker image with pnpm run cypress:run
  3. check the diff folder with failed snapshots
maximegheraille commented 2 months ago

Hey @simonsmith

It would be awesome if you could have a look and create an issue in their repo if needed 😄 You are the probably the best person to explain it correctly, so they can investigate. In case you don't want I will make an issue in their repository myself