forked from kentcdodds/kentcdodds.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cypress.config.ts
43 lines (38 loc) · 1.18 KB
/
cypress.config.ts
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
import {defineConfig} from 'cypress'
export default defineConfig({
e2e: {
setupNodeEvents: (on, config) => {
const isDev = config.watchForFileChanges
const port = process.env.PORT ?? (isDev ? '3000' : '8811')
const configOverrides: Partial<Cypress.PluginConfigOptions> = {
projectId: '4rxk45',
baseUrl: `http://localhost:${port}`,
viewportWidth: 1030,
viewportHeight: 800,
video: !process.env.CI,
screenshotOnRunFailure: !process.env.CI,
}
// To use this:
// cy.task('log', whateverYouWantInTheTerminal)
on('task', {
log: message => {
console.log(message)
return null
},
})
on('before:browser:launch', (browser, options) => {
if (browser.name === 'chrome') {
options.args.push(
'--no-sandbox',
'--allow-file-access-from-files',
'--use-fake-ui-for-media-stream',
'--use-fake-device-for-media-stream',
'--use-file-for-fake-audio-capture=cypress/fixtures/sample.wav',
)
}
return options
})
return {...config, ...configOverrides}
},
},
})