UNPKG

testplane

Version:

Tests framework based on mocha and wdio

27 lines (26 loc) 1.2 kB
import { Image } from "../../image"; import type { CropMargins } from "./utils"; import { type Point, type Rect, type Size } from "../isomorphic/geometry"; export type ScreenshotMode = "fullpage" | "viewport" | "auto"; export type { CropMargins } from "./utils"; export interface CaptureViewportImageOpts { viewportOffset: Point<"page", "device">; viewportSize: Size<"device">; /** Delay before taking the screenshot, in milliseconds. */ screenshotDelay?: number; /** Additional raw screenshot margins to crop, in physical pixels. */ cropMargins?: CropMargins; } export declare class Camera { private _screenshotMode; private _takeScreenshot; private _calibratedArea; private _calibrationScreenshotSize; private _debugTmpDir; static create(screenshotMode: ScreenshotMode, takeScreenshot: () => Promise<string>): Camera; constructor(screenshotMode: ScreenshotMode, takeScreenshot: () => Promise<string>); calibrate(calibratedArea: Rect<"image", "device">, screenshotSize: Size<"device">): void; captureViewportImage(opts?: CaptureViewportImageOpts): Promise<Image>; private _cropAreaToIntersection; private _cropAreaToViewport; }