Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional options for updating images #204

Open
dhulme opened this issue Dec 12, 2022 · 4 comments
Open

Additional options for updating images #204

dhulme opened this issue Dec 12, 2022 · 4 comments
Labels
enhancement New feature or request

Comments

@dhulme
Copy link
Contributor

dhulme commented Dec 12, 2022

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 dhulme added the enhancement New feature or request label Dec 12, 2022
@FRSgit
Copy link
Member

FRSgit commented Mar 26, 2023

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: #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?

@dhulme
Copy link
Contributor Author

dhulme commented May 11, 2023

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.

@FRSgit
Copy link
Member

FRSgit commented May 21, 2023

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 added a commit that referenced this issue May 21, 2023
update tests
simplify task.hook code

relates #204
github-actions bot pushed a commit that referenced this issue May 21, 2023
# [3.3.0](v3.2.15...v3.3.0) (2023-05-21)

### Bug Fixes

* **deps:** update dependency pngjs to v7 ([#215](#215)) ([af71297](af71297))

### Features

* createMissingImages option ([#222](#222)) ([2aef358](2aef358)), closes [#204](#204)
* separate versioning for images ([#221](#221)) ([b2a7434](b2a7434)), closes [#197](#197)
@FRSgit
Copy link
Member

FRSgit commented May 21, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants