-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcypress.config.ts
77 lines (73 loc) · 1.76 KB
/
cypress.config.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import { defineConfig } from "cypress";
import { chromeAllowXSiteCookies, networkShim } from "@dhis2/cypress-plugins";
import path from "path";
async function cucumberPreprocessor(on: any, config: any) {
const preprocessor = require("@badeball/cypress-cucumber-preprocessor");
const webpack = require("@cypress/webpack-preprocessor");
// This is required for the preprocessor to be able to generate JSON reports after each run, and more,
await preprocessor.addCucumberPreprocessorPlugin(on, config);
on(
"file:preprocessor",
webpack({
webpackOptions: {
context: path.resolve(__dirname, "cypress"),
resolve: {
extensions: [".ts", ".js"],
},
module: {
rules: [
{
test: /\.ts$/,
exclude: [/node_modules/],
use: [
{
loader: "ts-loader",
options: {
transpileOnly: true,
},
},
],
},
{
test: /\.feature$/,
use: [
{
loader: "@badeball/cypress-cucumber-preprocessor/webpack",
options: config,
},
],
},
],
},
},
}),
);
}
async function setupNodeEvents(on: any, config: any) {
chromeAllowXSiteCookies(on, config);
await cucumberPreprocessor(on, config);
networkShim(on, config);
return config;
}
export default defineConfig({
e2e: {
viewportWidth: 1368,
viewportHeight: 768,
setupNodeEvents,
defaultCommandTimeout: 20000,
requestTimeout: 20000,
responseTimeout: 20000,
retries: 2,
taskTimeout: 20000,
pageLoadTimeout: 10000,
baseUrl: "http://localhost:3000",
specPattern: "cypress/e2e/**/*.feature",
env: {
dhis2DataTestPrefix: "d2-dat",
networkMode: "live",
dhis2ApiVersion: 40,
},
experimentalInteractiveRunEvents: true,
experimentalStudio: true,
},
});