@webex/internal-plugin-lyra 2.59.2 → 2.59.3-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.
@@ -1,203 +1,203 @@
1
- /*!
2
- * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
3
- */
4
-
5
- import '@webex/internal-plugin-lyra';
6
-
7
- import {assert} from '@webex/test-helper-chai';
8
- import retry from '@webex/test-helper-retry';
9
- import testUsers from '@webex/test-helper-test-users';
10
- // FIXME
11
- // eslint-disable-next-line import/no-unresolved
12
- import {generateRandomString} from '@ciscospark/test-users-legacy';
13
- import WebexCore from '@webex/webex-core';
14
- import uuid from 'uuid';
15
-
16
- describe('plugin-lyra', () => {
17
- describe('Device', () => {
18
- let participants;
19
- let lyraMachine;
20
- let lyraSpace; // space with details of lyra URIs
21
- let spock;
22
- let conversation;
23
-
24
- before('create lyra machine', function () {
25
- this.timeout(retry.timeout(20000));
26
-
27
- return retry(() =>
28
- testUsers.create({
29
- count: 1,
30
- config: {
31
- machineType: 'LYRA_SPACE',
32
- type: 'MACHINE',
33
- password: `${generateRandomString(32)}d_wA*`,
34
- },
35
- })
36
- )
37
- .then((machines) => {
38
- lyraMachine = machines[0];
39
- lyraMachine.webex = new WebexCore({
40
- credentials: {
41
- authorization: lyraMachine.token,
42
- },
43
- });
44
-
45
- // binding to conversation only works with webex board device
46
- lyraMachine.webex.internal.device.config.defaults.deviceType = 'SPARK_BOARD';
47
- lyraMachine.webex.internal.device.config.defaults.model = 'WebexBoard Test';
48
- lyraMachine.webex.internal.device.config.defaults.localizedModel = 'WebexJSSDKTest';
49
- lyraMachine.webex.internal.device.config.defaults.systemVersion = 'WebexJSSDKTest';
50
- lyraMachine.webex.internal.device.config.defaults.systemName = 'Darling';
51
-
52
- return lyraMachine.webex.internal.mercury.connect();
53
- })
54
- .then(() => lyraMachine.webex.internal.lyra.space.get({id: lyraMachine.id}))
55
- .then((space) => {
56
- lyraMachine.space = space;
57
- lyraSpace = Object.assign({}, space, {url: `/spaces/${space.identity.id}`});
58
- });
59
- });
60
-
61
- before('create users', () =>
62
- testUsers.create({count: 2}).then((users) => {
63
- participants = users;
64
- spock = participants[0];
65
-
66
- return Promise.all(
67
- Array.map(participants, (participant) => {
68
- participant.webex = new WebexCore({
69
- credentials: {
70
- authorization: participant.token,
71
- },
72
- });
73
-
74
- return participant.webex.internal.mercury.connect();
75
- })
76
- );
77
- })
78
- );
79
-
80
- before('create conversation', () =>
81
- retry(() =>
82
- participants[0].webex.internal.conversation.create({
83
- displayName: 'Test Lyra Conversation',
84
- participants,
85
- })
86
- ).then((c) => {
87
- conversation = c;
88
-
89
- return conversation;
90
- })
91
- );
92
-
93
- describe('#getAudioState', () => {
94
- let audioState;
95
-
96
- before('put audio state', () => {
97
- audioState = {
98
- volume: {
99
- level: 2,
100
- },
101
- microphones: {
102
- muted: false,
103
- },
104
- deviceUrl: lyraMachine.webex.internal.device.url,
105
- };
106
-
107
- return lyraMachine.webex.internal.lyra.device.putAudioState(lyraMachine.space, audioState);
108
- });
109
-
110
- it('returns audio state', () =>
111
- lyraMachine.webex.internal.lyra.device.getAudioState(lyraMachine.space).then((res) => {
112
- assert.equal(res.microphones.muted, audioState.microphones.muted);
113
- assert.equal(res.volume.level, audioState.volume.level);
114
- }));
115
- });
116
-
117
- // Skip until we can bind a conversation to lyra space by posting capabilities to Lyra.
118
- describe.skip('when a call is in progress', () => {
119
- before('ensure participant joined space', () =>
120
- spock.webex.internal.lyra.space
121
- .join(lyraSpace)
122
- .then(() =>
123
- lyraMachine.webex.internal.lyra.space.verifyOccupant(lyraMachine.space, spock.id)
124
- )
125
- .then(() => spock.webex.internal.lyra.space.bindConversation(lyraSpace, conversation))
126
- );
127
-
128
- before('make a call', () => {
129
- const locus = {
130
- url: conversation.locusUrl,
131
- correlationId: uuid.v4(),
132
- };
133
-
134
- return spock.webex.request({
135
- method: 'POST',
136
- uri: `${locus.url}/participant`,
137
- body: {
138
- correlationId: locus.correlationId,
139
- deviceUrl: spock.webex.internal.device.url,
140
- localMedias: [],
141
- },
142
- });
143
- });
144
-
145
- after('remove binding', () =>
146
- spock.webex.internal.lyra.space
147
- .unbindConversation(lyraMachine.space, conversation)
148
- // After hooks shouldn't be able to break tests
149
- .catch((err) => console.error(err))
150
- );
151
-
152
- it('mutes', () => {
153
- spock.webex.internal.lyra.device.mute(lyraMachine.space);
154
-
155
- return lyraMachine.webex.internal.mercury
156
- .when('event:lyra.space_audio_microphones_mute_action')
157
- .then(([event]) => {
158
- assert.equal(event.data.action, 'mute');
159
- });
160
- });
161
-
162
- it('unmutes', () => {
163
- spock.webex.internal.lyra.device.unmute(lyraMachine.space);
164
-
165
- return lyraMachine.webex.internal.mercury
166
- .when('event:lyra.space_audio_microphones_mute_action')
167
- .then(([event]) => {
168
- assert.equal(event.data.action, 'unMute');
169
- });
170
- });
171
-
172
- it('increases volume', () => {
173
- spock.webex.internal.lyra.device.increaseVolume(lyraMachine.space);
174
-
175
- return lyraMachine.webex.internal.mercury
176
- .when('event:lyra.space_audio_volume_change_action')
177
- .then(([event]) => {
178
- assert.equal(event.data.action, 'increase');
179
- });
180
- });
181
-
182
- it('decreases volume', () => {
183
- spock.webex.internal.lyra.device.decreaseVolume(lyraMachine.space);
184
-
185
- return lyraMachine.webex.internal.mercury
186
- .when('event:lyra.space_audio_volume_change_action')
187
- .then(([event]) => {
188
- assert.equal(event.data.action, 'decrease');
189
- });
190
- });
191
-
192
- it('sets volume', () => {
193
- spock.webex.internal.lyra.device.setVolume(lyraMachine.space, 2);
194
-
195
- return lyraMachine.webex.internal.mercury
196
- .when('event:lyra.space_audio_volume_set_action')
197
- .then(([event]) => {
198
- assert.equal(event.data.level, 2);
199
- });
200
- });
201
- });
202
- });
203
- });
1
+ /*!
2
+ * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
3
+ */
4
+
5
+ import '@webex/internal-plugin-lyra';
6
+
7
+ import {assert} from '@webex/test-helper-chai';
8
+ import retry from '@webex/test-helper-retry';
9
+ import testUsers from '@webex/test-helper-test-users';
10
+ // FIXME
11
+ // eslint-disable-next-line import/no-unresolved
12
+ import {generateRandomString} from '@ciscospark/test-users-legacy';
13
+ import WebexCore from '@webex/webex-core';
14
+ import uuid from 'uuid';
15
+
16
+ describe('plugin-lyra', () => {
17
+ describe('Device', () => {
18
+ let participants;
19
+ let lyraMachine;
20
+ let lyraSpace; // space with details of lyra URIs
21
+ let spock;
22
+ let conversation;
23
+
24
+ before('create lyra machine', function () {
25
+ this.timeout(retry.timeout(20000));
26
+
27
+ return retry(() =>
28
+ testUsers.create({
29
+ count: 1,
30
+ config: {
31
+ machineType: 'LYRA_SPACE',
32
+ type: 'MACHINE',
33
+ password: `${generateRandomString(32)}d_wA*`,
34
+ },
35
+ })
36
+ )
37
+ .then((machines) => {
38
+ lyraMachine = machines[0];
39
+ lyraMachine.webex = new WebexCore({
40
+ credentials: {
41
+ authorization: lyraMachine.token,
42
+ },
43
+ });
44
+
45
+ // binding to conversation only works with webex board device
46
+ lyraMachine.webex.internal.device.config.defaults.deviceType = 'SPARK_BOARD';
47
+ lyraMachine.webex.internal.device.config.defaults.model = 'WebexBoard Test';
48
+ lyraMachine.webex.internal.device.config.defaults.localizedModel = 'WebexJSSDKTest';
49
+ lyraMachine.webex.internal.device.config.defaults.systemVersion = 'WebexJSSDKTest';
50
+ lyraMachine.webex.internal.device.config.defaults.systemName = 'Darling';
51
+
52
+ return lyraMachine.webex.internal.mercury.connect();
53
+ })
54
+ .then(() => lyraMachine.webex.internal.lyra.space.get({id: lyraMachine.id}))
55
+ .then((space) => {
56
+ lyraMachine.space = space;
57
+ lyraSpace = Object.assign({}, space, {url: `/spaces/${space.identity.id}`});
58
+ });
59
+ });
60
+
61
+ before('create users', () =>
62
+ testUsers.create({count: 2}).then((users) => {
63
+ participants = users;
64
+ spock = participants[0];
65
+
66
+ return Promise.all(
67
+ Array.map(participants, (participant) => {
68
+ participant.webex = new WebexCore({
69
+ credentials: {
70
+ authorization: participant.token,
71
+ },
72
+ });
73
+
74
+ return participant.webex.internal.mercury.connect();
75
+ })
76
+ );
77
+ })
78
+ );
79
+
80
+ before('create conversation', () =>
81
+ retry(() =>
82
+ participants[0].webex.internal.conversation.create({
83
+ displayName: 'Test Lyra Conversation',
84
+ participants,
85
+ })
86
+ ).then((c) => {
87
+ conversation = c;
88
+
89
+ return conversation;
90
+ })
91
+ );
92
+
93
+ describe('#getAudioState', () => {
94
+ let audioState;
95
+
96
+ before('put audio state', () => {
97
+ audioState = {
98
+ volume: {
99
+ level: 2,
100
+ },
101
+ microphones: {
102
+ muted: false,
103
+ },
104
+ deviceUrl: lyraMachine.webex.internal.device.url,
105
+ };
106
+
107
+ return lyraMachine.webex.internal.lyra.device.putAudioState(lyraMachine.space, audioState);
108
+ });
109
+
110
+ it('returns audio state', () =>
111
+ lyraMachine.webex.internal.lyra.device.getAudioState(lyraMachine.space).then((res) => {
112
+ assert.equal(res.microphones.muted, audioState.microphones.muted);
113
+ assert.equal(res.volume.level, audioState.volume.level);
114
+ }));
115
+ });
116
+
117
+ // Skip until we can bind a conversation to lyra space by posting capabilities to Lyra.
118
+ describe.skip('when a call is in progress', () => {
119
+ before('ensure participant joined space', () =>
120
+ spock.webex.internal.lyra.space
121
+ .join(lyraSpace)
122
+ .then(() =>
123
+ lyraMachine.webex.internal.lyra.space.verifyOccupant(lyraMachine.space, spock.id)
124
+ )
125
+ .then(() => spock.webex.internal.lyra.space.bindConversation(lyraSpace, conversation))
126
+ );
127
+
128
+ before('make a call', () => {
129
+ const locus = {
130
+ url: conversation.locusUrl,
131
+ correlationId: uuid.v4(),
132
+ };
133
+
134
+ return spock.webex.request({
135
+ method: 'POST',
136
+ uri: `${locus.url}/participant`,
137
+ body: {
138
+ correlationId: locus.correlationId,
139
+ deviceUrl: spock.webex.internal.device.url,
140
+ localMedias: [],
141
+ },
142
+ });
143
+ });
144
+
145
+ after('remove binding', () =>
146
+ spock.webex.internal.lyra.space
147
+ .unbindConversation(lyraMachine.space, conversation)
148
+ // After hooks shouldn't be able to break tests
149
+ .catch((err) => console.error(err))
150
+ );
151
+
152
+ it('mutes', () => {
153
+ spock.webex.internal.lyra.device.mute(lyraMachine.space);
154
+
155
+ return lyraMachine.webex.internal.mercury
156
+ .when('event:lyra.space_audio_microphones_mute_action')
157
+ .then(([event]) => {
158
+ assert.equal(event.data.action, 'mute');
159
+ });
160
+ });
161
+
162
+ it('unmutes', () => {
163
+ spock.webex.internal.lyra.device.unmute(lyraMachine.space);
164
+
165
+ return lyraMachine.webex.internal.mercury
166
+ .when('event:lyra.space_audio_microphones_mute_action')
167
+ .then(([event]) => {
168
+ assert.equal(event.data.action, 'unMute');
169
+ });
170
+ });
171
+
172
+ it('increases volume', () => {
173
+ spock.webex.internal.lyra.device.increaseVolume(lyraMachine.space);
174
+
175
+ return lyraMachine.webex.internal.mercury
176
+ .when('event:lyra.space_audio_volume_change_action')
177
+ .then(([event]) => {
178
+ assert.equal(event.data.action, 'increase');
179
+ });
180
+ });
181
+
182
+ it('decreases volume', () => {
183
+ spock.webex.internal.lyra.device.decreaseVolume(lyraMachine.space);
184
+
185
+ return lyraMachine.webex.internal.mercury
186
+ .when('event:lyra.space_audio_volume_change_action')
187
+ .then(([event]) => {
188
+ assert.equal(event.data.action, 'decrease');
189
+ });
190
+ });
191
+
192
+ it('sets volume', () => {
193
+ spock.webex.internal.lyra.device.setVolume(lyraMachine.space, 2);
194
+
195
+ return lyraMachine.webex.internal.mercury
196
+ .when('event:lyra.space_audio_volume_set_action')
197
+ .then(([event]) => {
198
+ assert.equal(event.data.level, 2);
199
+ });
200
+ });
201
+ });
202
+ });
203
+ });