simonsmith/cypress-image-snapshot

snapFilenameExtension breaks snapshot comparison

maximegheraille opened this issue · 3 comments

Hi,

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

these are the issues it creates

  • does not fail the test if the snapshot is different
  • it modifies the original snapshot

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 snapFilenameExtension and add the .snap on each snapshot and then everything works fine.

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

Hi @simonsmith

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

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