forked from cypress-io/cypress
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebsockets_spec.js
More file actions
43 lines (36 loc) · 851 Bytes
/
websockets_spec.js
File metadata and controls
43 lines (36 loc) · 851 Bytes
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
const ws = require('ws')
const systemTests = require('../lib/system-tests').default
const onServer = (app) => {
return app.get('/foo', (req, res) => {
return res.send('<html>foo></html>')
})
}
const onWsServer = function (app, server) {
const wss = new ws.Server({ server })
return wss.on('connection', (ws) => {
return ws.on('message', (msg) => {
return ws.send(`${msg}bar`)
})
})
}
const onWssServer = function (app) {}
describe('e2e websockets', () => {
systemTests.setup({
servers: [{
port: 3038,
static: true,
onServer,
}, {
port: 3039,
onServer: onWsServer,
}, {
port: 3040,
onServer: onWssServer,
}],
})
// https://github.com/cypress-io/cypress/issues/556
systemTests.it('passes', {
spec: 'websockets_spec.js',
snapshot: true,
})
})