UNPKG

@argos-ci/browser

Version:
407 lines 9.83 kB
//#region src/viewport.d.ts type ViewportOrientation = "portrait" | "landscape"; type ViewportSize = { width: number; height: number; }; declare const viewportPresets: { readonly "pro-display": { readonly width: 3008; readonly height: 1962; }; readonly "studio-display": { readonly width: 2560; readonly height: 1440; }; readonly "imac-24": { readonly width: 2240; readonly height: 1260; }; readonly "macbook-16": { readonly width: 1536; readonly height: 960; }; readonly "macbook-15": { readonly width: 1440; readonly height: 900; }; readonly "macbook-13": { readonly width: 1280; readonly height: 800; }; readonly "macbook-neo": { readonly width: 1204; readonly height: 753; }; readonly "macbook-11": { readonly width: 1366; readonly height: 768; }; readonly "ipad-13-pro": { readonly width: 1032; readonly height: 1376; }; readonly "ipad-11-pro-m5": { readonly width: 834; readonly height: 1210; }; readonly "ipad-13-air": { readonly width: 1024; readonly height: 1366; }; readonly "ipad-11-air": { readonly width: 820; readonly height: 1180; }; readonly "ipad-11": { readonly width: 820; readonly height: 1180; }; readonly "ipad-12-pro": { readonly width: 1024; readonly height: 1366; }; readonly "ipad-11-pro": { readonly width: 834; readonly height: 1194; }; readonly "ipad-10": { readonly width: 810; readonly height: 1080; }; readonly "ipad-10-pro": { readonly width: 834; readonly height: 1112; }; readonly "ipad-9-pro": { readonly width: 768; readonly height: 1024; }; readonly "ipad-2": { readonly width: 768; readonly height: 1024; }; readonly "ipad-mini-a17": { readonly width: 744; readonly height: 1133; }; readonly "ipad-mini": { readonly width: 768; readonly height: 1024; }; readonly "iphone-air": { readonly width: 420; readonly height: 912; }; readonly "iphone-17": { readonly width: 402; readonly height: 874; }; readonly "iphone-17-pro": { readonly width: 402; readonly height: 873; }; readonly "iphone-17-pro-max": { readonly width: 440; readonly height: 956; }; readonly "iphone-17e": { readonly width: 390; readonly height: 844; }; readonly "iphone-16": { readonly width: 393; readonly height: 852; }; readonly "iphone-16e": { readonly width: 390; readonly height: 844; }; readonly "iphone-16-plus": { readonly width: 430; readonly height: 932; }; readonly "iphone-16-pro": { readonly width: 402; readonly height: 874; }; readonly "iphone-16-pro-max": { readonly width: 440; readonly height: 956; }; readonly "iphone-15": { readonly width: 393; readonly height: 852; }; readonly "iphone-15-plus": { readonly width: 430; readonly height: 932; }; readonly "iphone-15-pro": { readonly width: 393; readonly height: 852; }; readonly "iphone-15-pro-max": { readonly width: 430; readonly height: 932; }; readonly "iphone-14": { readonly width: 390; readonly height: 844; }; readonly "iphone-14-plus": { readonly width: 428; readonly height: 926; }; readonly "iphone-14-pro": { readonly width: 393; readonly height: 852; }; readonly "iphone-14-pro-max": { readonly width: 490; readonly height: 932; }; readonly "iphone-13": { readonly width: 390; readonly height: 844; }; readonly "iphone-13-mini": { readonly width: 360; readonly height: 780; }; readonly "iphone-13-pro": { readonly width: 390; readonly height: 844; }; readonly "iphone-13-pro-max": { readonly width: 428; readonly height: 926; }; readonly "iphone-12": { readonly width: 390; readonly height: 844; }; readonly "iphone-12-mini": { readonly width: 360; readonly height: 780; }; readonly "iphone-12-pro": { readonly width: 390; readonly height: 844; }; readonly "iphone-12-pro-max": { readonly width: 428; readonly height: 926; }; readonly "iphone-11": { readonly width: 414; readonly height: 896; }; readonly "iphone-11-pro": { readonly width: 375; readonly height: 812; }; readonly "iphone-11-pro-max": { readonly width: 414; readonly height: 896; }; readonly "iphone-xr": { readonly width: 414; readonly height: 896; }; readonly "iphone-x": { readonly width: 375; readonly height: 812; }; readonly "iphone-6+": { readonly width: 414; readonly height: 736; }; readonly "iphone-se2": { readonly width: 375; readonly height: 667; }; readonly "iphone-8": { readonly width: 375; readonly height: 667; }; readonly "iphone-7": { readonly width: 375; readonly height: 667; }; readonly "iphone-6": { readonly width: 375; readonly height: 667; }; readonly "iphone-5": { readonly width: 320; readonly height: 568; }; readonly "iphone-4": { readonly width: 320; readonly height: 480; }; readonly "iphone-3": { readonly width: 320; readonly height: 480; }; readonly "samsung-s10": { readonly width: 360; readonly height: 760; }; readonly "samsung-note9": { readonly width: 414; readonly height: 846; }; }; type ViewportPreset = keyof typeof viewportPresets; type ViewportPresetOption = { preset: ViewportPreset; orientation?: ViewportOrientation; }; type ViewportOption = ViewportSize | ViewportPresetOption | ViewportPreset; declare function resolveViewport(viewportOption: ViewportOption): ViewportSize; //#endregion //#region src/global/stabilization/plugins/index.d.ts declare const plugins: ({ name: "disableSpellcheck"; beforeAll(): () => void; } | { name: "fontAntialiasing"; beforeAll(): () => void; } | { name: "hideCarets"; beforeAll(): () => void; } | { name: "hideScrollbars"; beforeAll(): () => void; } | { name: "loadImageSrcset"; beforeEach(options: RuntimeContext): undefined; } | { name: "pauseGifs"; beforeEach(): () => void; wait: { for: () => boolean; failureExplanation: string; }; } | { name: "roundImageSize"; beforeEach(): () => void; } | { name: "stabilizeSticky"; beforeAll(options: RuntimeContext): (() => void) | undefined; } | { name: "waitForAriaBusy"; wait: { for: () => boolean; failureExplanation: string; }; } | { name: "waitForBackgroundImages"; beforeEach(_context: RuntimeContext, options: unknown): () => void; wait: { for: () => boolean; failureExplanation: string; }; } | { name: "waitForFonts"; wait: { for: () => boolean; failureExplanation: string; }; } | { name: "waitForImages"; beforeEach(): undefined; wait: { for: () => boolean; failureExplanation: string; }; })[]; type PluginName = (typeof plugins)[number]["name"]; //#endregion //#region src/global/stabilization/index.d.ts interface RuntimeContext { /** * Is the test running in full page mode? */ fullPage?: boolean; /** * Viewports to use for the test. */ viewports?: ViewportOption[]; /** * Custom CSS to apply to the page before taking a screenshot. */ argosCSS?: string; } /** * Options for the `waitForBackgroundImages` plugin. */ interface WaitForBackgroundImagesOptions { /** * CSS selector scoping which elements are scanned for background images. * Scoping avoids a full-document `getComputedStyle` sweep on large pages. * @default "[data-visual-test-wait-bg-img], [data-visual-test-wait-bg-img] *" */ selector?: string; } type PluginOptions = { [key in Exclude<PluginName, "waitForBackgroundImages">]?: boolean } & { /** * Wait for CSS background images to be loaded. * Enabled by default, scoped to elements flagged with the * `data-visual-test-wait-bg-img` attribute (and their descendants). Pass * `true` to scan the whole document, an object to target a custom selector, * or `false` to disable it entirely. * @default true */ waitForBackgroundImages?: boolean | WaitForBackgroundImagesOptions; }; interface Context extends RuntimeContext { options?: PluginOptions | boolean; } /** * Run before taking all screenshots. */ declare function beforeAll(context?: Context): void; /** * Run after taking all screenshots. */ declare function afterAll(): void; /** * Run before taking each screenshot (between viewport changes). */ declare function beforeEach(context?: Context): void; /** * Run after taking each screenshot (between viewport changes). */ declare function afterEach(): void; /** * Wait for a condition to be met before taking a screenshot. */ declare function waitFor(context: Context): boolean; /** * Get the error message to display if the condition is not met. */ declare function getWaitFailureExplanations(options: Context): string[]; //#endregion //#region src/global/index.d.ts declare const ArgosGlobal: { beforeAll: typeof beforeAll; afterAll: typeof afterAll; beforeEach: typeof beforeEach; afterEach: typeof afterEach; waitFor: typeof waitFor; getWaitFailureExplanations: typeof getWaitFailureExplanations; getColorScheme: () => "dark" | "light"; getMediaType: () => "print" | "screen"; }; type ArgosGlobal = typeof ArgosGlobal; //#endregion //#region src/script.d.ts /** * Read the global script and return it as a string. */ declare function getGlobalScript(): string; //#endregion export { type ArgosGlobal, type Context as StabilizationContext, type PluginOptions as StabilizationPluginOptions, ViewportOption, ViewportOrientation, ViewportPreset, ViewportPresetOption, ViewportSize, type WaitForBackgroundImagesOptions, getGlobalScript, resolveViewport };