jest-puppeteer icon indicating copy to clipboard operation
jest-puppeteer copied to clipboard

Visual regression? `expect(page).toMatchScreenshot()`?

Open FezVrasta opened this issue 5 years ago • 7 comments

🚀 Feature Proposal

I't be great to have a toMatchSnapshot() like API for visual regression tests.

Motivation

There are cases where visual regression is very useful.

Example

await expect(page).toMatchScreenshot();

Pitch

It belongs to jest-puppeteer because it's a Jest-like API to take advantage of a Puppeteer feature.

FezVrasta avatar Jun 12 '19 17:06 FezVrasta

Yeah it would be great, but we have to couple it to a services. Storing screenshots in the repository is not always a good solution. Also flakiness could be very problematic. It is better to rely on a third party service like Argos.

gregberge avatar Jun 17 '19 09:06 gregberge

I think it would make sense to just let it store the screenshots locally, then they can be uploaded/downloaded by the consumer the way they prefer.

FezVrasta avatar Jun 17 '19 11:06 FezVrasta

If it is like that, it is just screenshot and it is already possible using Puppeteer isn't it?

gregberge avatar Jun 17 '19 21:06 gregberge

You can take screenshots but there is no logic in place do perform the comparison

FezVrasta avatar Jun 18 '19 04:06 FezVrasta

Yeah but to compare we have to access previous screenshots 😅

gregberge avatar Jun 18 '19 13:06 gregberge

Yeah I'm just proposing to leave the screenshots in the filesystem/git, and let the user do whatever they want with them.

One could have a workflow like the following:

  1. download screenshots from S3
  2. put screenshots in right folder
  3. run tests
  4. update screenshots
  5. upload screenshots to S3

FezVrasta avatar Jun 18 '19 13:06 FezVrasta

Use this guys!

https://github.com/americanexpress/jest-image-snapshot

rodoabad avatar Jun 22 '19 14:06 rodoabad