simonsmith / cypress-image-snapshot

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

snapFilenameExtension breaks snapshot comparison #48

Open maximegheraille opened 8 months ago

maximegheraille commented 8 months ago

Hi,

I configured snapFilenameExtensionto an empty string to not have the .snap for each snapshot, but it does seems to break everything.

these are the issues it creates

it does however still creates a .diff snapshot, which is normal.

this is my current config

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

I tried to remove the snapFilenameExtensionand add the .snap on each snapshot and then everything works fine.

simonsmith commented 8 months ago

Just to clarify the issue, you were aiming to not have the .snap at all?

- cypress/snapshots/someTest/takes a snapshot of the page.snap.png
+ cypress/snapshots/someTest/takes a snapshot of the page.png
maximegheraille commented 8 months ago

Hi @simonsmith

That is what I indeed want, but it seems that using the option breaks stuff

simonsmith commented 1 month ago

Just looking again at this because it might be similar to #61

There is a test here that asserts that a snapshot is created without the .snap extension. In your example above can you perhaps reduce the options down to as little as possible to see if that works?

I'm wondering if it's another option you've added that is causing a problem