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

Commit

Permalink
feat: add "antialiasingTolerance" option
Browse files Browse the repository at this point in the history
* allows to make the algorithm for determing antialiasing less strict
  • Loading branch information
DudaGod committed Sep 11, 2018
1 parent 754c56d commit de7cc86
Show file tree
Hide file tree
Showing 9 changed files with 2,204 additions and 2,098 deletions.
5 changes: 4 additions & 1 deletion doc/config.md
Expand Up @@ -13,6 +13,7 @@ desiredCapabilities:
commonThing: value
calibrate: false
tolerance: 3.5
antialiasingTolerance: 0
httpTimeout: 5000
sessionRequestTimeout: 60000
sessionQuitTimeout: 5000
Expand Down Expand Up @@ -210,6 +211,8 @@ Settings list:
recommended, prefer changing tolerance for particular suites or states
instead.

* `antialiasingTolerance` — read about this option in [looks-same](https://github.com/gemini-testing/looks-same#comparing-images-with-ignoring-antialiasing).

* `windowSize` — specify browser window dimensions (i.e. `1600x1200`). If not
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.

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

Note that the same test never be performed in the same browser session.

* `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:
* `attempt {Number}` number of retries performed for the test
* `retriesLeft {Number}` number of retries left
Expand Down
8 changes: 8 additions & 0 deletions lib/config/browser-options.js
Expand Up @@ -24,6 +24,7 @@ const getTopLevel = () => {
sessionQuitTimeout: null,
screenshotsDir: 'gemini/screens',
tolerance: 2.3,
antialiasingTolerance: 0,
sessionsPerBrowser: 1,
suitesPerSession: Infinity,
windowSize: null,
Expand Down Expand Up @@ -150,6 +151,13 @@ function buildBrowserOptions(defaultFactory, extra) {
validate: is('number')
}),

antialiasingTolerance: option({
defaultValue: defaultFactory('antialiasingTolerance'),
parseEnv: Number,
parseCli: Number,
validate: is('number')
}),

windowSize: option({
defaultValue: defaultFactory('windowSize'),
validate: (value) => {
Expand Down
3 changes: 2 additions & 1 deletion lib/state-processor/capture-processor/capture-processor.js
Expand Up @@ -45,8 +45,9 @@ module.exports = class CaptureProcessor {
const currentPath = temp.path({suffix: '.png'});
const compareOpts = {
canHaveCaret: capture.canHaveCaret,
pixelRatio: opts.pixelRatio,
tolerance: opts.tolerance,
pixelRatio: opts.pixelRatio
antialiasingTolerance: opts.antialiasingTolerance
};

return capture.image.save(currentPath)
Expand Down
1 change: 1 addition & 0 deletions lib/state-processor/state-processor.js
Expand Up @@ -31,6 +31,7 @@ module.exports = class StateProcessor {
execOpts: {
pixelRatio: page.pixelRatio,
referencePath: browserSession.browser.config.getScreenshotPath(state.suite, state.name),
antialiasingTolerance: browserSession.browser.config.antialiasingTolerance,
tolerance
},
temp: temp.serialize()
Expand Down

0 comments on commit de7cc86

Please sign in to comment.