generated from cfpb/open-source-project-template
-
Notifications
You must be signed in to change notification settings - Fork 20
/
Copy pathcypress.config.js
71 lines (65 loc) · 2.01 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
const { defineConfig } = require('cypress')
const fs = require('fs')
module.exports = defineConfig({
chromeWebSecurity: false,
video: true,
env: {
HOST: 'https://ffiec.cfpb.gov',
ENVIRONMENT: 'NOT CI',
USERNAME: 'frontend.testing@mailinator.com',
INSTITUTION: 'FRONTENDTESTBANK9999',
TEST_DELAY: 1000,
ACTION_DELAY: 1000,
NAV_DELAY: 5000,
AUTH_REALM: 'hmda2',
AUTH_CLIENT_ID: 'hmda2-api',
preserveCookies: ['_login_gov_session'],
},
defaultCommandTimeout: 10000,
projectId: 'uk89dv',
retries: {
runMode: 1,
openMode: 0,
},
experimentalStudio: true,
e2e: {
experimentalRunAllSpecs: true,
testIsolation: true,
setupNodeEvents(on, config) {
return require('./cypress/plugins/index.js')(on, config)
},
specPattern: 'cypress/e2e/**/*.{js,jsx,ts,tsx}',
experimentalOriginDependencies: true,
chromeWebSecurity: false,
defaultCommandTimeout: 10000,
pageLoadTimeout: 30000,
retries: {
runMode: 2,
openMode: 0
},
// Delete videos for specs without failing or retried tests, see docs:
// https://docs.cypress.io/app/guides/screenshots-and-videos#Delete-videos-for-specs-without-failing-or-retried-tests
setupNodeEvents(on, config) {
on('after:spec', (spec, results) => {
if (results && results.video) {
// Do we have failures for any retry attempts?
const failures = results.tests.some((test) =>
test.attempts.some((attempt) => attempt.state === 'failed')
)
// Check to make sure the video file exists before deleting, see https://stackoverflow.com/a/76113045
if (!failures && fs.existsSync(results.video)) {
// delete the video if the spec passed and no tests retried
fs.unlinkSync(results.video)
console.log(`All tests passed, deleting video file: ${results.video}`)
}
}
})
},
},
component: {
devServer: {
framework: 'react',
bundler: 'vite',
},
},
})