cypress-plugin-visual-regression-diff icon indicating copy to clipboard operation
cypress-plugin-visual-regression-diff copied to clipboard

Additional options for updating images

Open dhulme opened this issue 3 years ago • 4 comments

Is your feature request related to a problem? Please describe. To avoid issues causes by Windows/Linux rendering, we capture all our screenshots in a separate CI job using the updateImages option. But this has two limitations:

  • Missing images are generated regardless of value of updateImages
  • All images are captured, not just those for tests that fail

Describe the solution you'd like Two news options:

  • createMissingImages - defaults to true. When false causes compariosn to fail if no 'old' image is found
  • updateImagesOnFailure - update images only when comparison fails

Describe alternatives you've considered I tried implementing updateImagesOnFailure outside the library by catching test failures then updating images, but it's a bit cumbersome and does not handle missing images how I would like.

Please could you let me know your thoughts on this?

dhulme avatar Dec 12 '22 14:12 dhulme

Hey! Sorry for some delay, I needed to focus on my day-to-day job.

I think createMissingImages option might be really useful - create a PR for it: https://github.com/FRSOURCE/cypress-plugin-visual-regression-diff/pull/222

Regarding updateImagesOnFailure - I'd say it might be better to add additional possible value to updateImages like updateImages='failures-only' as this option will be connected to updating images themselves (there is no way to update on failure if updateImages=false). What do you think?

FRSgit avatar Mar 26 '23 20:03 FRSgit

Hey, no problem! I have been delayed in replying too 😂

Thank you for creating the PR for createMissingImages, that looks good to me!

Your other suggestion sounds good, I'm working on a PR for that, will let you know when it's open.

dhulme avatar May 11 '23 08:05 dhulme

Perfect! Keep me updated about your PR! Both of these changes are non-breaking, so they can be released quite quickly - I'll try to release createMissingImages today

FRSgit avatar May 21 '23 15:05 FRSgit

Okay, createMissingImages was released in version 3.3.0 - @dhulme you can try it already if you wish!

FRSgit avatar May 21 '23 16:05 FRSgit