UNPKG

@wdio/image-comparison-core

Version:

Image comparison core module for @wdio/visual-service - WebdriverIO visual testing framework

69 lines 3.82 kB
import type { AdjustedAxis, CheckBaselineImageExists, CropAndConvertToDataURL, CroppedBase64Image, DimensionsWarning, ExecuteImageCompare, HandleIOSBezelCorners, ImageCompareResult, MakeFullPageBase64ImageOptions, RotateBase64ImageOptions, RotatedImage, TakeBase64ElementScreenshotOptions, TakeResizedBase64ScreenshotOptions } from './images.interfaces.js'; import type { IgnoreBoxes } from './rectangles.interfaces.js'; import type { FullPageScreenshotsData } from './screenshots.interfaces.js'; /** * Check if an image exists and return a boolean */ export declare function checkIfImageExists(filePath: string): Promise<boolean>; /** * Remove the diff image if it exists */ export declare function removeDiffImageIfExists(diffFilePath: string): Promise<void>; /** * Check if the image exists and create a new baseline image if needed */ export declare function checkBaselineImageExists({ actualFilePath, baselineFilePath, autoSaveBaseline, updateBaseline, actualBase64Image, }: CheckBaselineImageExists): Promise<void>; /** * Get the rotated image if needed */ export declare function getRotatedImageIfNeeded({ isWebDriverElementScreenshot, isLandscape, base64Image }: RotatedImage): Promise<string>; /** * Log a warning when the crop goes out of the screen */ export declare function logDimensionWarning({ dimension, maxDimension, position, type, }: DimensionsWarning): void; /** * Get the adjusted axis */ export declare function getAdjustedAxis({ length, maxDimension, paddingEnd, paddingStart, start, warningType, }: AdjustedAxis): [number, number]; /** * Handle the iOS bezel corners */ export declare function handleIOSBezelCorners({ addIOSBezelCorners, image, deviceName, devicePixelRatio, height, isLandscape, width, }: HandleIOSBezelCorners): Promise<void>; /** * Crop the image and convert it to a base64 image */ export declare function cropAndConvertToDataURL({ addIOSBezelCorners, base64Image, deviceName, devicePixelRatio, height, isIOS, isLandscape, sourceX, sourceY, width, }: CropAndConvertToDataURL): Promise<string>; /** * Make a cropped image with Canvas */ export declare function makeCroppedBase64Image({ addIOSBezelCorners, base64Image, deviceName, devicePixelRatio, isWebDriverElementScreenshot, isIOS, isLandscape, rectangles, resizeDimensions, }: CroppedBase64Image): Promise<string>; /** * Execute the image compare */ export declare function executeImageCompare({ isViewPortScreenshot, isNativeContext, options, testContext, actualBase64Image, }: ExecuteImageCompare): Promise<ImageCompareResult | number>; /** * Make a full page image with Canvas */ export declare function makeFullPageBase64Image(screenshotsData: FullPageScreenshotsData, { devicePixelRatio, isLandscape }: MakeFullPageBase64ImageOptions): Promise<string>; /** * Save the base64 image to a file */ export declare function saveBase64Image(base64Image: string, filePath: string): Promise<void>; /** * Create a canvas with the ignore boxes if they are present */ export declare function addBlockOuts(screenshot: string, ignoredBoxes: IgnoreBoxes[]): Promise<string>; /** * Rotate a base64 image * Tnx to https://gist.github.com/Zyndoras/6897abdf53adbedf02564808aaab94db */ export declare function rotateBase64Image({ base64Image, degrees }: RotateBase64ImageOptions): Promise<string>; /** * Take a based64 screenshot of an element and resize it */ export declare function takeResizedBase64Screenshot({ browserInstance, element, devicePixelRatio, isIOS, resizeDimensions, }: TakeResizedBase64ScreenshotOptions): Promise<string>; /** * Take a base64 screenshot of an element */ export declare function takeBase64ElementScreenshot({ browserInstance, element, devicePixelRatio, isIOS, resizeDimensions, }: TakeBase64ElementScreenshotOptions): Promise<string>; //# sourceMappingURL=images.d.ts.map