Skip to main content

Class: Mugshot

mugshot.Mugshot

Constructors#

constructor#

+ new Mugshot(adapter: Webdriver, resultsPath: string, options?: MugshotOptions): Mugshot

Set up Mugshot using sane defaults.

If you need more complex options use the "advanced" form of the constructor.

Parameters:#

NameTypeDescription
adapterWebdriverA Webdriver implementation to be passed to WebdriverScreenshotter. If you need to pass in options to WebdriverScreenshotter then use the "advanced" Mugshot constructor.
resultsPathstringA filesystem path where screenshots will be stored using FsStorage. If you need to pass in options to FsStorage then use the "advanced" Mugshot constructor.
options?MugshotOptions

Returns: Mugshot

Defined in: packages/mugshot/src/lib/mugshot.ts:117

+ new Mugshot(screenshotter: Screenshotter, storage: ScreenshotStorage, options?: MugshotOptions): Mugshot

Set up Mugshot in "advanced" mode where you can pass in options to the various subsystems or plug in your own.

Parameters:#

NameType
screenshotterScreenshotter
storageScreenshotStorage
options?MugshotOptions

Returns: Mugshot

Defined in: packages/mugshot/src/lib/mugshot.ts:136

Methods#

check#

check(name: string, selector: MugshotSelector, options?: ScreenshotOptions): Promise<MugshotResult>

Check for visual regressions.

Parameters:#

NameTypeDescription
namestringMugshot will ask the storage implementation for a baseline with this name. If one is not found and createMissingBaselines is true then Mugshot will create a new baseline and return a passing result. Any leftover diffs from last time will be cleaned up. If a baseline is found then it will be compared with the screenshot taken from screenshotter. If differences are found this will return a failing result and a ${name}.diff and a ${name}.actual will be created using storage. If no differences are found then a passing result will be returned and any leftover diffs from last time will be cleaned up.
selectorMugshotSelectorSee Screenshotter.takeScreenshot for more details.
options?ScreenshotOptions

Returns: Promise<MugshotResult>

Defined in: packages/mugshot/src/lib/mugshot.ts:204

check(name: string, options?: ScreenshotOptions): Promise<MugshotResult>

Check for visual regressions.

Parameters:#

NameTypeDescription
namestringMugshot will ask the storage implementation for a baseline with this name. If one is not found and createMissingBaselines is true then Mugshot will create a new baseline and return a passing result. Any leftover diffs from last time will be cleaned up. If a baseline is found then it will be compared with the screenshot taken from screenshotter. If differences are found this will return a failing result and a ${name}.diff and a ${name}.actual will be created using storage. If no differences are found then a passing result will be returned and any leftover diffs from last time will be cleaned up.
options?ScreenshotOptions

Returns: Promise<MugshotResult>

Defined in: packages/mugshot/src/lib/mugshot.ts:228