-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcypress.config.js
48 lines (44 loc) · 1.28 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
const { defineConfig } = require("cypress");
const fs = require("fs");
module.exports = defineConfig({
viewportWidth: 1280,
viewportHeight: 720,
projectId: "z7p66s",
component: {
devServer: {
framework: "react",
bundler: "vite",
},
specPattern: [
"./surveys/**/*.cy.{js,jsx,ts,tsx}",
"./src/*.cy.jsx",
"./test/**/*cy.{js,jsx,ts,tsx}",
],
supportFile: "./cypress/support/component.js",
setupNodeEvents(on, config) {
on("after:screenshot", (details) => {
const oldPath = details.path;
const newPath = oldPath.replace("cypress/screenshots", "surveys");
return new Promise((resolve, reject) => {
// fs.rename moves the file to the new path
fs.rename(details.path, newPath, (err) => {
if (err) return reject(err);
// because we renamed and moved the image, resolve with the new path
// so it is accurate in the test results
resolve({ path: newPath });
});
}).catch((error) => {
console.log(error);
});
});
},
},
retries: {
// Configure retry attempts for `cypress run`
// Default is 0
runMode: 2,
// Configure retry attempts for `cypress open`
// Default is 0
openMode: 0,
},
});