Closed malykhinvi closed 3 years ago
Latest commit: 6c288dbe4b5de39effa7d2ae7741bc1a6e451ed1
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
@jaredpalmer hi! Could you please review and let me know what do you think of this workaround? After I resolved conflicts, I noticed a message from changeset-bot. I'm wondering, who should be changing the content for changelog?
Basically, this change is a workaround for https://github.com/jaredpalmer/cypress-image-snapshot/issues/61.
Because of the existing behavior of Cypress,
cy.screenshot
in the Interactive mode puts screenshots in different subdirectories. If you run all specs the screenshot will be nested in 'All Specs' folder, whilst if you run the only spec file, the screenshot will be under the folder of a spec file name.As this plugin works on top of cypress screenshots but uses its own folder to store snapshots (basically it copy/pastes screenshots to snapshots folder), one of the possible workarounds is to modify the subdirectory of every snapshot. To make it possible, we can pass a callback to plugin options like that:
If we return an empty string from
getSpecSnapshotFolder
, that effectively means that no subdirectory needed and all snapshots will be stored in the root of the snapshots folder. Not sure, what happens with spec names collisions though...