-
Notifications
You must be signed in to change notification settings - Fork 0
/
cypress.config.ts
85 lines (73 loc) · 2.2 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
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
/**
* SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
// Making sure we're forcing the development mode
process.env.NODE_ENV = 'development'
process.env.npm_package_name = 'nextcloud-cypress'
/* eslint-disable import/first */
import { configureNextcloud, createSnapshot, setupUsers, startNextcloud, stopNextcloud, waitOnNextcloud } from './lib/docker'
import { defineConfig } from 'cypress'
import CodeCoverage from '@cypress/code-coverage/task'
import webpackConfig from '@nextcloud/webpack-vue-config'
import webpackRules from '@nextcloud/webpack-vue-config/rules'
/* eslint-enable import/first */
webpackRules.RULE_TS = {
test: /\.ts$/,
use: [{
loader: 'ts-loader',
options: {
// skip typechecking for speed
transpileOnly: true,
},
}],
}
webpackConfig.module.rules = Object.values(webpackRules)
// Cypress handle its own entry and output
delete (webpackConfig as any).entry
delete (webpackConfig as any).output
webpackConfig.resolve.extensions = ['.ts', '.tsx', '.js', '.jsx', '.cjs', '.vue']
export default defineConfig({
projectId: 'h2z7r3',
// Needed to trigger `after:run` events with cypress open
experimentalInteractiveRunEvents: true,
// faster video processing
videoCompression: false,
e2e: {
// Disable session isolation
testIsolation: false,
setupNodeEvents(on, config) {
CodeCoverage(on, config)
// Remove container after run
on('after:run', () => {
stopNextcloud()
})
// Before the browser launches
// starting Nextcloud testing container
return startNextcloud(process.env.BRANCH)
.then((ip) => {
// Setting container's IP as base Url
config.baseUrl = `http://${ip}/index.php`
return ip
})
.then(waitOnNextcloud as (ip: string) => Promise<undefined>) // void !== undefined for Typescript
.then(configureNextcloud as () => Promise<undefined>)
.then(setupUsers as () => Promise<undefined>)
.then(() => createSnapshot('init'))
.then(() => {
return config
})
},
},
component: {
setupNodeEvents(on, config) {
CodeCoverage(on, config)
return config
},
devServer: {
framework: 'vue',
bundler: 'webpack',
webpackConfig,
},
},
})