Playwright
Microsoft's open-source tool for automating Chromium, Firefox and WebKit browsers, widely used for end-to-end and visual tests.
In more detail
await expect(page).toHaveScreenshot() captures a screenshot and compares it with a stored baseline, failing on differences beyond a tolerance such as maxDiffPixelRatio. Options can disable animations during capture.
Example
await expect(page.getByRole('button', { name: 'Submit' })).toBeVisible()Related terms
- visual regression testing — Testing that takes screenshots of components and compares them pixel by pixel with approved baseline images to catch unintended visual changes.
- maxDiffPixelRatio — A Playwright screenshot option giving the fraction of pixels, from 0 to 1, that may differ before the comparison fails.
- headless browser — A real web browser running without a visible window, controlled by a program, used for automated tests and screenshots.
- end-to-end test — A test that drives the whole system from the outside, often through a browser or public API, with every part running.
- locator — An object in a test that describes how to find an element on the page, such as “the button named Submit”.
- web-first assertion — A Playwright assertion that keeps rechecking the page until the condition is true or a timeout expires.
- network mocking — Intercepting a test’s outgoing network requests and answering them with fixed fake responses.
Taught in
- Visual Regression Testing: Playwright & Snapshot Differencing — Design Systems & Component Engineering
- End-to-End Testing with Playwright: Multi-Tier Suites — Production Full-Stack Engineering