Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

fix(ssim-cie94): increase SSIM window radius (#19343)

Andrey Lushnikov6139b432fd40
diff --git a/packages/playwright-core/src/image_tools/compare.ts b/packages/playwright-core/src/image_tools/compare.ts
index 2748d5a91c..4b79d36eb0 100644
--- a/packages/playwright-core/src/image_tools/compare.ts
+++ b/packages/playwright-core/src/image_tools/compare.ts
@@ -18,7 +18,7 @@ import { blendWithWhite, colorDeltaE94, rgb2gray } from './colorUtils';
import { ImageChannel } from './imageChannel';
import { ssim, FastStats } from './stats';
-const SSIM_WINDOW_RADIUS = 5;
+const SSIM_WINDOW_RADIUS = 15;
const VARIANCE_WINDOW_RADIUS = 1;
function drawPixel(width: number, data: Buffer, x: number, y: number, r: number, g: number, b: number) {
diff --git a/tests/image_tools/fixtures/should-match/webkit-rendering-artifacts/README.md b/tests/image_tools/fixtures/should-match/webkit-rendering-artifacts/README.md
new file mode 100644
index 0000000000..864638a9b1
--- /dev/null
+++ b/tests/image_tools/fixtures/should-match/webkit-rendering-artifacts/README.md
@@ -0,0 +1,2 @@
+A set of examples with rendering artifacts that happen when running Playwright
+screenshot tests on WebKit linux.
diff --git a/tests/image_tools/fixtures/should-match/webkit-rendering-artifacts/webkit-corner-pixel-actual.png b/tests/image_tools/fixtures/should-match/webkit-rendering-artifacts/webkit-corner-pixel-actual.png
new file mode 100644
index 0000000000..eae4aeb66e
Binary files /dev/null and b/tests/image_tools/fixtures/should-match/webkit-rendering-artifacts/webkit-corner-pixel-actual.png differ
diff --git a/tests/image_tools/fixtures/should-match/webkit-rendering-artifacts/webkit-corner-pixel-expected.png b/tests/image_tools/fixtures/should-match/webkit-rendering-artifacts/webkit-corner-pixel-expected.png
new file mode 100644
index 0000000000..ee469a947b
Binary files /dev/null and b/tests/image_tools/fixtures/should-match/webkit-rendering-artifacts/webkit-corner-pixel-expected.png differ
diff --git a/tests/image_tools/fixtures/should-match/webkit-rendering-artifacts/webkit-four-pixels-actual.png b/tests/image_tools/fixtures/should-match/webkit-rendering-artifacts/webkit-four-pixels-actual.png
new file mode 100644
index 0000000000..08d2831a89
Binary files /dev/null and b/tests/image_tools/fixtures/should-match/webkit-rendering-artifacts/webkit-four-pixels-actual.png differ
diff --git a/tests/image_tools/fixtures/should-match/webkit-rendering-artifacts/webkit-four-pixels-expected.png b/tests/image_tools/fixtures/should-match/webkit-rendering-artifacts/webkit-four-pixels-expected.png
new file mode 100644
index 0000000000..2c2af04401
Binary files /dev/null and b/tests/image_tools/fixtures/should-match/webkit-rendering-artifacts/webkit-four-pixels-expected.png differ
diff --git a/tests/image_tools/fixtures/should-match/webkit-rendering-artifacts/webkit-pixel-actual.png b/tests/image_tools/fixtures/should-match/webkit-rendering-artifacts/webkit-pixel-actual.png
new file mode 100644
index 0000000000..4bfd39f4b3
Binary files /dev/null and b/tests/image_tools/fixtures/should-match/webkit-rendering-artifacts/webkit-pixel-actual.png differ
diff --git a/tests/image_tools/fixtures/should-match/webkit-rendering-artifacts/webkit-pixel-expected.png b/tests/image_tools/fixtures/should-match/webkit-rendering-artifacts/webkit-pixel-expected.png
new file mode 100644
index 0000000000..2c2af04401
Binary files /dev/null and b/tests/image_tools/fixtures/should-match/webkit-rendering-artifacts/webkit-pixel-expected.png differ