-
Notifications
You must be signed in to change notification settings - Fork 78
Expand file tree
/
Copy pathLobbyScreen.test.ts
More file actions
74 lines (58 loc) · 2.56 KB
/
LobbyScreen.test.ts
File metadata and controls
74 lines (58 loc) · 2.56 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
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { expect } from '@playwright/test';
import {
buildUrlWithMockAdapter,
defaultMockCallAdapterState,
defaultMockRemoteParticipant,
defaultMockRemotePSTNParticipant,
test
} from './fixture';
import { IDS } from '../../common/constants';
import { dataUiId, stableScreenshot, waitForSelector } from '../../common/utils';
test.describe('Lobby page tests', async () => {
test('Lobby page shows correct strings when joining a group call', async ({ page, serverUrl }) => {
const dina = defaultMockRemoteParticipant('Dina');
/**
* remote participants reflect as this state for a moment before the user connects.
*
* Dina exists to demonstrate that we don't see the 'Calling' string when joining a group call as a flash.
*/
dina.state = 'Idle';
const participants = [dina];
const initialState = defaultMockCallAdapterState(participants);
if (initialState.call) {
initialState.call.state = 'Connecting';
}
initialState.page = 'lobby';
await page.goto(buildUrlWithMockAdapter(serverUrl, initialState));
await waitForSelector(page, dataUiId(IDS.lobbyScreenTitle));
expect(await stableScreenshot(page)).toMatchSnapshot('lobby-page-group-call.png');
});
test('lobby page shows correct strings when starting a ACS outbound call', async ({ page, serverUrl }) => {
const joel = defaultMockRemoteParticipant('Joel');
joel.state = 'Connecting';
const participants = [joel];
const initialState = defaultMockCallAdapterState(participants);
if (initialState.call) {
initialState.call.state = 'Connecting';
}
initialState.page = 'lobby';
await page.goto(buildUrlWithMockAdapter(serverUrl, initialState));
await waitForSelector(page, dataUiId(IDS.lobbyScreenTitle));
expect(await stableScreenshot(page)).toMatchSnapshot('lobby-page-one-to-n-call.png');
});
test('lobby page shows correct strings when starting a PSTN outbound call', async ({ page, serverUrl }) => {
const ellie = defaultMockRemotePSTNParticipant('15556667777');
ellie.state = 'Ringing';
const participants = [ellie];
const initialState = defaultMockCallAdapterState(participants);
if (initialState.call) {
initialState.call.state = 'Connecting';
}
initialState.page = 'lobby';
await page.goto(buildUrlWithMockAdapter(serverUrl, initialState));
await waitForSelector(page, dataUiId(IDS.lobbyScreenTitle));
expect(await stableScreenshot(page)).toMatchSnapshot('lobby-page-pstn-call.png');
});
});