Repository navigation
Expand file tree
/
Copy pathcypress.config.ts
More file actions
66 lines (55 loc) · 1.86 KB
/
Copy pathcypress.config.ts
File metadata and controls
66 lines (55 loc) · 1.86 KB
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
/**
* 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-e2e-test-server'
import type { RunExecOptions, RunExecResult } from './lib/docker/index.ts'
import { defineConfig } from 'cypress'
import vitePreprocessor from 'cypress-vite'
import {
configureNextcloud,
createSnapshot,
docker,
runExec as dockerRunExec,
setupUsers,
startNextcloud,
stopNextcloud,
waitOnNextcloud,
} from './lib/docker/index.ts'
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,
async setupNodeEvents(on, config) {
on('file:preprocessor', vitePreprocessor({ configFile: false }))
// Remove container after run
on('after:run', async () => {
// The data directory is a tmpfs, so grab the server log before the container goes away
await stopNextcloud({ saveLogTo: 'cypress/logs/nextcloud.log' })
await docker.getVolume('apps_writable').remove()
})
on('task', {
async runExec({ command, options }: { command: string | string[], options: Partial<RunExecOptions> }): Promise<RunExecResult> {
return await dockerRunExec(command, options)
},
})
// Before the browser launches
// starting Nextcloud testing container
const ip = await startNextcloud(process.env.BRANCH, false, { forceRecreate: true, exposePort: 8086 })
// Setting container's IP as base Url
config.baseUrl = `http://${ip}/index.php`
await waitOnNextcloud(ip)
await configureNextcloud()
await setupUsers()
await createSnapshot('init')
return config
},
},
})