///
import type * as Core from '@applitools/core';
import { EyesSelector } from './EyesSelector';
import { Image } from './Image';
import { AccessibilityRegionType } from '../enums/AccessibilityRegionType';
import { MatchLevel } from '../enums/MatchLevel';
import { Region, LegacyRegion } from './Region';
import { Location } from './Location';
import { LazyLoadOptions } from './LazyLoadOptions';
import { DensityMetrics } from './DensityMetrics';
import * as utils from '@applitools/utils';
import { DynamicTextType } from '../enums/DynamicTextType';
import { type StitchMode } from '../enums/StitchMode';
type RegionReference = Region | LegacyRegion | ElementReference;
type ElementReference = TSpec['element'] | SelectorReference;
type SelectorReference = EyesSelector;
type FrameReference = ElementReference | string | number;
type ContextReference = {
frame: FrameReference;
scrollRootElement?: ElementReference;
};
type CodedRegion = {
region: Region | LegacyRegion | TRegion;
padding?: number | {
top: number;
bottom: number;
left: number;
right: number;
};
regionId?: string;
};
type CodedFloatingRegion = CodedRegion & {
offset?: {
top?: number;
bottom?: number;
left?: number;
right?: number;
};
};
/** @deprecated */
type LegacyCodedFloatingRegion = CodedRegion & {
maxUpOffset?: number;
maxDownOffset?: number;
maxLeftOffset?: number;
maxRightOffset?: number;
};
type CodedAccessibilityRegion = CodedRegion & {
type?: AccessibilityRegionType;
};
type DynamicTextTypeOrPattern = DynamicTextType | string;
type CodedDynamicRegion = CodedRegion & {
type?: DynamicTextTypeOrPattern | DynamicTextTypeOrPattern[];
};
export type CheckSettingsBase = {
name?: string;
region?: Region | LegacyRegion | TRegion;
matchLevel?: MatchLevel;
useDom?: boolean;
sendDom?: boolean;
enablePatterns?: boolean;
ignoreDisplacements?: boolean;
ignoreMismatch?: boolean;
ignoreCaret?: boolean;
ignoreRegions?: (CodedRegion | Region | LegacyRegion | TRegion)[];
layoutRegions?: (CodedRegion | Region | LegacyRegion | TRegion)[];
strictRegions?: (CodedRegion | Region | LegacyRegion | TRegion)[];
contentRegions?: (CodedRegion | Region | LegacyRegion | TRegion)[];
floatingRegions?: (CodedFloatingRegion | LegacyCodedFloatingRegion | Region | LegacyRegion | TRegion)[];
accessibilityRegions?: (CodedAccessibilityRegion | Region | LegacyRegion | TRegion)[];
dynamicRegions?: (CodedDynamicRegion | Region | TRegion)[];
pageId?: string;
variationGroupId?: string;
densityMetrics?: DensityMetrics;
stitchMode?: StitchMode;
};
export type CheckSettingsImage = CheckSettingsBase;
type LayoutBreakpoints = boolean | number[] | {
breakpoints: number[] | boolean;
reload?: boolean;
} | {
breakpoints: boolean;
heightBreakpoints: boolean;
reload?: boolean;
};
export type CheckSettingsAutomation> = CheckSettingsBase & {
frames?: (ContextReference | FrameReference)[];
webview?: boolean | string;
scrollRootElement?: ElementReference;
fully?: boolean;
disableBrowserFetching?: boolean;
layoutBreakpoints?: LayoutBreakpoints;
/** @deprecated */
visualGridOptions?: {
[key: string]: any;
};
ufgOptions?: {
[key: string]: any;
};
useSystemScreenshot?: boolean;
hooks?: {
beforeCaptureScreenshot: string;
};
/** @deprecated Use `Configuration.matchTimeout` instead */
timeout?: number;
waitBeforeCapture?: number | (() => Promise);
lazyLoad?: boolean | LazyLoadOptions;
};
/**
* All available opt-in properties for CheckSettings.
* Platforms can selectively include these properties as needed.
*
* @template TSpec - The spec type for the platform
*/
type CheckSettingsWithPage = {
page?: TSpec['driver'];
};
export type RegionReferenceWithPage = (Region & {
page?: TSpec['driver'];
}) | {
selector: TSpec['selector'] | string;
page?: TSpec['driver'];
} | ElementReference;
/**
* Opt-in properties for multi-page context support.
* Platforms that support multi-page contexts (Playwright, Puppeteer) should include this.
*
* @template TSpec - The spec type for the platform
* @template TKeys - Optional array of property keys to include. If not specified, only 'page' is included.
*
*/
export type CheckSettingsOptIn)[] = ['page']> = Pick, TKeys[number]>;
export type CheckSettingsAutomationWithOptIn = CheckSettingsAutomation> & CheckSettingsOptIn;
export declare class CheckSettingsBaseFluent {
protected _settings: CheckSettingsBase;
protected parent?: this;
protected childs: this[];
constructor(settings?: CheckSettingsBase | CheckSettingsBaseFluent, parent?: CheckSettingsBaseFluent);
region(region: Region | LegacyRegion | TRegion): typeof this;
name(name: string): typeof this;
withName(name: string): this;
ignoreRegion(region: CodedRegion | Region | LegacyRegion | TRegion): typeof this;
ignoreRegions(...regions: (CodedRegion | Region | LegacyRegion | TRegion)[]): typeof this;
/** @deprecated */
ignore(region: Region | LegacyRegion | TRegion): this;
/** @deprecated */
ignores(...regions: (Region | LegacyRegion | TRegion)[]): typeof this;
layoutRegion(region: CodedRegion | Region | LegacyRegion | TRegion): typeof this;
layoutRegions(...regions: (CodedRegion | Region | LegacyRegion | TRegion)[]): typeof this;
strictRegion(region: CodedRegion | Region | LegacyRegion | TRegion): typeof this;
strictRegions(...regions: (CodedRegion | Region | LegacyRegion | TRegion)[]): typeof this;
contentRegion(region: CodedRegion | Region | LegacyRegion | TRegion): typeof this;
contentRegions(...regions: (CodedRegion | Region | LegacyRegion | TRegion)[]): typeof this;
floatingRegion(region: CodedFloatingRegion): this;
floatingRegion(region: LegacyCodedFloatingRegion): this;
floatingRegion(region: Region | LegacyRegion | TRegion, maxUpOffset?: number, maxDownOffset?: number, maxLeftOffset?: number, maxRightOffset?: number): this;
floatingRegions(...regions: (CodedFloatingRegion | Region | LegacyRegion | TRegion)[]): this;
floatingRegions(maxOffset: number, ...regions: (Region | LegacyRegion | TRegion)[]): this;
/** @deprecated */
floating(region: CodedFloatingRegion): this;
/** @deprecated */
floating(region: Region | LegacyRegion | TRegion): this;
/** @deprecated */
floatings(...regions: (CodedFloatingRegion | Region | LegacyRegion | TRegion)[]): this;
/** @deprecated */
floatings(maxOffset: number, ...regions: (Region | LegacyRegion | TRegion)[]): this;
accessibilityRegion(region: CodedAccessibilityRegion): this;
accessibilityRegion(region: Region | LegacyRegion | TRegion, type?: AccessibilityRegionType): this;
accessibilityRegions(...regions: (CodedAccessibilityRegion | Region | LegacyRegion | TRegion)[]): this;
accessibilityRegions(type: AccessibilityRegionType, ...regions: (Region | LegacyRegion | TRegion)[]): this;
dynamicRegion(region: CodedDynamicRegion): this;
dynamicRegion(region: Region | TRegion): this;
dynamicRegion(region: Region | TRegion, type?: DynamicTextTypeOrPattern | DynamicTextTypeOrPattern[]): this;
dynamicRegions(...regions: (CodedDynamicRegion | Region | TRegion)[]): this;
matchLevel(matchLevel: MatchLevel): typeof this;
layout(): typeof this;
exact(): typeof this;
strict(): typeof this;
ignoreColors(): typeof this;
dynamic(): typeof this;
/** @deprecated */
content(): typeof this;
enablePatterns(enablePatterns?: boolean): typeof this;
ignoreDisplacements(ignoreDisplacements?: boolean): typeof this;
ignoreCaret(ignoreCaret?: boolean): typeof this;
useDom(useDom?: boolean): typeof this;
sendDom(sendDom?: boolean): typeof this;
pageId(pageId: string): typeof this;
variationGroupId(variationGroupId: string): typeof this;
/** @internal */
toObject(): CheckSettingsBase;
/** @internal */
toString(): string;
/** @internal */
protected assumesMutability(): true | undefined;
protected static makeMutableTreeProxy>(self: T, ctor: new (...args: any[]) => T): T;
protected toCoreCodedRegion(region: CodedRegion | Region | LegacyRegion | TRegion): Core.CodedRegion | utils.Region | TRegion;
protected toCoreCodedFloatingRegion(region: CodedFloatingRegion | LegacyCodedFloatingRegion | Region | LegacyRegion | TRegion): Core.FloatingRegion | utils.Region | TRegion;
protected toCoreRegion(region: Region | LegacyRegion | TRegion): utils.Region | TRegion;
}
export declare class CheckSettingsImageFluent extends CheckSettingsBaseFluent {
protected _target: Image;
constructor(settings?: CheckSettingsImage | CheckSettingsImageFluent, target?: Image, parent?: CheckSettingsImageFluent);
image(image: Buffer | URL | string): typeof this;
buffer(imageBuffer: Buffer): typeof this;
base64(imageBase64: Buffer): typeof this;
path(imagePath: string): typeof this;
url(imageUrl: URL | string): typeof this;
name(name: string): typeof this;
withDom(dom: string): typeof this;
withLocation(locationInViewport: Location): typeof this;
/** @internal */
toJSON(): {
target: Image;
settings: Core.CheckSettings;
};
}
export declare class CheckSettingsAutomationFluent = CheckSettingsAutomation> extends CheckSettingsBaseFluent> {
protected _settings: CheckSettingsAutomation;
protected static readonly _spec: Core.SpecDriver;
protected _spec: Core.SpecDriver;
protected _usedDeprecations: string[];
protected _isElementReference(value: any): value is ElementReference;
protected _isSelectorReference(selector: any): selector is SelectorReference;
protected _isFrameReference(value: any): value is FrameReference;
constructor(settings?: CheckSettingsAutomationFluent);
constructor(settings?: TCheckSettingsWithAutomation);
/** @internal */
constructor(settings?: TCheckSettingsWithAutomation | CheckSettingsAutomationFluent, spec?: Core.SpecDriver, parent?: CheckSettingsAutomationFluent);
region(region: RegionReference): this;
shadow(selector: SelectorReference): typeof this;
frame(context: ContextReference): this;
frame(frame: FrameReference, scrollRootElement?: ElementReference): this;
webview(webview?: string | boolean): typeof this;
scrollRootElement(scrollRootElement: ElementReference): typeof this;
fully(fully?: boolean): typeof this;
/** @deprecated */
stitchContent(stitchContent?: boolean): this;
disableBrowserFetching(disableBrowserFetching: boolean): typeof this;
layoutBreakpoints(breakpoints: boolean, heightBreakpoints: boolean, settings?: {
reload?: boolean;
}): this;
layoutBreakpoints(breakpoints: boolean | number[], settings?: {
reload?: boolean;
}): this;
hook(name: string, script: string): typeof this;
beforeRenderScreenshotHook(script: string): typeof this;
/** @deprecated */
webHook(script: string): typeof this;
ufgOption(key: string, value: any): this;
ufgOptions(options: {
[key: string]: any;
}): this;
/** @deprecated */
visualGridOption(key: string, value: any): this;
/** @deprecated */
visualGridOptions(options: {
[key: string]: any;
}): this;
useSystemScreenshot(useSystemScreenshot?: boolean): this;
/**
* @deprecated Use `Configuration.matchTimeout` during `eyes.open()` instead
*/
timeout(timeout: number): typeof this;
waitBeforeCapture(waitBeforeCapture: number | (() => Promise)): typeof this;
lazyLoad(options?: LazyLoadOptions | boolean): typeof this;
densityMetrics(options: DensityMetrics): typeof this;
stitchMode(stitchMode: StitchMode): typeof this;
/** @internal */
protected toLayoutBreakpoints(): {
breakpoints: number[] | boolean;
heightBreakpoints?: boolean;
reload?: boolean;
};
/** @internal */
toJSON(): {
target: TSpec['driver'] | undefined;
settings: Core.CheckSettings & Core.CheckSettings;
};
}
export type TargetImage = {
image(image: Buffer | URL | string): CheckSettingsImageFluent;
buffer(imageBuffer: Buffer): CheckSettingsImageFluent;
base64(imageBase64: string): CheckSettingsImageFluent;
path(imagePath: string): CheckSettingsImageFluent;
url(imageUrl: URL | string): CheckSettingsImageFluent;
};
export declare const TargetImage: TargetImage;
export type TargetAutomationBase = {
/** @internal */
spec: Core.SpecDriver;
window(): CheckSettingsAutomationFluent;
region(region: RegionReference | LegacyRegion): CheckSettingsAutomationFluent;
frame(context: ContextReference): CheckSettingsAutomationFluent;
frame(frame: FrameReference, scrollRootElement?: ElementReference): CheckSettingsAutomationFluent;
shadow(selector: SelectorReference): CheckSettingsAutomationFluent;
webview(webview?: string | boolean): CheckSettingsAutomationFluent;
};
export type TargetAutomation = TargetAutomationBase;
export declare const TargetAutomation: TargetAutomationBase;
export type Target = TargetImage & TargetAutomation;
export declare const Target: Target;
export {};