-
Notifications
You must be signed in to change notification settings - Fork 0
/
defaultOptions.ts
34 lines (32 loc) · 1.14 KB
/
defaultOptions.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { GetMatchOptionsOptions, OptionalImageSnapshotOptions } from "../types";
import { doNothing, waitMillis } from "../public-utils";
import path from "path";
import { MatchImageSnapshotOptions } from "jest-image-snapshot";
export const defaultOptions: OptionalImageSnapshotOptions = {
sizes: ["1024x768"],
storybookUrl: "http://localhost:6006",
beforeFirstScreenshot: waitMillis(1000),
beforeEachScreenshot: waitMillis(200),
afterEachScreenshot: doNothing(),
getMatchOptions: () => ({}),
snapshotBaseDirectory: path.join("src", "__image_snapshots_selenium__"),
seleniumUrl: process.env.SELENIUM_URL || "http://localhost:4444/wd/hub",
testTimeoutMillis: 60000,
setupTimeoutMillis: 60000,
teardownTimeoutMillis: 60000,
};
export function getDefaultMatchOptions(
snapshotBaseDirectory: string,
{ context, size, browserId }: GetMatchOptionsOptions
): MatchImageSnapshotOptions {
return {
customSnapshotsDir: path.join(snapshotBaseDirectory, context.id),
customSnapshotIdentifier: `${context.id}-${size}-${browserId}`,
customDiffConfig: {
threshold: 0.02,
includeAA: true,
},
failureThreshold: 10,
failureThresholdType: "pixel",
};
}