-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcypress.config.js
49 lines (37 loc) · 1.45 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
const { defineConfig } = require("cypress");
module.exports = defineConfig({
reporter: 'junit',
reporterOptions: {
mochaFile: 'cypress/results/my-test-output-[hash].xml',
},
e2e: {
setupNodeEvents(on, config) {
// implement node event listeners here
on('after:spec', (spec, results) => {
results.tests.forEach(testResult => {
console.log(`
`)
console.log('Test title: ' + '\x1b[34m%s\x1b[0m', testResult.title[testResult.title.length - 1])
console.log('Duration time: ', testResult.duration)
if (testResult.attempts[0].state === 'failed') {
console.log('Status: ' + '\x1b[31m%s\x1b[0m', testResult.attempts[0].state)
} else if (testResult.attempts[0].state === 'pending') {
console.log('Status: ' + '\x1b[45m%s\x1b[0m', 'skipped')
} else {
console.log('Status: ' + '\x1b[32m%s\x1b[0m', testResult.attempts[0].state)
}
if (testResult.displayError !== null) {
console.log('Error describe: ' + '\x1b[31m%s\x1b[0m', testResult.displayError)
}
console.log(`
----------------------------------------------------------
`)
})
})
on('before:run', (details) => {
console.log('\x1b[34m%s\x1b[0m', 'Stay with')
console.log('\x1b[33m%s\x1b[0m', 'Ukraine')
})
},
},
})