-
Notifications
You must be signed in to change notification settings - Fork 0
/
cypress.config.js
47 lines (39 loc) · 1.35 KB
/
cypress.config.js
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
const { defineConfig } = require("cypress");
const createBundler = require("@bahmutov/cypress-esbuild-preprocessor");
const preprocessor = require("@badeball/cypress-cucumber-preprocessor");
const createEsbuildPlugin = require("@badeball/cypress-cucumber-preprocessor/esbuild");
async function setupNodeEvents(on, config) {
await preprocessor.addCucumberPreprocessorPlugin(on, config);
on(
"file:preprocessor",
createBundler({
plugins: [createEsbuildPlugin.default(config)],
})
);
// allow overriding baseUrl in cypress.env.json file - per machine
const baseUrl = config.env.baseUrl || null;
if (baseUrl) {
config.baseUrl = baseUrl;
}
// Make sure to return the config object as it might have been modified by the plugin.
return config;
}
const isCI = process.env.CI;
const ciReportSettings = {
reporter: "junit",
reporterOptions: {
testsuitesTitle: true,
mochaFile: "./reports/cypress/junit.[hash].xml"
}
};
module.exports = defineConfig({
e2e: {
baseUrl: 'http://localhost',
screenshotOnRunFailure: true, // enable screenshots of failed tests
video: false, // enable a video of the test to be saved if the test fails
specPattern: ["cypress/e2e/*.feature", "cypress/qa/*.feature"],
setupNodeEvents,
// add report settings on CI environments
...(isCI ? ciReportSettings : {})
},
});