
How to add visual regression testing to Playwright
How to add visual regression testing to Playwright Playwright's built-in toHaveScreenshot() breaks in CI constantly — different OS, different fonts, sub-pixel anti-aliasing differences between your Mac and the Linux runner. Percy and Applitools fix the flakiness but charge $400+/month before you hit any meaningful scale. There's a third option: screenshot every test via a hosted browser API, and do the diff yourself. Why API screenshots are more consistent than local browser screenshots When you run page.screenshot() in Playwright, the rendering happens on whatever machine runs the test: your MacBook, a GitHub Actions Ubuntu runner, or a colleague's Windows laptop. Even with the same Playwright version, you get different results because: Font rendering differs between operating systems (macOS uses sub-pixel antialiasing, Linux does not by default) GPU compositing varies by hardware and driver version System font fallbacks differ when a custom font fails to load PageBolt screenshots alw
Continue reading on Dev.to Webdev
Opens in a new tab




