Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

feat(test): Implement hangupAllParticipants

Hristo Terezov7ec3eae72bb7
diff --git a/tests/helpers/participants.ts b/tests/helpers/participants.ts
index f7e0b233cc..088da581f2 100644
--- a/tests/helpers/participants.ts
+++ b/tests/helpers/participants.ts
@@ -346,3 +346,12 @@ export async function checkForScreensharingTile(sharer: Participant, observer: P
reverse
});
}
+
+/**
+ * Hangs up all participants (p1, p2, p3 and p4)
+ * @returns {Promise<void>}
+ */
+export function hangupAllParticipants() {
+ return Promise.all([ ctx.p1?.hangup(), ctx.p2?.hangup(), ctx.p3?.hangup(), ctx.p4?.hangup() ]
+ .map(p => p ?? Promise.resolve()));
+}
diff --git a/tests/specs/3way/audioVideoModeration.spec.ts b/tests/specs/3way/audioVideoModeration.spec.ts
index e312ac9432..192eef6bc5 100644
--- a/tests/specs/3way/audioVideoModeration.spec.ts
+++ b/tests/specs/3way/audioVideoModeration.spec.ts
@@ -2,6 +2,7 @@ import { Participant } from '../../helpers/Participant';
import {
ensureOneParticipant,
ensureThreeParticipants, ensureTwoParticipants,
+ hangupAllParticipants,
unmuteAudioAndCheck,
unmuteVideoAndCheck
} from '../../helpers/participants';
@@ -120,7 +121,7 @@ describe('AVModeration', () => {
await moderatorParticipantsPane.getAVModerationMenu().clickStopVideoModeration();
});
it('grant moderator', async () => {
- await Promise.all([ ctx.p1.hangup(), ctx.p2.hangup(), ctx.p3.hangup() ]);
+ await hangupAllParticipants();
await ensureThreeParticipants(ctx);
@@ -143,7 +144,7 @@ describe('AVModeration', () => {
await unmuteByModerator(p3, p2, false, true);
});
it('ask to unmute', async () => {
- await Promise.all([ ctx.p1.hangup(), ctx.p2.hangup(), ctx.p3.hangup() ]);
+ await hangupAllParticipants();
await ensureTwoParticipants(ctx);
@@ -181,7 +182,7 @@ describe('AVModeration', () => {
await tryToVideoUnmuteAndCheck(p2, p1);
});
it('join moderated', async () => {
- await Promise.all([ ctx.p1.hangup(), ctx.p2.hangup(), ctx.p3.hangup() ]);
+ await hangupAllParticipants();
await ensureOneParticipant(ctx);
diff --git a/tests/specs/3way/breakoutRooms.spec.ts b/tests/specs/3way/breakoutRooms.spec.ts
index c14dda2622..af77a75364 100644
--- a/tests/specs/3way/breakoutRooms.spec.ts
+++ b/tests/specs/3way/breakoutRooms.spec.ts
@@ -1,7 +1,12 @@
import type { ChainablePromiseElement } from 'webdriverio';
import type { Participant } from '../../helpers/Participant';
-import { checkSubject, ensureThreeParticipants, ensureTwoParticipants } from '../../helpers/participants';
+import {
+ checkSubject,
+ ensureThreeParticipants,
+ ensureTwoParticipants,
+ hangupAllParticipants
+} from '../../helpers/participants';
const MAIN_ROOM_NAME = 'Main room';
const BREAKOUT_ROOMS_LIST_ID = 'breakout-rooms-list';
@@ -309,7 +314,7 @@ describe('BreakoutRooms', () => {
});
it('send participants to breakout room', async () => {
- await Promise.all([ ctx.p1.hangup(), ctx.p2.hangup(), ctx.p3.hangup() ]);
+ await hangupAllParticipants();
// because the participants rejoin so fast, the meeting is not properly ended,
// so the previous breakout rooms would still be there.
diff --git a/tests/specs/3way/codecSelection.spec.ts b/tests/specs/3way/codecSelection.spec.ts
index f994f91217..56c7b2f312 100644
--- a/tests/specs/3way/codecSelection.spec.ts
+++ b/tests/specs/3way/codecSelection.spec.ts
@@ -1,4 +1,9 @@
-import { ensureOneParticipant, ensureThreeParticipants, ensureTwoParticipants } from '../../helpers/participants';
+import {
+ ensureOneParticipant,
+ ensureThreeParticipants,
+ ensureTwoParticipants,
+ hangupAllParticipants
+} from '../../helpers/participants';
describe('Codec selection', () => {
it('asymmetric codecs', async () => {
@@ -66,7 +71,7 @@ describe('Codec selection', () => {
});
it('codec switch over', async () => {
- await Promise.all([ ctx.p1.hangup(), ctx.p2.hangup(), ctx.p3.hangup() ]);
+ await hangupAllParticipants();
await ensureTwoParticipants(ctx, {
configOverwrite: {
diff --git a/tests/specs/3way/lobby.spec.ts b/tests/specs/3way/lobby.spec.ts
index 4cbcd08bb4..754cb1c65b 100644
--- a/tests/specs/3way/lobby.spec.ts
+++ b/tests/specs/3way/lobby.spec.ts
@@ -1,5 +1,10 @@
import { P1_DISPLAY_NAME, P3_DISPLAY_NAME, Participant } from '../../helpers/Participant';
-import { ensureOneParticipant, ensureThreeParticipants, ensureTwoParticipants } from '../../helpers/participants';
+import {
+ ensureOneParticipant,
+ ensureThreeParticipants,
+ ensureTwoParticipants,
+ hangupAllParticipants
+} from '../../helpers/participants';
import type { IJoinOptions } from '../../helpers/types';
import type PreMeetingScreen from '../../pageobjects/PreMeetingScreen';
@@ -191,7 +196,7 @@ describe('Lobby', () => {
});
it('change of moderators in lobby', async () => {
- await Promise.all([ ctx.p1.hangup(), ctx.p2.hangup(), ctx.p3.hangup() ]);
+ await hangupAllParticipants();
await ensureTwoParticipants(ctx);
@@ -219,7 +224,7 @@ describe('Lobby', () => {
// here the important check is whether the moderator sees the knocking participant
await enterLobby(p2, false);
- await Promise.all([ ctx.p1.hangup(), ctx.p2.hangup(), ctx.p3.hangup() ]);
+ await hangupAllParticipants();
});
it('shared password', async () => {
@@ -263,8 +268,7 @@ describe('Lobby', () => {
});
it('enable with more than two participants', async () => {
- await Promise.all([ ctx.p1.hangup(), ctx.p2.hangup(), ctx.p3.hangup() ]);
-
+ await hangupAllParticipants();
await ensureThreeParticipants(ctx);
diff --git a/tests/specs/3way/startMuted.spec.ts b/tests/specs/3way/startMuted.spec.ts
index f201c507ae..d84624fc94 100644
--- a/tests/specs/3way/startMuted.spec.ts
+++ b/tests/specs/3way/startMuted.spec.ts
@@ -1,6 +1,7 @@
import {
ensureOneParticipant,
ensureTwoParticipants,
+ hangupAllParticipants,
joinSecondParticipant,
joinThirdParticipant,
unmuteVideoAndCheck
@@ -252,11 +253,3 @@ describe('StartMuted', () => {
await p1.getLargeVideo().assertPlaying();
});
});
-
-/**
- * Hangs up all participants (p1, p2 and p3)
- * @returns {Promise<void>}
- */
-function hangupAllParticipants() {
- return Promise.all([ ctx.p1?.hangup(), ctx.p2?.hangup(), ctx.p3?.hangup() ]);
-}
diff --git a/tests/specs/4way/desktopSharing.spec.ts b/tests/specs/4way/desktopSharing.spec.ts
index 60a4cc8ef8..2475fee7c6 100644
--- a/tests/specs/4way/desktopSharing.spec.ts
+++ b/tests/specs/4way/desktopSharing.spec.ts
@@ -4,7 +4,8 @@ import {
ensureFourParticipants,
ensureOneParticipant,
ensureThreeParticipants,
- ensureTwoParticipants
+ ensureTwoParticipants,
+ hangupAllParticipants
} from '../../helpers/participants';
describe('Desktop sharing', () => {
@@ -126,7 +127,7 @@ describe('Desktop sharing', () => {
* The call switches to jvb and then back to p2p.
*/
it('screen sharing toggle before others join', async () => {
- await Promise.all([ ctx.p1.hangup(), ctx.p2.hangup(), ctx.p3.hangup() ]);
+ await hangupAllParticipants();
await ensureOneParticipant(ctx, {
configOverwrite: {
@@ -178,7 +179,7 @@ describe('Desktop sharing', () => {
* where only a screen share can be received. A bug fixed in jvb 0c5dd91b where the video was not received.
*/
it('audio only and non dominant screen share', async () => {
- await Promise.all([ ctx.p1.hangup(), ctx.p2.hangup(), ctx.p3.hangup() ]);
+ await hangupAllParticipants();
await ensureOneParticipant(ctx);
const { p1 } = ctx;
@@ -215,7 +216,7 @@ describe('Desktop sharing', () => {
* A problem fixed in jitsi-meet 3657c19e and d6ab0a72.
*/
it('audio only and dominant screen share', async () => {
- await Promise.all([ ctx.p1.hangup(), ctx.p2.hangup(), ctx.p3.hangup() ]);
+ await hangupAllParticipants();
await ensureOneParticipant(ctx, {
configOverwrite: {
@@ -264,7 +265,7 @@ describe('Desktop sharing', () => {
* Test screensharing with lastN. We add p4 with lastN=2 and verify that it receives the expected streams.
*/
it('with lastN', async () => {
- await Promise.all([ ctx.p1.hangup(), ctx.p2.hangup(), ctx.p3.hangup() ]);
+ await hangupAllParticipants();
await ensureThreeParticipants(ctx);
const { p1, p2, p3 } = ctx;