-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcypress.config.js
More file actions
62 lines (59 loc) · 1.88 KB
/
cypress.config.js
File metadata and controls
62 lines (59 loc) · 1.88 KB
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
const { defineConfig } = require('cypress')
const fs = require('fs')
module.exports = defineConfig({
component: {
fixturesFolder: 'cypress/fixtures',
integrationFolder: 'cypress/integration',
pluginsFile: 'cypress/plugins/index.js',
screenshotsFolder: 'cypress/screenshots',
supportFile: 'cypress/support/e2e.js',
videosFolder: 'cypress/videos',
},
e2e: {
setupNodeEvents(on, config) {
on('after:spec', (spec, results) => {
if (results && results.video) {
const failures = results.tests.some((test) =>
test.attempts.some((attempt) => attempt.state === 'failed')
)
if (!failures) {
fs.unlinkSync(results.video)
}
}
})
on('after:run', (results) => {
const { exec } = require('child_process')
// const cmd = `scripts/test_clean.php --user=cypress --env=local --alert-when-done --skip-confirm`
// console.log('Cleaning up nodes and files created by cypress...')
// exec(cmd, (error, stdout, stderr) => {
// if (error) {
// console.log(`error: ${error.message}`)
// }
// if (stderr) {
// console.log(`stderr: ${stderr}`)
// }
// console.log(`stdout: ${stdout}`)
// })
if (results) {
console.log(
`'${results.config.env.host}' cypress run done on '${results.config.projectId}'`
)
}
})
},
baseUrl: 'http://localhost:3000',
excludeSpecPattern: ['*/**/_debug'],
fixturesFolder: 'cypress/fixtures',
projectId: 'deckdle',
screenshotsFolder: 'cypress/screenshots',
specPattern: ['cypress/integration/**/*.cy.js'],
supportFile: 'cypress/support/e2e.js',
viewportWidth: 768,
viewportHeight: 840,
watchForFileChanges: true,
},
env: {
CUSTOM_SCRIPTS_ROOT: 'scripts',
},
video: true,
})