toHaveScreenshot()import { test, expect } from "@playwright/test";test("landing page visual comparison", async ({ page }) => {
await page.goto("https://targetqa.com");
await expect(page).toHaveScreenshot("landing.png", {
mask: [page.getByTestId("live-clock")],
maxDiffPixelRatio: 0.02,
});
});
Update baselines when UI intentionally changes:
npx playwright test --update-snapshots