cypress-image-snapshot icon indicating copy to clipboard operation
cypress-image-snapshot copied to clipboard

empty folder is added at the screenshotsFolder path

Open maximegheraille opened this issue 2 years ago • 3 comments

Hi,

I do have a weird issue when taking screenshots, where I get a random folder with my test file name + extension created which is empty. As an example, this gets generated from the matchImageSnapshot function. /reports/mochareports/snapshot/brand/env/TestFileName/actualSnapshotName.png

But I also get this folder which is always empty /reports/mochareports/snapshot/brand/TestFileName.ts

This is my current config

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

My cypress config contains screenshotsFolder: 'cypress/reports/mochareports/snapshots'

maximegheraille avatar Oct 22 '23 18:10 maximegheraille

Yeah, I've seen that as well. I think it's because the screenshots get put there first before the plugin can move them but I'm not totally sure. Perhaps they can be cleaned up. I tend to gitignore them at the moment

simonsmith avatar Oct 23 '23 11:10 simonsmith

indeed, might be an idea to add an option to delete that folder which is defined in the cypress config when the plugin runs. Otherwise I guess I will go with a .gitignore rule

maximegheraille avatar Oct 30 '23 14:10 maximegheraille

I'll take a look at this, but for now the .gitignore workaround is probably best

simonsmith avatar Oct 30 '23 16:10 simonsmith