Skip to content

Commit

Permalink
test: Fix Windows screenshots
Browse files Browse the repository at this point in the history
Since upgrading to Chromium-based Edge, some slight rendering changes
have thrown off our screenshots.  In some, the shade of green in the
background has changed slightly.

This slightly increases the threshold for detecting individual pixel
changes, so that most of these tiny shade changes now pass.

In one other case, a change in the outline of the green-on-blue test
required an actual screenshot update for both Chrome and Edge on
Windows.

Change-Id: I413f927e3d3a00b8369600808392c6b05a185d54
  • Loading branch information
joeyparrish committed Jan 25, 2021
1 parent 9b31dd6 commit 852a11d
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build/pixelsChanged.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const Jimp = require('jimp');
async function main(oldPath, newPath) {
const oldImage = await Jimp.read(oldPath);
const newImage = await Jimp.read(newPath);
const diff = Jimp.diff(oldImage, newImage, /* threshold= */ 0);
const diff = Jimp.diff(oldImage, newImage, /* threshold= */ 0.07);
// "percent" is, surprisingly, a number between 0 and 1, not between 0 and
// 100. Convert this to a number of pixels.
const pixelsChanged =
Expand Down
2 changes: 1 addition & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ function WebDriverScreenshotMiddlewareFactory(launcher) {
// browser can cause failures even when a human can't see the difference,
// and setting it too high means human-noticeable changes could go
// undetected by a test.
const diff = Jimp.diff(oldScreenshot, newScreenshot, /* threshold= */ 0.05);
const diff = Jimp.diff(oldScreenshot, newScreenshot, /* threshold= */ 0.07);

// Write the diff to disk. This is used to review when there are changes.
fs.writeFileSync(
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 852a11d

Please sign in to comment.