Skip to content

Latest commit

 

History

History
189 lines (150 loc) · 5.96 KB

index.md

File metadata and controls

189 lines (150 loc) · 5.96 KB

Classes

PixDiff

PixDiff

Functions

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

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

new PixDiff(options)

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

PixDiff.THRESHOLD_PIXEL : string

Threshold-type for pixel

Kind: static property of PixDiff
Access: public
Properties

Name
THRESHOLD_PIXEL

PixDiff.THRESHOLD_PERCENT : string

Threshold-type for percent of all pixels

Kind: static property of PixDiff
Access: public
Properties

Name
THRESHOLD_PERCENT

saveScreen(tag) ⇒ promise

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');

saveRegion(element, tag) ⇒ promise

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');

checkScreen(tag, options) ⇒ object

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: 0
  • RESULT_DIFFERENT: 1
  • RESULT_SIMILAR: 7
  • RESULT_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); });

checkRegion(element, tag, options) ⇒ object

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); });