forked from visjs/vis-network
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcypress.config.ts
More file actions
49 lines (42 loc) · 1.4 KB
/
cypress.config.ts
File metadata and controls
49 lines (42 loc) · 1.4 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import { defineConfig } from "cypress";
import { configureVisualRegression } from "cypress-visual-regression";
export default defineConfig({
env: {
SNAPSHOT_BASE_DIRECTORY: "./cypress/snapshots/base",
SNAPSHOT_DIFF_DIRECTORY: "./cypress/snapshots/diff",
},
screenshotsFolder: "./cypress/snapshots/actual",
trashAssetsBeforeRuns: true,
viewportHeight: 1600,
viewportWidth: 1200,
e2e: {
setupNodeEvents(on, config) {
config.specPattern = [];
const all = !config.env.VISUAL && !config.env.FUNCTIONAL;
// Visual regression screenshot tests.
if (all || config.env.VISUAL) {
config.specPattern.push("cypress/e2e/visual/**/*.spec.ts");
config.env.failSilently = false;
config.trashAssetsBeforeRuns = true;
if (config.env.UPDATE) {
config.env.type = "base";
config.screenshotsFolder = "./cypress/snapshots/base";
} else {
config.env.type = "actual";
config.screenshotsFolder = "./cypress/snapshots/actual";
}
configureVisualRegression(on);
}
// Functional tests.
if (all || config.env.FUNCTIONAL) {
config.specPattern.push("cypress/e2e/functional/**/*.spec.ts");
}
return config;
},
specPattern: [
"cypress/e2e/visual/**/*.spec.ts",
"cypress/e2e/functional/**/*.spec.ts",
],
supportFile: "cypress/support/e2e.ts",
},
});