-
Notifications
You must be signed in to change notification settings - Fork 0
/
cypress.config.ts
69 lines (57 loc) · 2.28 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
import { createFile, deleteFile, readFile } from "./cypress/support/task_functions";
const { defineConfig } = require('cypress');
const cypressOnFix = require('cypress-on-fix');
const createBundler = require('@bahmutov/cypress-esbuild-preprocessor');
const { addCucumberPreprocessorPlugin } = require('@badeball/cypress-cucumber-preprocessor');
const { createEsbuildPlugin } = require('@badeball/cypress-cucumber-preprocessor/esbuild');
module.exports = defineConfig({
watchForFileChanges: false,
reporter: 'cypress-mochawesome-reporter',
reporterOptions: {
configFile: 'reporter-config.json',
},
e2e: {
specPattern: 'cypress/e2e/**/*.feature',
async setupNodeEvents(on, config) {
// "cypress-on-fix" is required because "cypress-mochawesome-reporter" and "cypress-cucumber-preprocessor" use the same hooks
on = cypressOnFix(on);
require('cypress-mochawesome-reporter/plugin')(on);
await addCucumberPreprocessorPlugin(on, config);
on('before:browser:launch', (browser, launchOptions) => {
// start browser at full screen mode
if (browser.family === 'chromium' && browser.name !== 'electron') {
launchOptions.args.push('--start-fullscreen');
return launchOptions;
}
if (browser.name === 'electron') {
launchOptions.preferences.fullscreen = true;
return launchOptions;
}
return launchOptions;
});
on('file:preprocessor',
createBundler({
plugins: [createEsbuildPlugin(config)],
}),
);
on('task', {
readFile: filename => {
return readFile(filename);
},
deleteFile: filePath => {
return deleteFile(filePath);
},
createFile: filePath => {
return createFile(filePath);
},
});
return config;
},
// For test profile
baseUrl: 'https://docs.cypress.io',
},
env: {
filterSpecs: true,
defaultPageLoadingTime: 1000,
},
});