-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(integration): blur screenshots before comparison
I've spent quite a while trying various options to reduce the number of failures due to antialiasing differences, without success. This takes a bit more of an extreme option to blur the screenshot slightly to try and normalise it. The goal of the test isn't pixel-precision, so this should be ok. Ideally, this will be a feature in Playwright (so the reference image doesn't have to be blurred too). Refs #388, microsoft/playwright#7548
- Loading branch information
1 parent
39fa33b
commit d36ae9d
Showing
7 changed files
with
54 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,12 @@ | ||
{ | ||
"private": true, | ||
"dependencies": { | ||
"@playwright/test": "^1.13.0" | ||
"@playwright/test": "^1.13.0", | ||
"glur": "^1.1.2", | ||
"pngjs": "^6.0.0" | ||
}, | ||
"devDependencies": { | ||
"@types/glur": "^1.1.1", | ||
"@types/pngjs": "^6.0.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
integration/src/home.spec.ts-snapshots/home-Desktop-Chrome-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions
4
integration/src/home.spec.ts-snapshots/home-iPhone-11-linux.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import glur from 'glur'; | ||
import { PNG } from 'pngjs'; | ||
|
||
export function blur(image: Buffer): Buffer { | ||
const png = PNG.sync.read(image); | ||
|
||
glur(png.data, png.width, png.height, 5); | ||
|
||
return PNG.sync.write(png, { filterType: 4 }); | ||
} |