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(tests): Adds preJoin test.

damencho3d3de4a884e0
diff --git a/tests/helpers/participants.ts b/tests/helpers/participants.ts
index 088da581f2..97880c33cf 100644
--- a/tests/helpers/participants.ts
+++ b/tests/helpers/participants.ts
@@ -53,6 +53,17 @@ export async function ensureThreeParticipants(ctx: IContext, options: IJoinOptio
]);
}
+/**
+ * Creates the first participant instance or prepares one for re-joining.
+ *
+ * @param {Object} ctx - The context.
+ * @param {IJoinOptions} options - The options to use when joining the participant.
+ * @returns {Promise<void>}
+ */
+export function joinFirstParticipant(ctx: IContext, options: IJoinOptions = {}): Promise<void> {
+ return joinTheModeratorAsP1(ctx, options);
+}
+
/**
* Creates the second participant instance or prepares one for re-joining.
*
diff --git a/tests/pageobjects/PreJoinScreen.ts b/tests/pageobjects/PreJoinScreen.ts
index 8a2be7ec36..f6bf59bc32 100644
--- a/tests/pageobjects/PreJoinScreen.ts
+++ b/tests/pageobjects/PreJoinScreen.ts
@@ -1,7 +1,10 @@
import PreMeetingScreen from './PreMeetingScreen';
const DISPLAY_NAME_ID = 'premeeting-name-input';
+const ERROR_ON_JOIN = 'prejoin.errorMessage';
const JOIN_BUTTON_TEST_ID = 'prejoin.joinMeeting';
+const JOIN_WITHOUT_AUDIO = 'prejoin.joinWithoutAudio';
+const OPTIONS_BUTTON = 'prejoin.joinOptions';
/**
* Page object for the PreJoin screen.
@@ -28,4 +31,25 @@ export default class PreJoinScreen extends PreMeetingScreen {
return this.participant.driver.$('[data-testid="prejoin.screen"]')
.waitForDisplayed({ timeout: 3000 });
}
+
+ /**
+ * Returns the error message displayed on the prejoin screen.
+ */
+ getErrorOnJoin() {
+ return this.participant.driver.$(`[data-testid="${ERROR_ON_JOIN}"]`);
+ }
+
+ /**
+ * Returns the join without audio button element.
+ */
+ getJoinWithoutAudioButton() {
+ return this.participant.driver.$(`[data-testid="${JOIN_WITHOUT_AUDIO}"]`);
+ }
+
+ /**
+ * Returns the join options button element.
+ */
+ getJoinOptions() {
+ return this.participant.driver.$(`[data-testid="${OPTIONS_BUTTON}"]`);
+ }
}
diff --git a/tests/specs/2way/preJoin.spec.ts b/tests/specs/2way/preJoin.spec.ts
new file mode 100644
index 0000000000..d5bd0bb9ae
--- /dev/null
+++ b/tests/specs/2way/preJoin.spec.ts
@@ -0,0 +1,125 @@
+import { ensureOneParticipant, joinFirstParticipant, joinSecondParticipant } from '../../helpers/participants';
+
+describe('PreJoin', () => {
+ it('display name required', async () => {
+ await joinFirstParticipant(ctx, {
+ configOverwrite: {
+ prejoinConfig: {
+ enabled: true,
+ },
+ requireDisplayName: true
+ },
+ skipDisplayName: true,
+ skipWaitToJoin: true,
+ skipInMeetingChecks: true
+ });
+
+ const p1PreJoinScreen = ctx.p1.getPreJoinScreen();
+
+ await p1PreJoinScreen.waitForLoading();
+
+ const joinButton = p1PreJoinScreen.getJoinButton();
+
+ await joinButton.waitForDisplayed();
+ await joinButton.click();
+
+ const error = p1PreJoinScreen.getErrorOnJoin();
+
+ await error.waitForDisplayed();
+
+ await ctx.p1.hangup();
+ });
+
+ it('without lobby', async () => {
+ await joinFirstParticipant(ctx, {
+ configOverwrite: {
+ prejoinConfig: {
+ enabled: true,
+ }
+ },
+ skipDisplayName: true,
+ skipWaitToJoin: true,
+ skipInMeetingChecks: true
+ });
+
+ const p1PreJoinScreen = ctx.p1.getPreJoinScreen();
+
+ await p1PreJoinScreen.waitForLoading();
+
+ const joinButton = p1PreJoinScreen.getJoinButton();
+
+ await joinButton.waitForDisplayed();
+
+ await ctx.p1.hangup();
+ });
+
+ it('without audio', async () => {
+ await joinFirstParticipant(ctx, {
+ configOverwrite: {
+ prejoinConfig: {
+ enabled: true,
+ }
+ },
+ skipDisplayName: true,
+ skipWaitToJoin: true,
+ skipInMeetingChecks: true
+ });
+
+ const { p1 } = ctx;
+
+ const p1PreJoinScreen = p1.getPreJoinScreen();
+
+ await p1PreJoinScreen.waitForLoading();
+
+ await p1PreJoinScreen.getJoinOptions().click();
+
+ const joinWithoutAudioBtn = p1PreJoinScreen.getJoinWithoutAudioButton();
+
+ await joinWithoutAudioBtn.waitForClickable();
+ await joinWithoutAudioBtn.click();
+
+ await p1.waitToJoinMUC();
+
+ await p1.driver.$('//div[contains(@class, "audio-preview")]//div[contains(@class, "toolbox-icon") '
+ + 'and contains(@class, "toggled") and contains(@class, "disabled")]')
+ .waitForDisplayed();
+
+ await ctx.p1.hangup();
+ });
+
+ it('with lobby', async () => {
+ await ensureOneParticipant(ctx);
+
+ const { p1 } = ctx;
+
+ const p1SecurityDialog = p1.getSecurityDialog();
+
+ await p1.getToolbar().clickSecurityButton();
+ await p1SecurityDialog.waitForDisplay();
+
+ expect(await p1SecurityDialog.isLobbyEnabled()).toBe(false);
+
+ await p1SecurityDialog.toggleLobby();
+ await p1SecurityDialog.waitForLobbyEnabled();
+
+ await joinSecondParticipant(ctx, {
+ configOverwrite: {
+ prejoinConfig: {
+ enabled: true,
+ }
+ },
+ skipDisplayName: true,
+ skipWaitToJoin: true,
+ skipInMeetingChecks: true
+ });
+
+ const p1PreJoinScreen = ctx.p2.getPreJoinScreen();
+
+ await p1PreJoinScreen.waitForLoading();
+
+ const joinButton = p1PreJoinScreen.getJoinButton();
+
+ await joinButton.waitForDisplayed();
+
+ });
+});