-
Notifications
You must be signed in to change notification settings - Fork 78
Expand file tree
/
Copy pathHorizontalGalleryResizing.test.ts
More file actions
163 lines (137 loc) · 6.76 KB
/
HorizontalGalleryResizing.test.ts
File metadata and controls
163 lines (137 loc) · 6.76 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
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
import { expect } from '@playwright/test';
import { IDS } from '../../common/constants';
import { dataUiId, isTestProfileMobile, pageClick, waitForSelector, waitForSelectorCount } from '../../common/utils';
import {
addVideoStream,
buildUrlWithMockAdapter,
defaultMockCallAdapterState,
defaultMockRemoteParticipant,
test
} from './fixture';
test.describe('Height gallery resizing tests', async () => {
test('resize should have the tiles all change to the same size within expected bounds', async ({
page,
serverUrl
}, testInfo) => {
test.skip(isTestProfileMobile(testInfo));
const paul = defaultMockRemoteParticipant('Paul Bridges');
addVideoStream(paul, true);
const fiona = defaultMockRemoteParticipant('Fiona Harper');
addVideoStream(fiona, true);
const reina = defaultMockRemoteParticipant('Reina Takizawa');
const vasily = defaultMockRemoteParticipant('Vasily Podkolzin');
const participants = [
paul,
defaultMockRemoteParticipant('Eryka Klein'),
fiona,
defaultMockRemoteParticipant('Pardeep Singh'),
reina,
vasily,
defaultMockRemoteParticipant('Luciana Rodriguez'),
defaultMockRemoteParticipant('Antonie van Leeuwenhoek'),
defaultMockRemoteParticipant('Gerald Ho')
];
const initialState = defaultMockCallAdapterState(participants);
// set the initial viewPort size to activate the horizontalGallery.
await page.setViewportSize({ width: 500, height: 500 });
await page.goto(buildUrlWithMockAdapter(serverUrl, initialState));
// wait for the tiles to load
const horiztonalTiles = await waitForSelector(page, dataUiId(IDS.horizontalGalleryVideoTile));
// check that the initial sizes are correct for the vertical tiles.
expect(await horiztonalTiles.evaluate((e) => (e as HTMLDivElement).clientWidth)).toBeGreaterThanOrEqual(120);
expect(await horiztonalTiles.evaluate((e) => (e as HTMLDivElement).clientWidth)).toBeLessThanOrEqual(215);
// resize the window.
await page.setViewportSize({ width: 600, height: 500 });
// verify that the sizes are still within the correct boundaries.
expect(await horiztonalTiles.evaluate((e) => (e as HTMLDivElement).clientWidth)).toBeGreaterThanOrEqual(120);
expect(await horiztonalTiles.evaluate((e) => (e as HTMLDivElement).clientWidth)).toBeLessThanOrEqual(215);
});
test('resize should appropriately add tiles if room', async ({ page, serverUrl }, testInfo) => {
test.skip(isTestProfileMobile(testInfo));
const paul = defaultMockRemoteParticipant('Paul Bridges');
addVideoStream(paul, true);
const fiona = defaultMockRemoteParticipant('Fiona Harper');
addVideoStream(fiona, true);
const reina = defaultMockRemoteParticipant('Reina Takizawa');
const vasily = defaultMockRemoteParticipant('Vasily Podkolzin');
const participants = [
paul,
defaultMockRemoteParticipant('Eryka Klein'),
fiona,
defaultMockRemoteParticipant('Pardeep Singh'),
reina,
vasily,
defaultMockRemoteParticipant('Luciana Rodriguez'),
defaultMockRemoteParticipant('Antonie van Leeuwenhoek'),
defaultMockRemoteParticipant('Gerald Ho')
];
const initialState = defaultMockCallAdapterState(participants);
await page.goto(buildUrlWithMockAdapter(serverUrl, initialState));
// set the initial viewPort size to activate the horizontalGallery.
await page.setViewportSize({ width: 600, height: 600 });
// wait for the tiles to load
await waitForSelector(page, dataUiId(IDS.horizontalGalleryVideoTile));
// check initial tile number to be correct.
await waitForSelectorCount(page, dataUiId(IDS.horizontalGalleryVideoTile), 2);
// resize the window.
await page.setViewportSize({ width: 800, height: 600 });
// verify that we added a tile with the extra spacing.
await waitForSelectorCount(page, dataUiId(IDS.horizontalGalleryVideoTile), 3);
});
test('resize should appropriately remove tiles if needed', async ({ page, serverUrl }, testInfo) => {
test.skip(isTestProfileMobile(testInfo));
const paul = defaultMockRemoteParticipant('Paul Bridges');
addVideoStream(paul, true);
const fiona = defaultMockRemoteParticipant('Fiona Harper');
addVideoStream(fiona, true);
const reina = defaultMockRemoteParticipant('Reina Takizawa');
const vasily = defaultMockRemoteParticipant('Vasily Podkolzin');
const participants = [
paul,
defaultMockRemoteParticipant('Eryka Klein'),
fiona,
defaultMockRemoteParticipant('Pardeep Singh'),
reina,
vasily,
defaultMockRemoteParticipant('Luciana Rodriguez'),
defaultMockRemoteParticipant('Antonie van Leeuwenhoek'),
defaultMockRemoteParticipant('Gerald Ho')
];
const initialState = defaultMockCallAdapterState(participants);
await page.goto(buildUrlWithMockAdapter(serverUrl, initialState));
// set the initial viewPort size to activate the horizontalGallery.
await page.setViewportSize({ width: 800, height: 600 });
// wait for the tiles to load
await waitForSelector(page, dataUiId(IDS.horizontalGalleryVideoTile));
// check initial tile number to be correct.
await waitForSelectorCount(page, dataUiId(IDS.horizontalGalleryVideoTile), 3);
// resize the window.
await page.setViewportSize({ width: 600, height: 600 });
// verify that we added a tile with the extra spacing.
await waitForSelectorCount(page, dataUiId(IDS.horizontalGalleryVideoTile), 2);
});
test('single user on last page should use largest size', async ({ page, serverUrl }, testInfo) => {
test.skip(isTestProfileMobile(testInfo));
const paul = defaultMockRemoteParticipant('Paul Bridges');
addVideoStream(paul, true);
const participants = [
paul,
defaultMockRemoteParticipant('Eryka Klein'),
defaultMockRemoteParticipant('Fiona Harper'),
defaultMockRemoteParticipant('Reina Takizawa'),
defaultMockRemoteParticipant('Luciana Rodriguez'),
defaultMockRemoteParticipant('Gerald Ho')
];
const initialState = defaultMockCallAdapterState(participants);
await page.goto(buildUrlWithMockAdapter(serverUrl, initialState));
await page.setViewportSize({ width: 600, height: 600 });
await waitForSelector(page, dataUiId(IDS.overflowGalleryRightNavButton));
// since we know that we have 2 tiles per page in this view port gerald will be the last participant.
await pageClick(page, dataUiId(IDS.overflowGalleryRightNavButton));
await pageClick(page, dataUiId(IDS.overflowGalleryRightNavButton));
const horiztonalTiles = await waitForSelector(page, dataUiId(IDS.horizontalGalleryVideoTile));
expect(await horiztonalTiles.evaluate((e) => (e as HTMLDivElement).clientWidth)).toBe(215);
});
});