forked from serlo/serlo-editor-for-edusharing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcypress.config.ts
47 lines (42 loc) · 1.38 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
import { defineConfig } from 'cypress'
import { EdusharingServer } from './src/edusharing-server/server'
import { loadEnvConfig } from './src/server-utils'
export default defineConfig({
// Disable checks in chrome "same-origin" in HTTP requests. Normally cypress
// implements measures to avoid this problem. However due to the LTI the
// domain changes often in the LTI worflow.
//
// see https://docs.cypress.io/guides/guides/web-security for more details
//
// TODO: Find a way to avoid this setting
chromeWebSecurity: false,
e2e: {
setupNodeEvents(on, _config) {
loadEnvConfig()
const serverMock = new EdusharingServer()
on('before:run', () => {
return new Promise((resolve) => {
serverMock.listen(8100, resolve)
})
})
on('task', {
initEdusharingServer() {
serverMock.init()
return null
},
getSavedVersionsInEdusharing() {
return serverMock.savedVersions
},
removePropertyInCustom(propertyName: string) {
const success = serverMock.removePropertyInCustom(propertyName)
return success ? null : undefined // undefined makes task fail
},
willSendContent(content: unknown) {
serverMock.willSendContent(content)
return null
},
})
},
},
experimentalInteractiveRunEvents: true,
})