UNPKG

1.26 kBJavaScriptView Raw
1const noop = () => undefined;
2const asyncNoop = async () => undefined;
3export const defaultCommonConfig = {
4 storybookUrl: 'http://localhost:6006',
5 chromeExecutablePath: process.env.SB_CHROMIUM_PATH,
6 getGotoOptions: noop,
7 customizePage: asyncNoop,
8 getCustomBrowser: undefined,
9 browserLaunchOptions: {},
10 setupTimeout: 15000,
11 testTimeout: 15000,
12};
13const getTestBody = (options) => options.context.parameters.puppeteerTest;
14function defaultTestBody(page, options) {
15 const testBody = getTestBody(options);
16 if (testBody != null) {
17 return testBody(page, options);
18 }
19 return null;
20}
21defaultTestBody.filter = (options) => getTestBody(options) != null;
22export const defaultPuppeteerTestConfig = {
23 ...defaultCommonConfig,
24 testBody: defaultTestBody,
25};
26// We consider taking the full page is a reasonable default.
27const defaultScreenshotOptions = () => ({ fullPage: true, encoding: 'base64' });
28export const defaultImageSnapshotConfig = {
29 ...defaultCommonConfig,
30 getMatchOptions: noop,
31 getScreenshotOptions: defaultScreenshotOptions,
32 beforeScreenshot: asyncNoop,
33 afterScreenshot: asyncNoop,
34};
35export const defaultAxeConfig = {
36 ...defaultCommonConfig,
37 beforeAxeTest: asyncNoop,
38};