Skip to content
This repository was archived by the owner on Sep 21, 2022. It is now read-only.

Commit f80cf09

Browse files
committed
feat: add diff clusters
1 parent 740edcd commit f80cf09

File tree

6 files changed

+84
-80
lines changed

6 files changed

+84
-80
lines changed

lib/config/browser-options.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ const getTopLevel = () => {
2525
screenshotsDir: 'gemini/screens',
2626
tolerance: 2.3,
2727
antialiasingTolerance: 0,
28-
compareOpts: {stopOnFirstFail: false},
28+
compareOpts: {
29+
shouldCluster: false,
30+
clustersSize: 10,
31+
stopOnFirstFail: false
32+
},
2933
buildDiffOpts: {
3034
ignoreAntialiasing: true,
3135
ignoreCaret: true

lib/state-processor/capture-processor/capture-processor.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,13 @@ module.exports = class CaptureProcessor {
5353

5454
return capture.image.save(currImg.path)
5555
.then(() => Image.compare(currImg.path, refImg.path, imageCompareOpts))
56-
.then(({equal, diffBounds, metaInfo = {}}) => {
56+
.then(({equal, diffBounds, diffClusters, metaInfo = {}}) => {
5757
Object.assign(refImg, metaInfo.refImg);
58+
const diffAreas = {diffBounds, diffClusters};
5859

5960
return equal
6061
? this._onEqualHandler(refImg, currImg)
61-
: this._onDiffHandler(refImg, currImg, diffBounds);
62+
: this._onDiffHandler(refImg, currImg, diffAreas);
6263
});
6364
}
6465
};

lib/state-processor/capture-processor/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ exports.create = (type) => {
3838
.onReference()
3939
.onNoReference(throwNoRefError)
4040
.onEqual((refImg, currImg) => ({refImg, currImg, equal: true}))
41-
.onDiff((refImg, currImg, diffBounds) => ({refImg, currImg, diffBounds, equal: false}));
41+
.onDiff((refImg, currImg, {diffBounds, diffClusters}) => ({refImg, currImg, diffBounds, diffClusters, equal: false}));
4242
}
4343

4444
if (type === 'new-updater') {

package-lock.json

Lines changed: 72 additions & 75 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"debug": "^2.2.0",
1818
"fs-extra": "^0.30.0",
1919
"gemini-configparser": "^1.0.0",
20-
"gemini-core": "^3.3.0",
20+
"gemini-core": "^3.5.0",
2121
"gemini-coverage": "^2.0.0",
2222
"graceful-fs": "^4.1.11",
2323
"handlebars": "^4.0.5",

test/unit/state-processor/capture-processor/capture-processor.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ describe('state-processor/capture-processor/capture-processor', () => {
167167
Image.compare.resolves({
168168
equal: false,
169169
diffBounds: {left: 0, top: 0, right: 10, bottom: 10},
170+
diffClusters: [{left: 0, top: 0, right: 10, bottom: 10}],
170171
metaInfo: {refImg: {size: {width: 100, height: 200}}}
171172
});
172173
temp.path.withArgs({suffix: '.png'}).returns('/temp/path');
@@ -180,6 +181,7 @@ describe('state-processor/capture-processor/capture-processor', () => {
180181
refImg: {path: '/ref/path', size: {width: 100, height: 200}},
181182
currImg: {path: '/temp/path', size: {width: 300, height: 400}},
182183
diffBounds: {left: 0, top: 0, right: 10, bottom: 10},
184+
diffClusters: [{left: 0, top: 0, right: 10, bottom: 10}],
183185
equal: false
184186
});
185187
});

0 commit comments

Comments
 (0)