[Feature] a toMatchScreenshot() for comparing two different screenshots
See original GitHub issueWe currently have expect(screenshot).toMatchSnapshot(name[, options])
which is nice when comparing against at snapshot but it doesn’t work when comparing a screenshot against a reference website which is useful for doing visual regression to see what has changed. I propose that we add a toMatchScreenshot(screenshot[, options])
that could be used for something like this:
page.goto("production.example.com")
const ref = await page.screenshot({
animations: "disabled",
fullPage: true,
scale: "css"
});
page.goto("localhost:8080")
const test = await page.screenshot({
animations: "disabled",
fullPage: true,
scale: "css"
});
expect(test, "should match reference").toMatchScreenshot(ref, {
maxDiffPixelRatio: 0,
maxDiffPixels: 0,
threshold: 0
});
Issue Analytics
- State:
- Created 10 months ago
- Reactions:6
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Playwright Visual Comparisons | Playwright part - 28 - YouTube
The visual comparison is really a great feature.Playwright Test includes the ability to produce and visually compare screenshots using ...
Read more >how to implement comparing two screenshots in one test ...
You can do something like this: test('compare screenshots', async ({ page }, testInfo)=>{ await page.goto(pageUrl); const screenshotTarget ...
Read more >Snapshot Testing
A typical snapshot test case renders a UI component, takes a snapshot, then compares it to a reference snapshot file stored alongside the...
Read more >Everything you need to know about Visual Regression Testing ...
It's easy to compare two images pixel by pixel but the trouble is that ... With PlayWright, there's a page.screenshot() API right out...
Read more >Snapshot | Guide
The test will fail if the two snapshots do not match: either the change is ... To snapshot a value, you can use...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@NikkTod no, it’s not coming to 1.29. Will be moved to 1.30 instead
@ambiguous48 Yes, so far I think that
toMatchImage()
could support both buffers and file paths.