-
Notifications
You must be signed in to change notification settings - Fork 73
/
Copy pathMediaAccess.test.ts
64 lines (56 loc) · 2.68 KB
/
MediaAccess.test.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { buildUrlWithMockAdapter, defaultMockCallAdapterState, defaultMockRemoteParticipant, test } from './fixture';
import { expect } from '@playwright/test';
import { dataUiId, isTestProfileMobile, stableScreenshot, waitForSelector } from '../../common/utils';
import { IDS } from '../../common/constants';
/* @conditional-compile-remove(media-access) */
test.describe('Media access mic/camera forbid/permit tests', async () => {
test('When capabilities true, mic and carmera enabled on call control bar and self video tile', async ({
page,
serverUrl
}, testInfo) => {
const Paul = defaultMockRemoteParticipant('Paul Blurt');
const participants = [Paul];
const initialState = defaultMockCallAdapterState(participants, 'Presenter', false, undefined, true);
await page.goto(buildUrlWithMockAdapter(serverUrl, initialState, { newControlBarExperience: 'true' }));
if (isTestProfileMobile(testInfo)) {
await waitForSelector(page, dataUiId(IDS.microphoneButton));
await waitForSelector(page, dataUiId(IDS.cameraButton));
expect(await stableScreenshot(page)).toMatchSnapshot(
'media-access-audio-video-permitted-in-ongoing-call-mobile.png'
);
} else {
await waitForSelector(page, dataUiId(IDS.microphoneButton));
await waitForSelector(page, dataUiId(IDS.cameraButton));
expect(await stableScreenshot(page)).toMatchSnapshot(
'media-access-audio-video-permitted-in-ongoing-call-desktop.png'
);
}
});
test('When capabilities false, mic and carmera disabled on call control bar and self video tile', async ({
page,
serverUrl
}, testInfo) => {
const Paul = defaultMockRemoteParticipant('Paul Blurt');
const participants = [Paul];
const initialState = defaultMockCallAdapterState(participants, 'Attendee', false, undefined, undefined, true);
if (initialState.call) {
initialState.call.isMuted = true;
}
await page.goto(buildUrlWithMockAdapter(serverUrl, initialState, { newControlBarExperience: 'true' }));
if (isTestProfileMobile(testInfo)) {
await waitForSelector(page, dataUiId(IDS.microphoneButton));
await waitForSelector(page, dataUiId(IDS.cameraButton));
expect(await stableScreenshot(page)).toMatchSnapshot(
'media-access-audio-video-forbidden-in-ongoing-call-mobile.png'
);
} else {
await waitForSelector(page, dataUiId(IDS.microphoneButton));
await waitForSelector(page, dataUiId(IDS.cameraButton));
expect(await stableScreenshot(page)).toMatchSnapshot(
'media-access-audio-video-forbidden-in-ongoing-call-desktop.png'
);
}
});
});