-
Notifications
You must be signed in to change notification settings - Fork 0
/
cypress.config.js
75 lines (66 loc) · 1.91 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
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
const { defineConfig } = require('cypress');
const fs = require('fs');
const path = require('path');
import { addCucumberPreprocessorPlugin } from '@badeball/cypress-cucumber-preprocessor';
import createBundler from '@bahmutov/cypress-esbuild-preprocessor';
import createEsbuildPlugin from '@badeball/cypress-cucumber-preprocessor/esbuild';
module.exports = defineConfig({
projectId: 'c1jrzq',
reporter: 'cypress-mochawesome-reporter',
chromeWebSecurity: false,
reporterOptions: {
reportDir: 'cypress/reports',
charts: true,
reportPageTitle: 'Test Suite',
embeddedScreenshots: true,
inlineAssets: true,
},
e2e: {
baseUrl: 'http://localhost:8081',
defaultCommandTimeout: 20000,
requestTimeout: 20000,
async setupNodeEvents(on, config) {
require('@cypress/grep/src/plugin')(config);
await addCucumberPreprocessorPlugin(on, config);
on(
'file:preprocessor',
createBundler({
plugins: [createEsbuildPlugin(config)],
}),
);
on('task', {
deleteFile(filePath) {
if (fs.existsSync(filePath)) {
fs.unlinkSync(filePath);
}
return null;
},
});
on('task', {
deleteAllFilesInFolder(folderPath) {
const dirPath = path.resolve(__dirname, folderPath);
if (!fs.existsSync(dirPath)) return null;
const files = fs.readdirSync(dirPath);
files.forEach((file) => {
const filePath = path.join(dirPath, file);
if (fs.existsSync(filePath)) {
fs.unlinkSync(filePath);
}
});
return null;
},
});
return config;
},
specPattern: 'cypress/e2e/**/*{cy.js,feature}',
experimentalStudio: true,
watchForFileChanges: false,
},
retries: {
runMode: 2,
openMode: 0,
},
video: true,
viewportWidth: 1440,
viewportHeight: 900,
});