@webex/internal-plugin-board 2.59.3-next.1 → 2.59.4-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +6 -6
- package/README.md +42 -42
- package/babel.config.js +3 -3
- package/dist/board.js +171 -174
- package/dist/board.js.map +1 -1
- package/dist/config.js +21 -21
- package/dist/config.js.map +1 -1
- package/dist/index.js +8 -9
- package/dist/index.js.map +1 -1
- package/dist/realtime-channel-collection.js +4 -4
- package/dist/realtime-channel-collection.js.map +1 -1
- package/dist/realtime-channel.js +4 -4
- package/dist/realtime-channel.js.map +1 -1
- package/dist/realtime.js +48 -48
- package/dist/realtime.js.map +1 -1
- package/jest.config.js +3 -3
- package/package.json +13 -13
- package/process +1 -1
- package/src/board.js +764 -764
- package/src/config.js +44 -44
- package/src/index.js +105 -105
- package/src/realtime-channel-collection.js +18 -18
- package/src/realtime-channel.js +40 -40
- package/src/realtime.js +252 -252
- package/test/integration/spec/board.js +717 -717
- package/test/integration/spec/realtime.js +194 -194
- package/test/integration/spec/sharing-mercury.js +285 -285
- package/test/unit/spec/board.js +635 -635
- package/test/unit/spec/encryption.js +255 -255
- package/test/unit/spec/realtime.js +473 -473
|
@@ -1,194 +1,194 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import '@webex/internal-plugin-board';
|
|
6
|
-
|
|
7
|
-
import {assert} from '@webex/test-helper-chai';
|
|
8
|
-
import {flaky, maxWaitForEvent} from '@webex/test-helper-mocha';
|
|
9
|
-
import WebexCore from '@webex/webex-core';
|
|
10
|
-
import testUsers from '@webex/test-helper-test-users';
|
|
11
|
-
import fh from '@webex/test-helper-file';
|
|
12
|
-
import {map} from 'lodash';
|
|
13
|
-
import uuid from 'uuid';
|
|
14
|
-
|
|
15
|
-
describe('plugin-board', () => {
|
|
16
|
-
describe('realtime', () => {
|
|
17
|
-
let board, conversation, fixture, participants;
|
|
18
|
-
let mccoy, spock;
|
|
19
|
-
let mccoyRealtimeChannel, spockRealtimeChannel;
|
|
20
|
-
|
|
21
|
-
before('create users', () =>
|
|
22
|
-
testUsers.create({count: 2}).then(async (users) => {
|
|
23
|
-
participants = [spock, mccoy] = users;
|
|
24
|
-
|
|
25
|
-
// Pause for 5 seconds for CI
|
|
26
|
-
await new Promise((done) => setTimeout(done, 5000));
|
|
27
|
-
|
|
28
|
-
return Promise.all(
|
|
29
|
-
map(participants, (participant) => {
|
|
30
|
-
participant.webex = new WebexCore({
|
|
31
|
-
credentials: {
|
|
32
|
-
authorization: participant.token,
|
|
33
|
-
},
|
|
34
|
-
// NOTE: temp fix so that realtime tests pass
|
|
35
|
-
// Test user catalogue does not include the URL from utc
|
|
36
|
-
config: {
|
|
37
|
-
services: {
|
|
38
|
-
override: {
|
|
39
|
-
'mercury-test': 'wss://mercury-connection-llm.intb1.ciscospark.com/',
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
return participant.webex.internal.device.register();
|
|
46
|
-
})
|
|
47
|
-
);
|
|
48
|
-
})
|
|
49
|
-
);
|
|
50
|
-
|
|
51
|
-
before('create conversation', () =>
|
|
52
|
-
spock.webex.internal.conversation
|
|
53
|
-
.create({
|
|
54
|
-
displayName: 'Test Board Conversation',
|
|
55
|
-
participants,
|
|
56
|
-
})
|
|
57
|
-
.then((c) => {
|
|
58
|
-
conversation = c;
|
|
59
|
-
|
|
60
|
-
return conversation;
|
|
61
|
-
})
|
|
62
|
-
);
|
|
63
|
-
|
|
64
|
-
before('create channel (board)', () =>
|
|
65
|
-
spock.webex.internal.board.createChannel(conversation).then((channel) => {
|
|
66
|
-
board = channel;
|
|
67
|
-
|
|
68
|
-
return channel;
|
|
69
|
-
})
|
|
70
|
-
);
|
|
71
|
-
|
|
72
|
-
before('connect to realtime channel', () =>
|
|
73
|
-
Promise.all(
|
|
74
|
-
map(participants, (participant) =>
|
|
75
|
-
participant.webex.internal.board.realtime.connectByOpenNewMercuryConnection(board)
|
|
76
|
-
)
|
|
77
|
-
)
|
|
78
|
-
);
|
|
79
|
-
|
|
80
|
-
before('get realtime channels', () => {
|
|
81
|
-
spockRealtimeChannel = spock.webex.internal.board.realtime.realtimeChannels.get(
|
|
82
|
-
board.channelId
|
|
83
|
-
);
|
|
84
|
-
mccoyRealtimeChannel = mccoy.webex.internal.board.realtime.realtimeChannels.get(
|
|
85
|
-
board.channelId
|
|
86
|
-
);
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
before('load fixture image', () =>
|
|
90
|
-
fh.fetch('sample-image-small-one.png').then((fetchedFixture) => {
|
|
91
|
-
fixture = fetchedFixture;
|
|
92
|
-
|
|
93
|
-
return fetchedFixture;
|
|
94
|
-
})
|
|
95
|
-
);
|
|
96
|
-
|
|
97
|
-
// disconnect realtime
|
|
98
|
-
after('disconnect realtime channel', () =>
|
|
99
|
-
Promise.all(
|
|
100
|
-
map(participants, (participant) =>
|
|
101
|
-
participant.webex.internal.board.realtime.disconnectMercuryConnection(board)
|
|
102
|
-
)
|
|
103
|
-
)
|
|
104
|
-
);
|
|
105
|
-
|
|
106
|
-
describe('#config', () => {
|
|
107
|
-
it('shares board values', () => {
|
|
108
|
-
// board values
|
|
109
|
-
assert.isDefined(spockRealtimeChannel.config.pingInterval);
|
|
110
|
-
assert.isDefined(spockRealtimeChannel.config.pongTimeout);
|
|
111
|
-
assert.isDefined(spockRealtimeChannel.config.forceCloseDelay);
|
|
112
|
-
|
|
113
|
-
// mercury values not defined in board
|
|
114
|
-
assert.isUndefined(spockRealtimeChannel.config.backoffTimeReset);
|
|
115
|
-
assert.isUndefined(spockRealtimeChannel.config.backoffTimeMax);
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
describe('#publish()', () => {
|
|
120
|
-
describe('string payload', () => {
|
|
121
|
-
let uniqueRealtimeData;
|
|
122
|
-
|
|
123
|
-
before(() => {
|
|
124
|
-
uniqueRealtimeData = uuid.v4();
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
flaky(it, process.env.SKIP_FLAKY_TESTS)('posts a message to the specified board', () => {
|
|
128
|
-
const data = {
|
|
129
|
-
envelope: {
|
|
130
|
-
channelId: board,
|
|
131
|
-
roomId: conversation.id,
|
|
132
|
-
},
|
|
133
|
-
payload: {
|
|
134
|
-
msg: uniqueRealtimeData,
|
|
135
|
-
},
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
// confirm that both are connected.
|
|
139
|
-
assert.isTrue(spockRealtimeChannel.connected, 'spock is connected');
|
|
140
|
-
assert.isTrue(mccoyRealtimeChannel.connected, 'mccoy is connected');
|
|
141
|
-
|
|
142
|
-
spock.webex.internal.board.realtime.publish(board, data);
|
|
143
|
-
|
|
144
|
-
return maxWaitForEvent(5000, 'event:board.activity', mccoyRealtimeChannel).then(
|
|
145
|
-
(event) => {
|
|
146
|
-
assert.equal(event.data.contentType, 'STRING');
|
|
147
|
-
assert.equal(event.data.payload.msg, uniqueRealtimeData);
|
|
148
|
-
}
|
|
149
|
-
);
|
|
150
|
-
});
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
describe('file payload', () => {
|
|
154
|
-
let testScr;
|
|
155
|
-
|
|
156
|
-
it('uploads file to webex files which includes loc', () =>
|
|
157
|
-
mccoy.webex.internal.board._uploadImage(board, fixture).then((scr) => {
|
|
158
|
-
assert.property(scr, 'loc');
|
|
159
|
-
testScr = scr;
|
|
160
|
-
}));
|
|
161
|
-
|
|
162
|
-
flaky(it, process.env.SKIP_FLAKY_TESTS)('posts a file to the specified board', () => {
|
|
163
|
-
const data = {
|
|
164
|
-
envelope: {
|
|
165
|
-
channelId: board,
|
|
166
|
-
roomId: conversation.id,
|
|
167
|
-
},
|
|
168
|
-
payload: {
|
|
169
|
-
displayName: 'image.png',
|
|
170
|
-
type: 'FILE',
|
|
171
|
-
file: {
|
|
172
|
-
scr: testScr,
|
|
173
|
-
},
|
|
174
|
-
},
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
// confirm that both are listening.
|
|
178
|
-
assert.isTrue(spockRealtimeChannel.connected, 'spock is connected');
|
|
179
|
-
assert.isTrue(mccoyRealtimeChannel.connected, 'mccoy is listening');
|
|
180
|
-
|
|
181
|
-
spock.webex.internal.board.realtime.publish(board, data);
|
|
182
|
-
|
|
183
|
-
return maxWaitForEvent(5000, 'event:board.activity', mccoyRealtimeChannel).then(
|
|
184
|
-
(event) => {
|
|
185
|
-
assert.equal(event.data.contentType, 'FILE');
|
|
186
|
-
assert.equal(event.data.payload.file.scr.loc, testScr.loc);
|
|
187
|
-
assert.equal(event.data.payload.displayName, 'image.png');
|
|
188
|
-
}
|
|
189
|
-
);
|
|
190
|
-
});
|
|
191
|
-
});
|
|
192
|
-
});
|
|
193
|
-
});
|
|
194
|
-
});
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import '@webex/internal-plugin-board';
|
|
6
|
+
|
|
7
|
+
import {assert} from '@webex/test-helper-chai';
|
|
8
|
+
import {flaky, maxWaitForEvent} from '@webex/test-helper-mocha';
|
|
9
|
+
import WebexCore from '@webex/webex-core';
|
|
10
|
+
import testUsers from '@webex/test-helper-test-users';
|
|
11
|
+
import fh from '@webex/test-helper-file';
|
|
12
|
+
import {map} from 'lodash';
|
|
13
|
+
import uuid from 'uuid';
|
|
14
|
+
|
|
15
|
+
describe('plugin-board', () => {
|
|
16
|
+
describe('realtime', () => {
|
|
17
|
+
let board, conversation, fixture, participants;
|
|
18
|
+
let mccoy, spock;
|
|
19
|
+
let mccoyRealtimeChannel, spockRealtimeChannel;
|
|
20
|
+
|
|
21
|
+
before('create users', () =>
|
|
22
|
+
testUsers.create({count: 2}).then(async (users) => {
|
|
23
|
+
participants = [spock, mccoy] = users;
|
|
24
|
+
|
|
25
|
+
// Pause for 5 seconds for CI
|
|
26
|
+
await new Promise((done) => setTimeout(done, 5000));
|
|
27
|
+
|
|
28
|
+
return Promise.all(
|
|
29
|
+
map(participants, (participant) => {
|
|
30
|
+
participant.webex = new WebexCore({
|
|
31
|
+
credentials: {
|
|
32
|
+
authorization: participant.token,
|
|
33
|
+
},
|
|
34
|
+
// NOTE: temp fix so that realtime tests pass
|
|
35
|
+
// Test user catalogue does not include the URL from utc
|
|
36
|
+
config: {
|
|
37
|
+
services: {
|
|
38
|
+
override: {
|
|
39
|
+
'mercury-test': 'wss://mercury-connection-llm.intb1.ciscospark.com/',
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
return participant.webex.internal.device.register();
|
|
46
|
+
})
|
|
47
|
+
);
|
|
48
|
+
})
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
before('create conversation', () =>
|
|
52
|
+
spock.webex.internal.conversation
|
|
53
|
+
.create({
|
|
54
|
+
displayName: 'Test Board Conversation',
|
|
55
|
+
participants,
|
|
56
|
+
})
|
|
57
|
+
.then((c) => {
|
|
58
|
+
conversation = c;
|
|
59
|
+
|
|
60
|
+
return conversation;
|
|
61
|
+
})
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
before('create channel (board)', () =>
|
|
65
|
+
spock.webex.internal.board.createChannel(conversation).then((channel) => {
|
|
66
|
+
board = channel;
|
|
67
|
+
|
|
68
|
+
return channel;
|
|
69
|
+
})
|
|
70
|
+
);
|
|
71
|
+
|
|
72
|
+
before('connect to realtime channel', () =>
|
|
73
|
+
Promise.all(
|
|
74
|
+
map(participants, (participant) =>
|
|
75
|
+
participant.webex.internal.board.realtime.connectByOpenNewMercuryConnection(board)
|
|
76
|
+
)
|
|
77
|
+
)
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
before('get realtime channels', () => {
|
|
81
|
+
spockRealtimeChannel = spock.webex.internal.board.realtime.realtimeChannels.get(
|
|
82
|
+
board.channelId
|
|
83
|
+
);
|
|
84
|
+
mccoyRealtimeChannel = mccoy.webex.internal.board.realtime.realtimeChannels.get(
|
|
85
|
+
board.channelId
|
|
86
|
+
);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
before('load fixture image', () =>
|
|
90
|
+
fh.fetch('sample-image-small-one.png').then((fetchedFixture) => {
|
|
91
|
+
fixture = fetchedFixture;
|
|
92
|
+
|
|
93
|
+
return fetchedFixture;
|
|
94
|
+
})
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
// disconnect realtime
|
|
98
|
+
after('disconnect realtime channel', () =>
|
|
99
|
+
Promise.all(
|
|
100
|
+
map(participants, (participant) =>
|
|
101
|
+
participant.webex.internal.board.realtime.disconnectMercuryConnection(board)
|
|
102
|
+
)
|
|
103
|
+
)
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
describe('#config', () => {
|
|
107
|
+
it('shares board values', () => {
|
|
108
|
+
// board values
|
|
109
|
+
assert.isDefined(spockRealtimeChannel.config.pingInterval);
|
|
110
|
+
assert.isDefined(spockRealtimeChannel.config.pongTimeout);
|
|
111
|
+
assert.isDefined(spockRealtimeChannel.config.forceCloseDelay);
|
|
112
|
+
|
|
113
|
+
// mercury values not defined in board
|
|
114
|
+
assert.isUndefined(spockRealtimeChannel.config.backoffTimeReset);
|
|
115
|
+
assert.isUndefined(spockRealtimeChannel.config.backoffTimeMax);
|
|
116
|
+
});
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
describe('#publish()', () => {
|
|
120
|
+
describe('string payload', () => {
|
|
121
|
+
let uniqueRealtimeData;
|
|
122
|
+
|
|
123
|
+
before(() => {
|
|
124
|
+
uniqueRealtimeData = uuid.v4();
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
flaky(it, process.env.SKIP_FLAKY_TESTS)('posts a message to the specified board', () => {
|
|
128
|
+
const data = {
|
|
129
|
+
envelope: {
|
|
130
|
+
channelId: board,
|
|
131
|
+
roomId: conversation.id,
|
|
132
|
+
},
|
|
133
|
+
payload: {
|
|
134
|
+
msg: uniqueRealtimeData,
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
// confirm that both are connected.
|
|
139
|
+
assert.isTrue(spockRealtimeChannel.connected, 'spock is connected');
|
|
140
|
+
assert.isTrue(mccoyRealtimeChannel.connected, 'mccoy is connected');
|
|
141
|
+
|
|
142
|
+
spock.webex.internal.board.realtime.publish(board, data);
|
|
143
|
+
|
|
144
|
+
return maxWaitForEvent(5000, 'event:board.activity', mccoyRealtimeChannel).then(
|
|
145
|
+
(event) => {
|
|
146
|
+
assert.equal(event.data.contentType, 'STRING');
|
|
147
|
+
assert.equal(event.data.payload.msg, uniqueRealtimeData);
|
|
148
|
+
}
|
|
149
|
+
);
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
describe('file payload', () => {
|
|
154
|
+
let testScr;
|
|
155
|
+
|
|
156
|
+
it('uploads file to webex files which includes loc', () =>
|
|
157
|
+
mccoy.webex.internal.board._uploadImage(board, fixture).then((scr) => {
|
|
158
|
+
assert.property(scr, 'loc');
|
|
159
|
+
testScr = scr;
|
|
160
|
+
}));
|
|
161
|
+
|
|
162
|
+
flaky(it, process.env.SKIP_FLAKY_TESTS)('posts a file to the specified board', () => {
|
|
163
|
+
const data = {
|
|
164
|
+
envelope: {
|
|
165
|
+
channelId: board,
|
|
166
|
+
roomId: conversation.id,
|
|
167
|
+
},
|
|
168
|
+
payload: {
|
|
169
|
+
displayName: 'image.png',
|
|
170
|
+
type: 'FILE',
|
|
171
|
+
file: {
|
|
172
|
+
scr: testScr,
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
// confirm that both are listening.
|
|
178
|
+
assert.isTrue(spockRealtimeChannel.connected, 'spock is connected');
|
|
179
|
+
assert.isTrue(mccoyRealtimeChannel.connected, 'mccoy is listening');
|
|
180
|
+
|
|
181
|
+
spock.webex.internal.board.realtime.publish(board, data);
|
|
182
|
+
|
|
183
|
+
return maxWaitForEvent(5000, 'event:board.activity', mccoyRealtimeChannel).then(
|
|
184
|
+
(event) => {
|
|
185
|
+
assert.equal(event.data.contentType, 'FILE');
|
|
186
|
+
assert.equal(event.data.payload.file.scr.loc, testScr.loc);
|
|
187
|
+
assert.equal(event.data.payload.displayName, 'image.png');
|
|
188
|
+
}
|
|
189
|
+
);
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
});
|
|
194
|
+
});
|