UNPKG

1.63 kBTypeScriptView Raw
1import { MatchImageSnapshotOptions } from 'jest-image-snapshot';
2import { Base64ScreenShotOptions, Browser, DirectNavigationOptions, Page, ElementHandle } from 'puppeteer';
3export interface Context {
4 kind: string;
5 story: string;
6 parameters: {
7 [key: string]: any;
8 };
9}
10interface Options {
11 context: Context;
12 url: string;
13}
14export interface CommonConfig {
15 storybookUrl: string;
16 chromeExecutablePath: string;
17 getGotoOptions: (options: Options) => DirectNavigationOptions;
18 customizePage: (page: Page) => Promise<void>;
19 getCustomBrowser: () => Promise<Browser>;
20 setupTimeout: number;
21 testTimeout: number;
22}
23export interface PuppeteerTestConfig extends CommonConfig {
24 testBody: ((page: Page, options: Options) => void | Promise<void>) & {
25 filter?: (options: Options) => boolean;
26 };
27}
28export interface ImageSnapshotConfig extends CommonConfig {
29 getMatchOptions: (options: Options) => MatchImageSnapshotOptions;
30 getScreenshotOptions: (options: Options) => Base64ScreenShotOptions;
31 beforeScreenshot: (page: Page, options: Options) => Promise<void | ElementHandle>;
32 afterScreenshot: (options: {
33 image: string;
34 context: Context;
35 }) => Promise<void>;
36}
37export interface AxeConfig extends CommonConfig {
38 beforeAxeTest: (page: Page, options: Options) => Promise<void>;
39}
40export declare const defaultCommonConfig: CommonConfig;
41export declare const defaultPuppeteerTestConfig: PuppeteerTestConfig;
42export declare const defaultImageSnapshotConfig: ImageSnapshotConfig;
43export declare const defaultAxeConfig: AxeConfig;
44export {};