-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathcypress.config.js
50 lines (42 loc) · 1.44 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
const path = require('path')
const preprocessor = require('@cypress/webpack-preprocessor')
const { defineConfig } = require('cypress')
module.exports = defineConfig({
// Enable Cypress Cloud.
projectId: 'h321g2',
// Pass the `SANITY_STUDIO_PREVIEW_TOKEN` environment variable (if defined),
// so Cypress enable the preview mode before visit pages.
env: {
SANITY_STUDIO_PREVIEW_TOKEN: process.env.SANITY_STUDIO_PREVIEW_TOKEN,
},
// Reduce the memory consumption by lowering the amount of tests kept in
// memory throughout a run.
numTestsKeptInMemory: 10,
// Automatically retry tests up to 3 times when run from the command line.
retries: { runMode: 3, openMode: 0 },
// Increase the default viewport size to small laptop screens.
viewportHeight: 768,
viewportWidth: 1200,
e2e: {
baseUrl: 'http://localhost:3000',
setupNodeEvents(on, config) {
const webpackOptions = {
resolve: {
alias: {
'#api': path.resolve('./src/api'),
'#components': path.resolve('./src/components'),
'#constants': path.resolve('./src/constants'),
'#helpers': path.resolve('./src/helpers'),
'#hooks': path.resolve('./src/hooks'),
},
fallback: {
net: false,
},
},
}
// Enable Cypress to support path aliases
on('file:preprocessor', preprocessor({ webpackOptions }))
return config
},
},
})