[Feature] implement `await expect(page).toHaveScreenshot()`
See original GitHub issueintroduce a web-first assertion for Visual regression testing.
Today:
expect(await page.screenshot()).toMatchSnapshot('foo.png');
After this:
await expect(page).toHaveScreenshot('foo.png');
toHaveScreenshot
should auto-retry screenshot until golden is reached.
toHaveScreenshot
should also have:
- hide field cursor
- support locators
- ~disalbe css animations~ — https://github.com/microsoft/playwright/issues/11912
- ~mask out certain parts of screen? e.g. with selector~ — https://github.com/microsoft/playwright/issues/11913
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:16 (10 by maintainers)
Top Results From Across the Web
How should I be using playwright's toHaveScreenshot() within ...
I'm wanting to implement visual regression testing into a ReactJS app. I already have playwright setup called through cucumber for some ...
Read more >Visual regression testing with Playwright - Qxperts
await page.goto('http://localhost:3000');. await expect(page). ... The toHaveScreenshot function will compare the visual differences with an ...
Read more >Visual testing in Playwright - Reflect.run
click("text=AGREE"); // visually comparing two screenshots await expect(page).toHaveScreenshot(); });. This simple test navigates to https:// ...
Read more >Five Playwright Tips to Level Up Your Testing Game
Only run a specific test test.only() // Skip a test and mark it as ... toHaveClass(/selected/) await expect(page.locator('.my-element')).
Read more >How To Get Started With Playwright Component Testing
We can even take screenshots of our components to do some visual testing! await expect(page.locator("header>h1")).toHaveScreenshot() ...
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
toHaveScreenshot is now scheduled for 1.21 that’ll happen in ApriltoHaveScreenshot is now scheduled for 1.22 that’ll happen in May@aslushnikov here is an example of the chart that I would like to verify visually. The network is ideal while the graph is still rendering.