|
@@ -0,0 +1,171 @@
|
|
1
|
+import { ensureOneParticipant, ensureTwoParticipants, joinSecondParticipant } from '../../helpers/participants';
|
|
2
|
+
|
|
3
|
+/**
|
|
4
|
+ * 1. Lock the room (make sure the image changes to locked)
|
|
5
|
+ * 2. Join with a second browser/tab
|
|
6
|
+ * 3. Make sure we are required to enter a password.
|
|
7
|
+ * (Also make sure the padlock is locked)
|
|
8
|
+ * 4. Enter wrong password, make sure we are not joined in the room
|
|
9
|
+ * 5. Unlock the room (Make sure the padlock is unlocked)
|
|
10
|
+ * 6. Join again and make sure we are not asked for a password and that
|
|
11
|
+ * the padlock is unlocked.
|
|
12
|
+ */
|
|
13
|
+describe('Lock Room', () => {
|
|
14
|
+ it('joining the meeting', () => ensureOneParticipant(ctx));
|
|
15
|
+
|
|
16
|
+ it('locks the room', () => participant1LockRoom());
|
|
17
|
+
|
|
18
|
+ it('enter participant in locked room', async () => {
|
|
19
|
+ // first enter wrong pin then correct one
|
|
20
|
+ await joinSecondParticipant(ctx, {
|
|
21
|
+ skipWaitToJoin: true,
|
|
22
|
+ skipInMeetingChecks: true
|
|
23
|
+ });
|
|
24
|
+
|
|
25
|
+ const { p2 } = ctx;
|
|
26
|
+
|
|
27
|
+ // wait for password prompt
|
|
28
|
+ const p2PasswordDialog = p2.getPasswordDialog();
|
|
29
|
+
|
|
30
|
+ await p2PasswordDialog.waitForDialog();
|
|
31
|
+ await p2PasswordDialog.submitPassword(`${ctx.roomKey}1234`);
|
|
32
|
+
|
|
33
|
+ // wait for password prompt
|
|
34
|
+ await p2PasswordDialog.waitForDialog();
|
|
35
|
+ await p2PasswordDialog.submitPassword(ctx.roomKey);
|
|
36
|
+
|
|
37
|
+ await p2.waitToJoinMUC();
|
|
38
|
+
|
|
39
|
+ const p2SecurityDialog = p2.getSecurityDialog();
|
|
40
|
+
|
|
41
|
+ await p2.getToolbar().clickSecurityButton();
|
|
42
|
+ await p2SecurityDialog.waitForDisplay();
|
|
43
|
+
|
|
44
|
+ expect(await p2SecurityDialog.isLocked()).toBe(true);
|
|
45
|
+ });
|
|
46
|
+
|
|
47
|
+ it('unlock room', async () => {
|
|
48
|
+ // Unlock room. Check whether room is still locked. Click remove and check whether it is unlocked.
|
|
49
|
+ await ctx.p2.hangup();
|
|
50
|
+
|
|
51
|
+ await participant1UnlockRoom();
|
|
52
|
+ });
|
|
53
|
+
|
|
54
|
+ it('enter participant in unlocked room', async () => {
|
|
55
|
+ // Just enter the room and check that is not locked.
|
|
56
|
+ // if we fail to unlock the room this one will detect it
|
|
57
|
+ // as participant will fail joining
|
|
58
|
+ await ensureTwoParticipants(ctx);
|
|
59
|
+
|
|
60
|
+ const { p2 } = ctx;
|
|
61
|
+ const p2SecurityDialog = p2.getSecurityDialog();
|
|
62
|
+
|
|
63
|
+ await p2.getToolbar().clickSecurityButton();
|
|
64
|
+ await p2SecurityDialog.waitForDisplay();
|
|
65
|
+
|
|
66
|
+ expect(await p2SecurityDialog.isLocked()).toBe(false);
|
|
67
|
+
|
|
68
|
+ await p2SecurityDialog.clickCloseButton();
|
|
69
|
+ });
|
|
70
|
+
|
|
71
|
+ it('update locked state while participants in room', async () => {
|
|
72
|
+ // Both participants are in unlocked room, lock it and see whether the
|
|
73
|
+ // change is reflected on the second participant icon.
|
|
74
|
+ await participant1LockRoom();
|
|
75
|
+
|
|
76
|
+ const { p2 } = ctx;
|
|
77
|
+ const p2SecurityDialog = p2.getSecurityDialog();
|
|
78
|
+
|
|
79
|
+ await p2.getToolbar().clickSecurityButton();
|
|
80
|
+ await p2SecurityDialog.waitForDisplay();
|
|
81
|
+
|
|
82
|
+ expect(await p2SecurityDialog.isLocked()).toBe(true);
|
|
83
|
+
|
|
84
|
+ await participant1UnlockRoom();
|
|
85
|
+
|
|
86
|
+ expect(await p2SecurityDialog.isLocked()).toBe(false);
|
|
87
|
+ });
|
|
88
|
+ it('unlock after participant enter wrong password', async () => {
|
|
89
|
+ // P1 locks the room. Participant tries to enter using wrong password.
|
|
90
|
+ // P1 unlocks the room and Participant submits the password prompt with no password entered and
|
|
91
|
+ // should enter of unlocked room.
|
|
92
|
+ await ctx.p2.hangup();
|
|
93
|
+ await participant1LockRoom();
|
|
94
|
+ await joinSecondParticipant(ctx, {
|
|
95
|
+ skipWaitToJoin: true,
|
|
96
|
+ skipInMeetingChecks: true
|
|
97
|
+ });
|
|
98
|
+
|
|
99
|
+ const { p2 } = ctx;
|
|
100
|
+
|
|
101
|
+ // wait for password prompt
|
|
102
|
+ const p2PasswordDialog = p2.getPasswordDialog();
|
|
103
|
+
|
|
104
|
+ await p2PasswordDialog.waitForDialog();
|
|
105
|
+ await p2PasswordDialog.submitPassword(`${ctx.roomKey}1234`);
|
|
106
|
+
|
|
107
|
+ // wait for password prompt
|
|
108
|
+ await p2PasswordDialog.waitForDialog();
|
|
109
|
+
|
|
110
|
+ await participant1UnlockRoom();
|
|
111
|
+
|
|
112
|
+ await p2PasswordDialog.clickOkButton();
|
|
113
|
+ await p2.waitToJoinMUC();
|
|
114
|
+
|
|
115
|
+ const p2SecurityDialog = p2.getSecurityDialog();
|
|
116
|
+
|
|
117
|
+ await p2.getToolbar().clickSecurityButton();
|
|
118
|
+ await p2SecurityDialog.waitForDisplay();
|
|
119
|
+
|
|
120
|
+ expect(await p2SecurityDialog.isLocked()).toBe(false);
|
|
121
|
+ });
|
|
122
|
+});
|
|
123
|
+
|
|
124
|
+/**
|
|
125
|
+ * Participant1 locks the room.
|
|
126
|
+ */
|
|
127
|
+async function participant1LockRoom() {
|
|
128
|
+ ctx.roomKey = `${Math.trunc(Math.random() * 1_000_000)}`;
|
|
129
|
+
|
|
130
|
+ const { p1 } = ctx;
|
|
131
|
+ const p1SecurityDialog = p1.getSecurityDialog();
|
|
132
|
+
|
|
133
|
+ await p1.getToolbar().clickSecurityButton();
|
|
134
|
+ await p1SecurityDialog.waitForDisplay();
|
|
135
|
+
|
|
136
|
+ expect(await p1SecurityDialog.isLocked()).toBe(false);
|
|
137
|
+
|
|
138
|
+ await p1SecurityDialog.addPassword(ctx.roomKey);
|
|
139
|
+
|
|
140
|
+ await p1SecurityDialog.clickCloseButton();
|
|
141
|
+
|
|
142
|
+ await p1.getToolbar().clickSecurityButton();
|
|
143
|
+ await p1SecurityDialog.waitForDisplay();
|
|
144
|
+
|
|
145
|
+ expect(await p1SecurityDialog.isLocked()).toBe(true);
|
|
146
|
+
|
|
147
|
+ await p1SecurityDialog.clickCloseButton();
|
|
148
|
+}
|
|
149
|
+
|
|
150
|
+/**
|
|
151
|
+ * Participant1 unlocks the room.
|
|
152
|
+ */
|
|
153
|
+async function participant1UnlockRoom() {
|
|
154
|
+ const { p1 } = ctx;
|
|
155
|
+ const p1SecurityDialog = p1.getSecurityDialog();
|
|
156
|
+
|
|
157
|
+ await p1.getToolbar().clickSecurityButton();
|
|
158
|
+ await p1SecurityDialog.waitForDisplay();
|
|
159
|
+
|
|
160
|
+ await p1SecurityDialog.removePassword();
|
|
161
|
+
|
|
162
|
+ await p1.driver.waitUntil(
|
|
163
|
+ async () => !await p1SecurityDialog.isLocked(),
|
|
164
|
+ {
|
|
165
|
+ timeout: 3_000, // 3 seconds
|
|
166
|
+ timeoutMsg: `Timeout waiting for the room to unlock for ${p1.name}.`
|
|
167
|
+ }
|
|
168
|
+ );
|
|
169
|
+
|
|
170
|
+ await p1SecurityDialog.clickCloseButton();
|
|
171
|
+}
|