americanexpress / jest-image-snapshot

✨ Jest matcher for image comparisons. Most commonly used for visual regression testing.
Apache License 2.0
3.81k stars 197 forks source link

Screenshot name for received image #304

Open mostor-v opened 1 year ago

mostor-v commented 1 year ago

While starting test (without screenshot) it generates screenshot with name like "suite_test_number", but failed screenshot generates with name "suite_test_number-received" How can I have same names for both files?

10xLaCroixDrinker commented 1 year ago

If you want to update the snapshots, you use the --update flag.

mostor-v commented 1 year ago

If you want to update the snapshots, you use the --update flag.

But we can't use this flag on CI

10xLaCroixDrinker commented 1 year ago

Yes, you should not overwrite the snapshots in your CI.

mostor-v commented 1 year ago

Yes, you should not overwrite the snapshots in your CI.

So I need to have received(after fail) and generated screenshots with same name, how can I achieve this ? Bcoz as i see received ( generated after fail) screenshots has "-received" ending

10xLaCroixDrinker commented 1 year ago

If the received image has the same name it will overwrite the snapshot.

mostor-v commented 1 year ago

If the received image has the same name it will overwrite the snapshot.

Yes, but i can simply put received images in another folder and then in 1 click override old screenshots with new. In current situation I need to remove "-received" ending in all files.

10xLaCroixDrinker commented 1 year ago

Can you explain your use case? I don't understand what you are trying to do or why.

mostor-v commented 1 year ago

Can you explain your use case? I don't understand what you are trying to do or why.

  1. I have about 300 screenshot tests and all expected screenshots are stored in project.
  2. All of them are running as a part of CI/CD process for each commit
  3. If in one branch 150 of screenshots are failed developer need to go to received screenshots folder, rename all screenshots (remove -received ending), put in folder with expected screenshots and override existing.

I want to avoid "rename"step. Only pick received screenshots and put them in expected screenshots folder and push it again.

reemaka commented 1 year ago

+1, I'd like to be able to store received images in a separate directory without the -received suffix so that I can easily copy over the new screenshots without having to rename everything.