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

Commit de7cc86

Browse files
committed
feat: add "antialiasingTolerance" option
* allows to make the algorithm for determing antialiasing less strict
1 parent 754c56d commit de7cc86

9 files changed

Lines changed: 2204 additions & 2098 deletions

File tree

β€Ždoc/config.mdβ€Ž

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ desiredCapabilities:
1313
commonThing: value
1414
calibrate: false
1515
tolerance: 3.5
16+
antialiasingTolerance: 0
1617
httpTimeout: 5000
1718
sessionRequestTimeout: 60000
1819
sessionQuitTimeout: 5000
@@ -210,6 +211,8 @@ Settings list:
210211
recommended, prefer changing tolerance for particular suites or states
211212
instead.
212213

214+
* `antialiasingTolerance` β€” read about this option in [looks-same](https://github.com/gemini-testing/looks-same#comparing-images-with-ignoring-antialiasing).
215+
213216
* `windowSize` β€” specify browser window dimensions (i.e. `1600x1200`). If not
214217
specified, the size of the window depends on WebDriver. :warning: You can't set specific resolutions for browser Opera or mobile platforms. They use only full-screen resolution.
215218

@@ -226,7 +229,7 @@ Settings list:
226229
specified, the fallen tests will not be relaunched (by default it's 0).
227230

228231
Note that the same test never be performed in the same browser session.
229-
232+
230233
* `shouldRetry` β€” function which defines whether to make a retry. Should returns `Boolean` value. First argument is `data` which is the result of the test run, it's an Object with following fields:
231234
* `attempt {Number}` number of retries performed for the test
232235
* `retriesLeft {Number}` number of retries left

β€Žlib/config/browser-options.jsβ€Ž

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const getTopLevel = () => {
2424
sessionQuitTimeout: null,
2525
screenshotsDir: 'gemini/screens',
2626
tolerance: 2.3,
27+
antialiasingTolerance: 0,
2728
sessionsPerBrowser: 1,
2829
suitesPerSession: Infinity,
2930
windowSize: null,
@@ -150,6 +151,13 @@ function buildBrowserOptions(defaultFactory, extra) {
150151
validate: is('number')
151152
}),
152153

154+
antialiasingTolerance: option({
155+
defaultValue: defaultFactory('antialiasingTolerance'),
156+
parseEnv: Number,
157+
parseCli: Number,
158+
validate: is('number')
159+
}),
160+
153161
windowSize: option({
154162
defaultValue: defaultFactory('windowSize'),
155163
validate: (value) => {

β€Žlib/state-processor/capture-processor/capture-processor.jsβ€Ž

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ module.exports = class CaptureProcessor {
4545
const currentPath = temp.path({suffix: '.png'});
4646
const compareOpts = {
4747
canHaveCaret: capture.canHaveCaret,
48+
pixelRatio: opts.pixelRatio,
4849
tolerance: opts.tolerance,
49-
pixelRatio: opts.pixelRatio
50+
antialiasingTolerance: opts.antialiasingTolerance
5051
};
5152

5253
return capture.image.save(currentPath)

β€Žlib/state-processor/state-processor.jsβ€Ž

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ module.exports = class StateProcessor {
3131
execOpts: {
3232
pixelRatio: page.pixelRatio,
3333
referencePath: browserSession.browser.config.getScreenshotPath(state.suite, state.name),
34+
antialiasingTolerance: browserSession.browser.config.antialiasingTolerance,
3435
tolerance
3536
},
3637
temp: temp.serialize()

0 commit comments

Comments
Β (0)