- PixDiff
PixDiff
- saveScreen(tag) ⇒
promise
Saves an image of the screen
- saveRegion(element, tag) ⇒
promise
Saves an image of the screen region
- checkScreen(tag, options) ⇒
object
Runs the comparison against the screen
- checkRegion(element, tag, options) ⇒
object
Runs the comparison against a region
PixDiff
Kind: global class
Properties
Name | Type | Description |
---|---|---|
basePath | string |
Directory where baseline images are read/saved |
diffPath | string |
Directory where difference images are saved |
baseline | boolean |
Toggle saving baseline imags if not found |
width | int |
Width of browser |
height | int |
Height of browser |
formatOptions | object |
Flat object that holds custom options for formatString |
formatString | string |
Customizable image filename naming convention |
offsets | object |
Object with statusBar, addressBar and toolBar key/values |
devicePixelRatio | int |
Ratio of the (vertical) size of one physical pixel on the current display device to the size of one device independent pixels(dips) |
browserName | string |
Browser name from the WebDriver capabilities |
logName | string |
Log name from WebDriver capabilities |
name | string |
Name from WebDriver capabilities |
platformName | string |
Platform name from WebDriver capabilities |
deviceName | string |
Device name from WebDriver capabilities |
nativeWebScreenshot | boolean |
Android native screenshot from WebDriver capabilities |
- PixDiff
- new PixDiff(options)
- .THRESHOLD_PIXEL :
string
- .THRESHOLD_PERCENT :
string
Param | Type | Description |
---|---|---|
options | object |
|
options.basePath | string |
Path to baseline images folder |
options.diffPath | string |
Path to difference folder |
options.baseline | boolean |
Save images not found in baseline |
options.width | int |
Width of browser |
options.height | int |
Height of browser |
options.formatImageOptions | object |
Custom variables for Image Name |
options.formatImageName | string |
Custom format image name |
options.offsets | object |
Mobile iOS/Android offsets required for obtaining element position |
Threshold-type for pixel
Kind: static property of PixDiff
Access: public
Properties
Name |
---|
THRESHOLD_PIXEL |
Threshold-type for percent of all pixels
Kind: static property of PixDiff
Access: public
Properties
Name |
---|
THRESHOLD_PERCENT |
Saves an image of the screen
Kind: global function
Access: public
Reject: Error
Fulfil: null
Param | Type | Description |
---|---|---|
tag | string |
Baseline image name |
Example
browser.pixdiff.saveScreen('imageA');
Saves an image of the screen region
Kind: global function
Access: public
Reject: Error
Fulfil: null
Param | Type | Description |
---|---|---|
element | promise |
The ElementFinder for element lookup |
tag | string |
Baseline image name |
Example
browser.pixdiff.saveRegion(element(By.id('elementId')), 'imageA');
Runs the comparison against the screen
Kind: global function
Returns: object
- result
Access: public
Reject: Error
- Baseline image not found
Fulfil: object
- PixelDiff result.code
RESULT_UNKNOWN
: 0RESULT_DIFFERENT
: 1RESULT_SIMILAR
: 7RESULT_IDENTICAL
: 5
Param | Type | Description |
---|---|---|
tag | string |
Baseline image name |
options | object |
Non-default Blink-Diff options |
Example
browser.pixdiff.checkScreen('imageA', {blockOut: [{x: 0, y: 0, width: 1366, height: 30}]})
.then(result => { console.log(result.code); });
Runs the comparison against a region
Kind: global function
Returns: object
- result
Access: public
Reject: Error
- Baseline image not found
Fulfil: object
- PixelDiff result.code
RESULT_UNKNOWN
:0
RESULT_DIFFERENT
:1
RESULT_SIMILAR
:7
RESULT_IDENTICAL
:5
Param | Type | Description |
---|---|---|
element | promise |
The ElementFinder for element lookup |
tag | string |
Baseline image name |
options | object |
Non-default Blink-Diff options |
Example
browser.pixdiff.checkRegion(element(By.id('elementId')), 'imageA', {debug: true})
.then(result => { console.log(result.code); });