Skip to content

Commit 490e522

Browse files
authored
[28] Fix flaky Playwright image snapshot tests (#29)
* use maxDiffPixelRatio * not needed in base playwright, follow pattern of augmentation
1 parent 5593895 commit 490e522

9 files changed

Lines changed: 141 additions & 207 deletions

File tree

examples/serve/docs/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.2.5] - 2025-07-14
9+
10+
### Fixed
11+
12+
- set playwright image snapshot [max pixel difference ratio](https://playwright.dev/docs/api/class-pageassertions#page-assertions-to-have-screenshot-1-option-max-diff-pixel-ratio) to 0.05, to mitigate flaky false-negatives with Linux Chromium updates
13+
- removed false negatives when tests are run on event days
14+
815
## [0.2.4] - 2025-05-16
916

1017
### Fixed

examples/serve/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "web-toggle-point-serve-example",
3-
"version": "0.2.4",
3+
"version": "0.2.5",
44
"type": "module",
55
"private": true,
66
"scripts": {

examples/serve/playwright.config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ import baseConfig from "../../test/automation/base.config";
33

44
const config: PlaywrightTestConfig = {
55
...baseConfig,
6+
expect:{
7+
toMatchSnapshot: {
8+
maxDiffPixelRatio: 0.05
9+
}
10+
},
611
testDir: "./src/fixtures",
712
use: {
813
baseURL: "http://localhost:3001/"

examples/serve/src/fixtures/event/playwright.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { test, expect } from "@playwright/test";
33
test.describe("date-specific content", () => {
44
test.describe("when visiting on an un-toggled date", () => {
55
test("it shows the control content", async ({ page }) => {
6+
await page.clock.setFixedTime(new Date(Date.UTC(2025, 1, 1)));
67
await page.goto("/");
78
expect(
89
await page.getByText("Some event-themed content").screenshot()

0 commit comments

Comments
 (0)