@cloudscape-design/browser-test-tools 3.0.105 → 3.0.106
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/image-utils/compare.js +5 -1
- package/internal/manifest.json +1 -1
- package/package.json +2 -2
package/image-utils/compare.js
CHANGED
|
@@ -11,6 +11,10 @@ const pngjs_1 = require("pngjs");
|
|
|
11
11
|
const pixelmatch_1 = __importDefault(require("pixelmatch"));
|
|
12
12
|
const utils_1 = require("./utils");
|
|
13
13
|
function compareImages(firstImage, secondImage, { width, height }) {
|
|
14
|
+
// This prevents an error thrown from pixelmatch when comparing 0-sized images.
|
|
15
|
+
if (width === 0 || height === 0) {
|
|
16
|
+
return { diffPixels: -1, diffImage: null };
|
|
17
|
+
}
|
|
14
18
|
// fast path when two image files are identical
|
|
15
19
|
if (firstImage.data.equals(secondImage.data)) {
|
|
16
20
|
return { diffPixels: 0, diffImage: null };
|
|
@@ -62,7 +66,7 @@ async function cropAndCompare(firstScreenshot, secondScreenshot) {
|
|
|
62
66
|
firstImage: firstPacked,
|
|
63
67
|
secondImage: secondPacked,
|
|
64
68
|
diffImage: diffPacked,
|
|
65
|
-
isEqual: diffPixels <= 1,
|
|
69
|
+
isEqual: diffPixels >= 0 && diffPixels <= 1,
|
|
66
70
|
diffPixels,
|
|
67
71
|
};
|
|
68
72
|
}
|
package/internal/manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudscape-design/browser-test-tools",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.106",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/cloudscape-design/browser-test-tools.git"
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"@wdio/globals": "^9.7.0",
|
|
25
25
|
"@wdio/types": "^9.6.3",
|
|
26
26
|
"get-stream": "^6.0.1",
|
|
27
|
-
"lodash": "^4.17.
|
|
27
|
+
"lodash": "^4.17.23",
|
|
28
28
|
"p-retry": "^4.6.2",
|
|
29
29
|
"pixelmatch": "^5.3.0",
|
|
30
30
|
"pngjs": "^6.0.0",
|