Skip to content

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

fix(tests): Adds a data field in context to be reused in tests.

damencho1e82f1fb1ae6
diff --git a/tests/helpers/types.ts b/tests/helpers/types.ts
index 504d6f5477..f46bb96138 100644
--- a/tests/helpers/types.ts
+++ b/tests/helpers/types.ts
@@ -4,8 +4,7 @@ import type { Participant } from './Participant';
import type WebhookProxy from './WebhookProxy';
export type IContext = {
- conferenceJid: string;
- dialInPin: string;
+ data: any;
iframeAPI: boolean;
isJaasAvailable: () => boolean;
jwtKid: string;
@@ -15,7 +14,6 @@ export type IContext = {
p2: Participant;
p3: Participant;
p4: Participant;
- roomKey: string;
roomName: string;
skipSuiteTests: boolean;
times: any;
diff --git a/tests/specs/2way/iFrameApiParticipantsPresence.spec.ts b/tests/specs/2way/iFrameApiParticipantsPresence.spec.ts
index 9430aa7083..500fc74d87 100644
--- a/tests/specs/2way/iFrameApiParticipantsPresence.spec.ts
+++ b/tests/specs/2way/iFrameApiParticipantsPresence.spec.ts
@@ -24,7 +24,7 @@ async function checkParticipantLeftHook(p: Participant, reason: string) {
} = await webhooksProxy.waitForEvent('PARTICIPANT_LEFT');
expect('PARTICIPANT_LEFT').toBe(event.eventType);
- expect(event.data.conference).toBe(ctx.conferenceJid);
+ expect(event.data.conference).toBe(ctx.data.conferenceJid);
expect(event.data.disconnectReason).toBe(reason);
expect(event.data.isBreakout).toBe(false);
expect(event.data.participantId).toBe(await p.getEndpointId());
@@ -101,7 +101,7 @@ describe('Participants presence', () => {
const { node, resource } = parseJid(roomsInfo.jid);
- ctx.conferenceJid = roomsInfo.jid.substring(0, roomsInfo.jid.indexOf('/'));
+ ctx.data.conferenceJid = roomsInfo.jid.substring(0, roomsInfo.jid.indexOf('/'));
const p1EpId = await p1.getEndpointId();
@@ -123,7 +123,7 @@ describe('Participants presence', () => {
} = await webhooksProxy.waitForEvent('ROOM_CREATED');
expect('ROOM_CREATED').toBe(event.eventType);
- expect(event.data.conference).toBe(ctx.conferenceJid);
+ expect(event.data.conference).toBe(ctx.data.conferenceJid);
expect(event.data.isBreakout).toBe(false);
}
}
@@ -287,7 +287,7 @@ describe('Participants presence', () => {
} = await webhooksProxy.waitForEvent('PARTICIPANT_JOINED');
expect('PARTICIPANT_JOINED').toBe(event.eventType);
- expect(event.data.conference).toBe(ctx.conferenceJid);
+ expect(event.data.conference).toBe(ctx.data.conferenceJid);
expect(event.data.isBreakout).toBe(false);
expect(event.data.moderator).toBe(false);
expect(event.data.name).toBe(await p2.getLocalDisplayName());
@@ -368,7 +368,7 @@ describe('Participants presence', () => {
});
it('dispose conference', async () => {
- const { conferenceJid, p1, roomName, webhooksProxy } = ctx;
+ const { data: { conferenceJid }, p1, roomName, webhooksProxy } = ctx;
await p1.switchToAPI();
diff --git a/tests/specs/2way/lockRoom.spec.ts b/tests/specs/2way/lockRoom.spec.ts
index 395565f41e..5584dd97ca 100644
--- a/tests/specs/2way/lockRoom.spec.ts
+++ b/tests/specs/2way/lockRoom.spec.ts
@@ -29,14 +29,14 @@ describe('Lock Room', () => {
const p2PasswordDialog = p2.getPasswordDialog();
await p2PasswordDialog.waitForDialog();
- await p2PasswordDialog.submitPassword(`${ctx.roomKey}1234`);
+ await p2PasswordDialog.submitPassword(`${ctx.data.roomKey}1234`);
// give sometime to the password prompt to disappear and send the password
await p2.driver.pause(500);
// wait for password prompt
await p2PasswordDialog.waitForDialog();
- await p2PasswordDialog.submitPassword(ctx.roomKey);
+ await p2PasswordDialog.submitPassword(ctx.data.roomKey);
await p2.waitToJoinMUC();
@@ -106,7 +106,7 @@ describe('Lock Room', () => {
const p2PasswordDialog = p2.getPasswordDialog();
await p2PasswordDialog.waitForDialog();
- await p2PasswordDialog.submitPassword(`${ctx.roomKey}1234`);
+ await p2PasswordDialog.submitPassword(`${ctx.data.roomKey}1234`);
// give sometime to the password prompt to disappear and send the password
await p2.driver.pause(500);
@@ -132,7 +132,7 @@ describe('Lock Room', () => {
* Participant1 locks the room.
*/
async function participant1LockRoom() {
- ctx.roomKey = `${Math.trunc(Math.random() * 1_000_000)}`;
+ ctx.data.roomKey = `${Math.trunc(Math.random() * 1_000_000)}`;
const { p1 } = ctx;
const p1SecurityDialog = p1.getSecurityDialog();
@@ -142,7 +142,7 @@ async function participant1LockRoom() {
await waitForRoomLockState(p1SecurityDialog, false);
- await p1SecurityDialog.addPassword(ctx.roomKey);
+ await p1SecurityDialog.addPassword(ctx.data.roomKey);
await p1SecurityDialog.clickCloseButton();
diff --git a/tests/specs/alone/dialInAudio.spec.ts b/tests/specs/alone/dialInAudio.spec.ts
index 7a44bebc31..da5302e6b2 100644
--- a/tests/specs/alone/dialInAudio.spec.ts
+++ b/tests/specs/alone/dialInAudio.spec.ts
@@ -42,7 +42,7 @@ describe('Dial-In', () => {
expect(dialInPin.length >= 8).toBe(true);
- ctx.dialInPin = dialInPin;
+ ctx.data.dialInPin = dialInPin;
});
it('invite dial-in participant', async () => {
@@ -51,7 +51,7 @@ describe('Dial-In', () => {
return;
}
- const restUrl = process.env.DIAL_IN_REST_URL?.replace('{0}', ctx.dialInPin);
+ const restUrl = process.env.DIAL_IN_REST_URL?.replace('{0}', ctx.data.dialInPin);
// we have already checked in the first test that DIAL_IN_REST_URL exist so restUrl cannot be ''
const responseData: string = await new Promise((resolve, reject) => {
diff --git a/tests/wdio.conf.ts b/tests/wdio.conf.ts
index b2cdc3279a..ab4705c333 100644
--- a/tests/wdio.conf.ts
+++ b/tests/wdio.conf.ts
@@ -183,6 +183,7 @@ export const config: WebdriverIO.MultiremoteConfig = {
const globalAny: any = global;
globalAny.ctx = {
+ data: {},
times: {}
} as IContext;
globalAny.ctx.keepAlive = [];