Commit Graph

7 Commits

Author SHA1 Message Date
Max Schmitt
0a49c3dbb9
chore: bump @babel dependencies (#27632)
This fixes:

```
Run npm audit --omit dev
# npm audit report

@babel/traverse  <7.23.2
Severity: critical
Babel vulnerable to arbitrary code execution when compiling specifically crafted malicious code - https://github.com/advisories/GHSA-[6](https://github.com/microsoft/playwright/actions/runs/6535308689/job/17744452034?pr=27631#step:10:7)[7](https://github.com/microsoft/playwright/actions/runs/6535308689/job/17744452034?pr=27631#step:10:8)hx-6x53-jw[9](https://github.com/microsoft/playwright/actions/runs/6535308689/job/17744452034?pr=27631#step:10:10)2
fix available via `npm audit fix`
node_modules/@babel/traverse

1 critical severity vulnerability

To address all issues, run:
  npm audit fix
Error: Process completed with exit code 1.
```
2023-10-17 20:52:41 +02:00
Andrey Lushnikov
d307c8e63a
fix(ssim-cie94): make sure a single off pixel yields diff in comparator (#24348)
This patch brings in antialiasing tests from `looks-same` project for
our experimental `ssim-cie94` comparator.

One of the new tests found a bug in our implementation.

References https://github.com/microsoft/playwright/issues/24312
2023-07-21 12:27:52 -07:00
Max Schmitt
3c2a8fa306
chore: enable no-floating-promises ESLint rule for tests (#23376)
https://github.com/microsoft/playwright/issues/23339
2023-06-02 21:59:12 +02:00
chimurai
f72d400952
chore: fix typos (#20473) 2023-01-30 09:53:28 +01:00
Andrey Lushnikov
526bc3f252
fix(ssim-cie94): further tune SSIM-CIE94 to fight wk artifacts (#19370)
This patch adds a grid border around the image so that the SSIM
resolution doesn't drop for the border pixels.

We also add a test with WebKit rendering artifacts to make sure
new approach helps to fight this.
2022-12-08 16:08:41 -08:00
Andrey Lushnikov
6139b432fd
fix(ssim-cie94): increase SSIM window radius (#19343)
While migrating Playwright tests from pixelmatch comparator to the
ssim-cie94 comparator, we noticed a rendering artifact that happens
on playwright screenshot tests on WebKit Linux.

This PR adds a set of cropped-down examples and tunes the ssim-cie94
comparator to accept these rendering artifacts.
2022-12-07 16:25:16 -08:00
Andrey Lushnikov
6d82460a02
feat: implement a new image comparison function (#19166)
This patch implements a new image comparison function, codenamed
"ssim-cie94". The goal of the new comparison function is to cancel out
browser non-determenistic rendering.

To use the new comparison function:

```ts
await expect(page).toHaveScreenshot({
  comparator: 'ssim-cie94',
});
```

As of Nov 30, 2022, we identified the following sources of
non-determenistic rendering for Chromium:
- Anti-aliasing for certain shapes might be different due to the
  way skia rasterizes certain shapes.
- Color blending might be different on `x86` and `aarch64`
architectures.

The new function employs a few heuristics to fight these
differences.

Consider two non-equal image pixels `(r1, g1, b1)` and `(r2, g2, b2)`:
1. If the [CIE94] metric is less then 1.0, then we consider these pixels
   **EQUAL**. (The value `1.0` is the [just-noticeable difference] for
   [CIE94].). Otherwise, proceed to next step.
1. If all the 8 neighbors of the first pixel match its color, or
   if the 8 neighbors of the second pixel match its color, then these
   pixels are **DIFFERENT**. (In case of anti-aliasing, some of the
   direct neighbors have to be blended up or down.) Otherwise, proceed
   to next step.
1. If SSIM in some locality around the different pixels is more than
   0.99, then consider this pixels to be **EQUAL**. Otherwise, mark them
   as **DIFFERENT**. (Local SSIM for anti-aliased pixels turns out to be
   very close to 1.0).

[CIE94]: https://en.wikipedia.org/wiki/Color_difference#CIE94
[just-noticeable difference]:
https://en.wikipedia.org/wiki/Just-noticeable_difference
2022-12-02 15:22:05 -08:00