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

Screenshot name for received image

Open mostor-v opened this issue 1 year ago • 9 comments

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?

mostor-v avatar Aug 23 '22 15:08 mostor-v

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

10xLaCroixDrinker avatar Aug 25 '22 11:08 10xLaCroixDrinker

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

But we can't use this flag on CI

mostor-v avatar Aug 25 '22 11:08 mostor-v

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

10xLaCroixDrinker avatar Aug 25 '22 11:08 10xLaCroixDrinker

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

mostor-v avatar Aug 25 '22 11:08 mostor-v

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

10xLaCroixDrinker avatar Aug 25 '22 11:08 10xLaCroixDrinker

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.

mostor-v avatar Aug 25 '22 11:08 mostor-v

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

10xLaCroixDrinker avatar Aug 25 '22 11:08 10xLaCroixDrinker

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.

mostor-v avatar Aug 25 '22 12:08 mostor-v