1 | const noop = () => undefined;
|
2 | const asyncNoop = async () => undefined;
|
3 | export 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 | };
|
13 | const getTestBody = (options) => options.context.parameters.puppeteerTest;
|
14 | function defaultTestBody(page, options) {
|
15 | const testBody = getTestBody(options);
|
16 | if (testBody != null) {
|
17 | return testBody(page, options);
|
18 | }
|
19 | return null;
|
20 | }
|
21 | defaultTestBody.filter = (options) => getTestBody(options) != null;
|
22 | export const defaultPuppeteerTestConfig = {
|
23 | ...defaultCommonConfig,
|
24 | testBody: defaultTestBody,
|
25 | };
|
26 |
|
27 | const defaultScreenshotOptions = () => ({ fullPage: true, encoding: 'base64' });
|
28 | export const defaultImageSnapshotConfig = {
|
29 | ...defaultCommonConfig,
|
30 | getMatchOptions: noop,
|
31 | getScreenshotOptions: defaultScreenshotOptions,
|
32 | beforeScreenshot: asyncNoop,
|
33 | afterScreenshot: asyncNoop,
|
34 | };
|
35 | export const defaultAxeConfig = {
|
36 | ...defaultCommonConfig,
|
37 | beforeAxeTest: asyncNoop,
|
38 | };
|