-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathcypress.config.js
46 lines (41 loc) · 1.22 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 fs = require('fs');
const getFiles = (path) => {
return fs.readdirSync(path);
};
const removeFile = (path) => {
return fs.rmSync(path);
};
module.exports = defineConfig({
e2e: {
baseUrl: 'http://localhost:3000',
supportFile: 'cypress/support/index.js',
experimentalStudio: true,
retries: process.env.CI ? 2 : 0,
setupNodeEvents(on) {
on('task', {
getFileContent(directory, pattern) {
const file = getFiles('cypress/downloads').find((file) =>
file.match(pattern),
);
const path = `${directory}/${file}`;
if (!file) {
return null;
}
const content = fs.readFileSync(path, 'utf8');
removeFile(path);
return content;
},
});
},
},
viewportWidth: 1920,
viewportHeight: 1080,
video: false,
defaultCommandTimeout: 30000,
execTimeout: 30000,
taskTimeout: 30000,
pageLoadTimeout: 30000,
requestTimeout: 30000,
responseTimeout: 30000,
});