-
Notifications
You must be signed in to change notification settings - Fork 78
Expand file tree
/
Copy pathTogetherModeOverlay.test.ts
More file actions
351 lines (323 loc) · 14.7 KB
/
TogetherModeOverlay.test.ts
File metadata and controls
351 lines (323 loc) · 14.7 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import {
addTogetherModeStream,
addVideoStream,
buildUrlWithMockAdapter,
defaultMockCallAdapterState,
defaultMockRemoteParticipant,
test
} from './fixture';
import { expect } from '@playwright/test';
import { dataUiId, isTestProfileMobile, pageClick, stableScreenshot, waitForSelector } from '../../common/utils';
import {
IDS,
togetherModeSeatingPosition_w_1912_h_600,
togetherModeSeatingPosition_w_700_h_500
} from '../../common/constants';
import { CallKind } from '@azure/communication-calling';
import type { MockRemoteParticipantState } from '../../../common';
test.describe('Confirm Start Together layout view option ', async () => {
test('Confirm together mode is not shown in ACS Call', async ({ page, serverUrl }, testInfo) => {
test.skip(isTestProfileMobile(testInfo));
// Remote Participants is ACS Identity
const vasily = defaultMockRemoteParticipant('Vasily');
const paul = defaultMockRemoteParticipant('Paul');
const participants = [vasily, paul];
addVideoStream(vasily, true);
addVideoStream(paul, true);
// Local Participant is ACS Identity
const initialState = defaultMockCallAdapterState(participants);
if (initialState.call) {
initialState.call.togetherMode.isActive = true;
}
await page.goto(
buildUrlWithMockAdapter(serverUrl, initialState, {
newControlBarExperience: 'true'
})
);
await waitForSelector(page, dataUiId(IDS.moreButton));
await pageClick(page, dataUiId(IDS.moreButton));
await page.locator('button:has-text("View")').click();
expect(await stableScreenshot(page)).toMatchSnapshot('together-mode-view-option-hidden-in-acs-call.png');
});
test('Confirm together mode is enabled for Teams Call', async ({ page, serverUrl }, testInfo) => {
test.skip(isTestProfileMobile(testInfo));
// Remote Participant is Teams Identity
const vasily = defaultMockRemoteParticipant('Vasily', true);
const paul = defaultMockRemoteParticipant('Paul', true);
const participants = [vasily, paul];
addVideoStream(vasily, true);
addVideoStream(paul, true);
// Local Participant is Teams Identity
const initialState = defaultMockCallAdapterState(participants);
initialState.userId = { kind: 'microsoftTeamsUser', microsoftTeamsUserId: `8:orgid:localUser` };
initialState.isTeamsCall = true;
if (initialState.call) {
initialState.call.togetherMode.isActive = true;
initialState.call.kind = 'TeamsCall' as CallKind;
}
await page.goto(
buildUrlWithMockAdapter(serverUrl, initialState, {
newControlBarExperience: 'true'
})
);
await waitForSelector(page, dataUiId(IDS.moreButton));
await pageClick(page, dataUiId(IDS.moreButton));
await page.locator('button:has-text("View")').click();
expect(await stableScreenshot(page)).toMatchSnapshot('together-mode-view-option-in-teams-call.png');
});
test('Confirm together mode is enabled for Teams Meeting', async ({ page, serverUrl }, testInfo) => {
test.skip(isTestProfileMobile(testInfo));
// Remote Participant is Teams Identity
const vasily = defaultMockRemoteParticipant('Vasily', true);
const paul = defaultMockRemoteParticipant('Paul', true);
const participants = [vasily, paul];
addVideoStream(vasily, true);
addVideoStream(paul, true);
// Local Participant is Teams Identity
const initialState = defaultMockCallAdapterState(participants);
initialState.userId = { kind: 'microsoftTeamsUser', microsoftTeamsUserId: `8:orgid:localUser` };
initialState.isTeamsMeeting = true;
if (initialState.call) {
initialState.call.togetherMode.isActive = true;
initialState.call.kind = 'TeamsCall' as CallKind;
}
await page.goto(
buildUrlWithMockAdapter(serverUrl, initialState, {
newControlBarExperience: 'true'
})
);
await waitForSelector(page, dataUiId(IDS.moreButton));
await pageClick(page, dataUiId(IDS.moreButton));
await page.locator('button:has-text("View")').click();
expect(await stableScreenshot(page)).toMatchSnapshot('together-mode-view-option-in-teams-meeting.png');
});
});
test.describe('Confirm Together Mode Stream signaling events', async () => {
test('Confirm raiseHand icon and display Name in together mode layout', async ({ page, serverUrl }, testInfo) => {
test.skip(isTestProfileMobile(testInfo));
const paul = defaultMockRemoteParticipant('Paul Bridges', true);
const vasily = defaultMockRemoteParticipant('Vasily');
const participants = [paul, vasily];
addVideoStream(vasily, true);
vasily.raisedHand = { raisedHandOrderPosition: 1 };
addVideoStream(vasily, true);
const initialState = defaultMockCallAdapterState(participants);
if (initialState.call?.togetherMode) {
initialState.call.togetherMode.isActive = true;
addTogetherModeStream(initialState.call.togetherMode.streams, true);
initialState.call.togetherMode.seatingPositions = {
'8:acs:Vasily-id': { left: 0, top: 0, width: 200, height: 200 }
};
}
initialState.isTeamsCall = true;
if (initialState.call) {
initialState.call.kind = 'TeamsCall' as CallKind;
}
await page.goto(
buildUrlWithMockAdapter(serverUrl, initialState, {
newControlBarExperience: 'true'
})
);
const id = `together-mode-participant-8:acs:Vasily-id`;
await waitForSelector(page, dataUiId(IDS.moreButton));
await pageClick(page, dataUiId(IDS.moreButton));
await page.locator('button:has-text("View")').click();
await page.locator('button:has-text("Together mode")').click();
await waitForSelector(page, dataUiId(IDS.togetherModeStream));
await waitForSelector(page, dataUiId(id));
expect(await stableScreenshot(page)).toMatchSnapshot('together-mode-view-raisehand-icon.png');
});
test('Confirm spotlight icon and display Name in together mode layout', async ({ page, serverUrl }, testInfo) => {
test.skip(isTestProfileMobile(testInfo));
const paul = defaultMockRemoteParticipant('Paul Bridges', true);
const vasily = defaultMockRemoteParticipant('Vasily');
const participants = [paul, vasily];
addVideoStream(vasily, true);
vasily.spotlight = { spotlightedOrderPosition: 1 };
addVideoStream(vasily, true);
const initialState = defaultMockCallAdapterState(participants);
if (initialState.call?.togetherMode) {
initialState.call.togetherMode.isActive = true;
addTogetherModeStream(initialState.call.togetherMode.streams, true);
initialState.call.togetherMode.seatingPositions = {
'8:acs:Vasily-id': { left: 0, top: 0, width: 200, height: 200 }
};
}
initialState.isTeamsCall = true;
if (initialState.call) {
initialState.call.kind = 'TeamsCall' as CallKind;
}
await page.goto(
buildUrlWithMockAdapter(serverUrl, initialState, {
newControlBarExperience: 'true'
})
);
const id = `together-mode-participant-8:acs:Vasily-id`;
await waitForSelector(page, dataUiId(IDS.moreButton));
await pageClick(page, dataUiId(IDS.moreButton));
await page.locator('button:has-text("View")').click();
await page.locator('button:has-text("Together mode")').click();
await waitForSelector(page, dataUiId(IDS.togetherModeStream));
await waitForSelector(page, dataUiId(id));
expect(await stableScreenshot(page)).toMatchSnapshot('together-mode-view-spotlight-icon.png');
});
test('Confirm mute icon and display Name in together mode layout', async ({ page, serverUrl }, testInfo) => {
test.skip(isTestProfileMobile(testInfo));
const paul = defaultMockRemoteParticipant('Paul Bridges', true);
const vasily = defaultMockRemoteParticipant('Vasily');
const participants = [paul, vasily];
addVideoStream(vasily, true);
vasily.spotlight = { spotlightedOrderPosition: 1 };
vasily.isMuted = true;
addVideoStream(vasily, true);
const initialState = defaultMockCallAdapterState(participants);
if (initialState.call?.togetherMode) {
initialState.call.togetherMode.isActive = true;
addTogetherModeStream(initialState.call.togetherMode.streams, true);
initialState.call.togetherMode.seatingPositions = {
'8:acs:Vasily-id': { left: 0, top: 0, width: 200, height: 200 }
};
}
initialState.isTeamsCall = true;
if (initialState.call) {
initialState.call.kind = 'TeamsCall' as CallKind;
}
await page.goto(
buildUrlWithMockAdapter(serverUrl, initialState, {
newControlBarExperience: 'true'
})
);
const id = `together-mode-participant-8:acs:Vasily-id`;
await waitForSelector(page, dataUiId(IDS.moreButton));
await pageClick(page, dataUiId(IDS.moreButton));
await page.locator('button:has-text("View")').click();
await page.locator('button:has-text("Together mode")').click();
await waitForSelector(page, dataUiId(IDS.togetherModeStream));
await waitForSelector(page, dataUiId(id));
expect(await stableScreenshot(page)).toMatchSnapshot('together-mode-view-mute-icon.png');
});
test('Confirm only icons show when seating width is 100px in together mode layout', async ({
page,
serverUrl
}, testInfo) => {
test.skip(isTestProfileMobile(testInfo));
const paul = defaultMockRemoteParticipant('Paul Bridges', true);
const vasily = defaultMockRemoteParticipant('Vasily');
const participants = [paul, vasily];
addVideoStream(vasily, true);
vasily.spotlight = { spotlightedOrderPosition: 1 };
vasily.isMuted = true;
vasily.raisedHand = { raisedHandOrderPosition: 1 };
addVideoStream(vasily, true);
const initialState = defaultMockCallAdapterState(participants);
if (initialState.call?.togetherMode) {
initialState.call.togetherMode.isActive = true;
addTogetherModeStream(initialState.call.togetherMode.streams, true);
initialState.call.togetherMode.seatingPositions = {
'8:acs:Vasily-id': { left: 0, top: 0, width: 100, height: 100 }
};
}
initialState.isTeamsCall = true;
if (initialState.call) {
initialState.call.kind = 'TeamsCall' as CallKind;
}
await page.goto(
buildUrlWithMockAdapter(serverUrl, initialState, {
newControlBarExperience: 'true'
})
);
const id = `together-mode-participant-8:acs:Vasily-id`;
await waitForSelector(page, dataUiId(IDS.moreButton));
await pageClick(page, dataUiId(IDS.moreButton));
await page.locator('button:has-text("View")').click();
await page.locator('button:has-text("Together mode")').click();
await waitForSelector(page, dataUiId(IDS.togetherModeStream));
await waitForSelector(page, dataUiId(id));
expect(await stableScreenshot(page)).toMatchSnapshot('together-mode-view-icons-only.png');
});
test('Confirm multiple participants status in together mode', async ({ page, serverUrl }, testInfo) => {
test.skip(isTestProfileMobile(testInfo));
const participants = createRandomRemoteParticipantList(10);
const initialState = defaultMockCallAdapterState(participants);
if (initialState.call?.togetherMode) {
initialState.isTeamsCall = true;
initialState.call.kind = 'TeamsCall' as CallKind;
initialState.call.togetherMode.isActive = true;
addTogetherModeStream(initialState.call.togetherMode.streams, true);
initialState.call.togetherMode.seatingPositions = togetherModeSeatingPosition_w_1912_h_600;
}
await page.setViewportSize({ width: 1912, height: 600 });
await page.goto(
buildUrlWithMockAdapter(serverUrl, initialState, {
newControlBarExperience: 'true'
})
);
await waitForSelector(page, dataUiId(IDS.moreButton));
await pageClick(page, dataUiId(IDS.moreButton));
await page.locator('button:has-text("View")').click();
expect(await stableScreenshot(page)).toMatchSnapshot('together-mode-view-option-all-participants.png');
await page.locator('button:has-text("Together mode")').click();
await waitForSelector(page, dataUiId(IDS.togetherModeStream));
for (let i = 1; i <= 10; i++) {
const id = `together-mode-participant-8:orgid:Participant-${i}-id`;
await waitForSelector(page, dataUiId(id));
}
expect(await stableScreenshot(page)).toMatchSnapshot('together-mode-all-participants.png');
});
test('Confirm multiple participants status in together mode when window size is smaller', async ({
page,
serverUrl
}, testInfo) => {
test.skip(isTestProfileMobile(testInfo));
const participants = createRandomRemoteParticipantList(10);
const initialState = defaultMockCallAdapterState(participants);
if (initialState.call?.togetherMode) {
initialState.isTeamsCall = true;
initialState.call.kind = 'TeamsCall' as CallKind;
initialState.call.togetherMode.isActive = true;
addTogetherModeStream(initialState.call.togetherMode.streams, true);
initialState.call.togetherMode.seatingPositions = togetherModeSeatingPosition_w_700_h_500;
}
await page.setViewportSize({ width: 700, height: 500 });
await page.goto(
buildUrlWithMockAdapter(serverUrl, initialState, {
newControlBarExperience: 'true'
})
);
await waitForSelector(page, dataUiId(IDS.moreButton));
await pageClick(page, dataUiId(IDS.moreButton));
await page.locator('button:has-text("View")').click();
expect(await stableScreenshot(page)).toMatchSnapshot(
'together-mode-view-option-all-participants-in-smaller-size.png'
);
await page.locator('button:has-text("Together mode")').click();
await waitForSelector(page, dataUiId(IDS.togetherModeStream));
for (let i = 1; i <= 10; i++) {
const id = `together-mode-participant-8:orgid:Participant-${i}-id`;
await waitForSelector(page, dataUiId(id));
}
expect(await stableScreenshot(page)).toMatchSnapshot('together-mode-all-participants-in-smaller-size.png');
page.click(dataUiId('together-mode-participant-8:orgid:Participant-5-id'));
expect(await stableScreenshot(page)).toMatchSnapshot('together-mode-participant-1-click.png');
});
});
const createRandomRemoteParticipantList = (participantCount: number): MockRemoteParticipantState[] => {
const participants = [];
for (let i = 1; i <= participantCount; i++) {
const participant = defaultMockRemoteParticipant(`Participant-${i}`, true);
addVideoStream(participant, true);
assignRandomSignalingEvents(participant, i);
participants.push(participant);
}
return participants;
};
const assignRandomSignalingEvents = (participant: MockRemoteParticipantState, orderNumber: number): void => {
if (orderNumber % 2 === 0) {
participant.raisedHand = { raisedHandOrderPosition: orderNumber };
participant.isMuted = true;
} else {
participant.spotlight = { spotlightedOrderPosition: orderNumber };
}
};