UNPKG

@progress/kendo-e2e

Version:

Kendo UI end-to-end test utilities.

45 lines (44 loc) 1.86 kB
import { WebDriver } from 'selenium-webdriver'; type ImageSnapshotOptions = { hideSelectors?: string[]; sleep?: number; tolerance?: number; ignoreCaret?: boolean; timeout?: number; }; type ImageSnapshotResult = { same?: boolean; }; /** * Takes a screenshot of a single element (by selector) and compares/updates the reference image. * * Behavior is: * 1. Wait for the element to appear. * 2. Optionally sleep, then hide any selectors passed in `hideSelectors`. * 3. Call the WebElement.takeScreenshot() API to get only that element’s bitmap. * 4. If a file already exists at outputPath, compare it (with looks-same). If identical, stop. * Otherwise, overwrite the file (unless SKIP_IMAGE_UPLOAD_AND_FAIL is set, in which case throw). * 5. Restore hidden elements. * * @param driver A WebDriver instance. * @param selector CSS selector for the element to snapshot. (First match only.) * @param outputPath Path where the screenshot PNG should live (and be compared/overwritten). * @param options Optional hideSelectors, sleep, tolerance, etc. */ export declare function snapshotImage(driver: WebDriver, selector: string, outputPath: string, options?: ImageSnapshotOptions): Promise<ImageSnapshotResult>; /** * Takes an image snapshot of view port. * * The image is compared using [looks-same](https://www.npmjs.com/package/looks-same) before overwriting. * * @example * await snapshotViewPort(driver, `${artifactsPath}/column-menu.png`, { * hideSelectors: ['div#demoToolbar'] * }); * * @param driver WebDriver instance * @param outputPath The path to the screenshot file to be created or updated. * @param options Screenshot options. */ export declare function snapshotViewPort(driver: any, outputPath: string, options?: ImageSnapshotOptions): Promise<ImageSnapshotResult>; export {};