Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
feat(tests): Adds lobby test.
damenchod67054a55014
diff --git a/tests/helpers/Participant.ts b/tests/helpers/Participant.tsindex 7630d9af61..5e44f9b998 100644--- a/tests/helpers/Participant.ts+++ b/tests/helpers/Participant.ts@@ -10,8 +10,11 @@ import ChatPanel from '../pageobjects/ChatPanel';import Filmstrip from '../pageobjects/Filmstrip';import IframeAPI from '../pageobjects/IframeAPI';import InviteDialog from '../pageobjects/InviteDialog';+import LobbyScreen from '../pageobjects/LobbyScreen';import Notifications from '../pageobjects/Notifications';import ParticipantsPane from '../pageobjects/ParticipantsPane';+import PreJoinScreen from '../pageobjects/PreJoinScreen';+import SecurityDialog from '../pageobjects/SecurityDialog';import SettingsDialog from '../pageobjects/SettingsDialog';import Toolbar from '../pageobjects/Toolbar';import VideoQualityDialog from '../pageobjects/VideoQualityDialog';@@ -19,6 +22,11 @@ import VideoQualityDialog from '../pageobjects/VideoQualityDialog';import { LOG_PREFIX, logInfo } from './browserLogger';import { IContext, IJoinOptions } from './types';+export const P1_DISPLAY_NAME = 'p1';+export const P2_DISPLAY_NAME = 'p2';+export const P3_DISPLAY_NAME = 'p3';+export const P4_DISPLAY_NAME = 'p4';+/*** Participant.*/@@ -29,6 +37,7 @@ export class Participant {* @private*/private _name: string;+ private _displayName: string;private _endpointId: string;private _jwt?: string;@@ -103,6 +112,13 @@ export class Participant {return this._name;}+ /**+ * The name.+ */+ get displayName() {+ return this._displayName || this.name;+ }+/*** Adds a log to the participants log file.*@@ -135,7 +151,7 @@ export class Participant {if (!options.skipDisplayName) {// @ts-ignoreconfig.userInfo = {- displayName: options.displayName || this._name+ displayName: this._displayName = options.displayName || this._name};}@@ -173,7 +189,9 @@ export class Participant {await this.driver.switchFrame(mainFrame);}- await this.waitToJoinMUC();+ if (!options.skipWaitToJoin) {+ await this.waitToJoinMUC();+ }await this.postLoadProcess(options.skipInMeetingChecks);}@@ -345,7 +363,7 @@ export class Participant {* @returns {Promise<void>}*/async waitForSendData(- timeout = 15_000, msg = `expected to send data in 15s for ${this.name}`): Promise<void> {+ timeout = 15_000, msg = `expected to send data in 15s for ${this.name}`): Promise<void> {const driver = this.driver;return driver.waitUntil(async () =>@@ -464,6 +482,15 @@ export class Participant {return new VideoQualityDialog(this);}+ /**+ * Returns the security Dialog.+ *+ * @returns {SecurityDialog}+ */+ getSecurityDialog(): SecurityDialog {+ return new SecurityDialog(this);+ }+/*** Returns the settings Dialog.*@@ -473,6 +500,20 @@ export class Participant {return new SettingsDialog(this);}+ /**+ * Returns the prejoin screen.+ */+ getPreJoinScreen(): PreJoinScreen {+ return new PreJoinScreen(this);+ }++ /**+ * Returns the lobby screen.+ */+ getLobbyScreen(): LobbyScreen {+ return new LobbyScreen(this);+ }+/*** Switches to the iframe API context*/@@ -500,6 +541,26 @@ export class Participant {* Hangups the participant by leaving the page. base.html is an empty page on all deployments.*/async hangup() {+ const current = await this.driver.getUrl();++ // already hangup+ if (current.endsWith('/base.html')) {+ return;+ }++ // do a hangup, to make sure unavailable presence is sent+ await this.driver.execute(() => typeof APP !== 'undefined' && APP?.conference?.hangup());++ // let's give it some time to leave the muc, we redirect after hangup so we should wait for the+ // change of url+ await this.driver.waitUntil(+ async () => current !== await this.driver.getUrl(),+ {+ timeout: 5000,+ timeoutMsg: `${this.name} did not leave the muc in 5s`+ }+ );+await this.driver.url('/base.html');}@@ -639,7 +700,7 @@ export class Participant {* Checks if the leave reason dialog is open.*/async isLeaveReasonDialogOpen() {- return await this.driver.$(`div[data-testid="dialog.leaveReason"]`).isDisplayed();+ return await this.driver.$('div[data-testid="dialog.leaveReason"]').isDisplayed();}/**diff --git a/tests/helpers/participants.ts b/tests/helpers/participants.tsindex f4f84bf2f9..fe867c7eb7 100644--- a/tests/helpers/participants.ts+++ b/tests/helpers/participants.ts@@ -3,7 +3,7 @@ import jwt from 'jsonwebtoken';import process from 'node:process';import { v4 as uuidv4 } from 'uuid';-import { Participant } from './Participant';+import { P1_DISPLAY_NAME, P2_DISPLAY_NAME, P3_DISPLAY_NAME, P4_DISPLAY_NAME, Participant } from './Participant';import { IContext, IJoinOptions } from './types';const SUBJECT_XPATH = '//div[starts-with(@class, "subject-text")]';@@ -34,13 +34,13 @@ export async function ensureThreeParticipants(ctx: IContext, options: IJoinOptio_joinParticipant('participant2', ctx.p2, p => {ctx.p2 = p;}, {- displayName: 'p2',+ displayName: P2_DISPLAY_NAME,...options}),_joinParticipant('participant3', ctx.p3, p => {ctx.p3 = p;}, {- displayName: 'p3',+ displayName: P3_DISPLAY_NAME,...options})]);@@ -68,19 +68,19 @@ export async function ensureFourParticipants(ctx: IContext, options: IJoinOption_joinParticipant('participant2', ctx.p2, p => {ctx.p2 = p;}, {- displayName: 'p2',+ displayName: P2_DISPLAY_NAME,...options}),_joinParticipant('participant3', ctx.p3, p => {ctx.p3 = p;}, {- displayName: 'p3',+ displayName: P3_DISPLAY_NAME,...options}),_joinParticipant('participant4', ctx.p4, p => {ctx.p4 = p;}, {- displayName: 'p4',+ displayName: P4_DISPLAY_NAME,...options})]);@@ -102,7 +102,7 @@ export async function ensureFourParticipants(ctx: IContext, options: IJoinOption* @returns {Promise<void>}*/async function joinTheModeratorAsP1(ctx: IContext, options?: IJoinOptions) {- const p1DisplayName = 'p1';+ const p1DisplayName = P1_DISPLAY_NAME;let token;// if it is jaas create the first one to be moderator and second not moderator@@ -135,7 +135,7 @@ export async function ensureTwoParticipants(ctx: IContext, options: IJoinOptions_joinParticipant('participant2', ctx.p2, p => {ctx.p2 = p;}, {- displayName: 'p2',+ displayName: P2_DISPLAY_NAME,...options}),skipInMeetingChecks ? Promise.resolve() : ctx.p1.waitForRemoteStreams(1),diff --git a/tests/helpers/types.ts b/tests/helpers/types.tsindex c1d314e4fa..8267dfb502 100644--- a/tests/helpers/types.ts+++ b/tests/helpers/types.ts@@ -45,4 +45,10 @@ export type IJoinOptions = {* Whether to skip in meeting checks like ice connected and send receive data. For single in meeting participant.*/skipInMeetingChecks?: boolean;++ /**+ * Whether to skip waiting for the participant to join the room. Cases like lobby where we do not succeed to join+ * based on the logic of the test.+ */+ skipWaitToJoin?: boolean;};diff --git a/tests/pageobjects/Filmstrip.ts b/tests/pageobjects/Filmstrip.tsindex 75d00f0070..ce5597108c 100644--- a/tests/pageobjects/Filmstrip.ts+++ b/tests/pageobjects/Filmstrip.ts@@ -210,4 +210,12 @@ export default class Filmstrip extends BasePageObject {});}++ /**+ * Counts the displayed remote video thumbnails.+ */+ async countVisibleThumbnails() {+ return (await this.participant.driver.$$('//div[@id="remoteVideos"]//span[contains(@class,"videocontainer")]')+ .filter(thumbnail => thumbnail.isDisplayed())).length;+ }}diff --git a/tests/pageobjects/LobbyScreen.ts b/tests/pageobjects/LobbyScreen.tsnew file mode 100644index 0000000000..6f909f72d7--- /dev/null+++ b/tests/pageobjects/LobbyScreen.ts@@ -0,0 +1,30 @@+import PreMeetingScreen from './PreMeetingScreen';++const DISPLAY_NAME_TEST_ID = 'lobby.nameField';+const JOIN_BUTTON_TEST_ID = 'lobby.knockButton';++/**+ * Page object for the Lobby screen.+ */+export default class LobbyScreen extends PreMeetingScreen {+ /**+ * Returns the join button element.+ */+ getJoinButton(): ChainablePromiseElement {+ return this.participant.driver.$(`[data-testid="${JOIN_BUTTON_TEST_ID}"]`);+ }++ /**+ * Returns the display name input element.+ */+ getDisplayNameInput(): ChainablePromiseElement {+ return this.participant.driver.$(`[data-testid="${DISPLAY_NAME_TEST_ID}"]`);+ }++ /**+ * Waits for lobby screen to load.+ */+ async waitForLoading() {+ await this.participant.driver.$('.lobby-screen').waitForDisplayed({ timeout: 4000 });+ }+}diff --git a/tests/pageobjects/Notifications.ts b/tests/pageobjects/Notifications.tsindex 465e8f27d3..920f59980a 100644--- a/tests/pageobjects/Notifications.ts+++ b/tests/pageobjects/Notifications.ts@@ -4,6 +4,15 @@ const ASK_TO_UNMUTE_NOTIFICATION_ID = 'notify.hostAskedUnmute';const JOIN_ONE_TEST_ID = 'notify.connectedOneMember';const JOIN_TWO_TEST_ID = 'notify.connectedTwoMembers';const JOIN_MULTIPLE_TEST_ID = 'notify.connectedThreePlusMembers';+const LOBBY_ACCESS_DENIED_TEST_ID = 'lobby.joinRejectedMessage';+const LOBBY_ENABLED_TEST_ID = 'lobby.notificationLobbyEnabled';+const LOBBY_KNOCKING_PARTICIPANT_NOTIFICATION_XPATH+ = '//div[@data-testid="notify.participantWantsToJoin"]/div/div/span';+const LOBBY_NOTIFICATIONS_TITLE_TEST_ID = 'lobby.notificationTitle';+const LOBBY_PARTICIPANT_ACCESS_DENIED_TEST_ID = 'lobby.notificationLobbyAccessDenied';+const LOBBY_PARTICIPANT_ACCESS_GRANTED_TEST_ID = 'lobby.notificationLobbyAccessGranted';+const LOBBY_PARTICIPANT_ADMIT_TEST_ID = 'participantsPane.actions.admit';+const LOBBY_PARTICIPANT_REJECT_TEST_ID = 'participantsPane.actions.reject';const RAISE_HAND_NOTIFICATION_ID = 'notify.raisedHand';const REENABLE_SELF_VIEW_NOTIFICATION_ID = 'notify.selfViewTitle';const REENABLE_SELF_VIEW_CLOSE_NOTIFICATION = 'notify.selfViewTitle-dismiss';@@ -62,4 +71,152 @@ export default class Notifications extends BasePageObject {async closeReEnableSelfViewNotification() {await this.participant.driver.$(`div[data-testid="${REENABLE_SELF_VIEW_CLOSE_NOTIFICATION}"]`).click();}++ /**+ * The notification on participants page when Lobby is being enabled or disabled.+ */+ async getLobbyEnabledText() {+ return await this.getNotificationText(LOBBY_ENABLED_TEST_ID);+ }++ /**+ * Closes a specific lobby notification.+ * @param testId+ * @private+ */+ private async closeLobbyNotification(testId: string) {+ const notification = this.participant.driver.$(`[data-testid="${testId}"]`);++ await notification.waitForExist();+ await notification.waitForStable();++ const closeButton+ = this.participant.driver.$(`[data-testid="${LOBBY_NOTIFICATIONS_TITLE_TEST_ID}"]`)+ .$('#close-notification');++ await closeButton.moveTo();+ await closeButton.click();+ }++ /**+ * Closes the notification.+ */+ async closeLobbyEnabled() {+ await this.closeLobbyNotification(LOBBY_ENABLED_TEST_ID);+ }++ /**+ * Returns the name of the knocking participant (the only one) that is displayed on the notification.+ */+ async getKnockingParticipantName() {+ const knockingParticipantNotification+ = this.participant.driver.$('//div[@data-testid="notify.participantWantsToJoin"]/div/div/span');++ await knockingParticipantNotification.waitForDisplayed({+ timeout: 3000,+ timeoutMsg: 'Knocking participant notification not displayed'+ });++ return await knockingParticipantNotification.getText();+ }++ /**+ * Admits the last knocking participant (it is the only one).+ */+ async allowLobbyParticipant() {+ const admitButton+ = this.participant.driver.$(`[data-testid="${LOBBY_PARTICIPANT_ADMIT_TEST_ID}"]`);++ await admitButton.waitForExist();+ await admitButton.waitForClickable();+ await admitButton.click();+ }++ /**+ * The notification that someone's access was approved.+ */+ async getLobbyParticipantAccessGranted() {+ return await this.getNotificationText(LOBBY_PARTICIPANT_ACCESS_GRANTED_TEST_ID);+ }++ /**+ * Closes the notification.+ */+ async closeLobbyParticipantAccessGranted() {+ await this.closeLobbyNotification(LOBBY_PARTICIPANT_ACCESS_GRANTED_TEST_ID);+ }++ /**+ * Returns notification text if the notification is found in the next few seconds.+ * @return the notification text.+ */+ private async getNotificationText(testId: string) {+ const notificationElement = this.participant.driver.$(`[data-testid="${testId}"]`);++ await notificationElement.waitForExist();++ return await notificationElement.getText();+ }++ /**+ * Rejects the last knocking participant (it is the only one).+ */+ async rejectLobbyParticipant() {+ const admitButton+ = this.participant.driver.$(`[data-testid="${LOBBY_PARTICIPANT_REJECT_TEST_ID}"]`);++ await admitButton.waitForExist();+ await admitButton.waitForClickable();+ await admitButton.click();+ }++ /**+ * The notification test that someone's access was denied.+ */+ async getLobbyParticipantAccessDenied() {+ return await this.getNotificationText(LOBBY_PARTICIPANT_ACCESS_DENIED_TEST_ID);+ }++ /**+ * Closes the notification.+ */+ async closeLobbyParticipantAccessDenied() {+ await this.closeLobbyNotification(LOBBY_PARTICIPANT_ACCESS_DENIED_TEST_ID);+ }++ /**+ * Waits for the notification for access denied for entering the lobby is shown.+ */+ async waitForLobbyAccessDeniedNotification() {+ const displayNameEl+ = this.participant.driver.$(`div[data-testid="${LOBBY_ACCESS_DENIED_TEST_ID}"]`);++ await displayNameEl.waitForExist({ timeout: 2000 });+ await displayNameEl.waitForDisplayed();+ }++ /**+ * Will wait 3 seconds for the knocking participants to disappear and return true or will return false.+ * @return <tt>true</tt> if the knocking participants list was not displayed.+ */+ async waitForHideOfKnockingParticipants() {+ await this.participant.driver.$(LOBBY_KNOCKING_PARTICIPANT_NOTIFICATION_XPATH)+ .waitForDisplayed({+ timeout: 3000,+ reverse: true+ });+ }++ /**+ * Closes local notification, for the participant that was denied.+ */+ async closeLocalLobbyAccessDenied() {+ await this.participant.driver.$('[data-testid="lobby.joinRejectedMessage"').waitForExist();++ const dismissButton+ = this.participant.driver.$('[data-testid="lobby.joinRejectedTitle-dismiss"]');++ await dismissButton.moveTo();+ await dismissButton.click();+ }}diff --git a/tests/pageobjects/ParticipantsPane.ts b/tests/pageobjects/ParticipantsPane.tsindex 9649aad7e0..432b31011b 100644--- a/tests/pageobjects/ParticipantsPane.ts+++ b/tests/pageobjects/ParticipantsPane.ts@@ -1,3 +1,5 @@+import { ChainablePromiseElement } from 'webdriverio';+import { Participant } from '../helpers/Participant';import AVModerationMenu from './AVModerationMenu';@@ -184,4 +186,57 @@ export default class ParticipantsPane extends BasePageObject {await inviteButton.waitForDisplayed();await inviteButton.click();}++ /**+ * Find the participant by name.+ * @param name - The name to look for.+ * @private+ */+ private async findLobbyParticipantByName(name: string): Promise<ChainablePromiseElement> {+ return this.participant.driver.$$('//div[@id="lobby-list"]//div[starts-with(@id, "participant-item-")]')+ .find(async participant => (await participant.getText()).includes(name));+ }++ /**+ * Tries to click on the approve button and fails if it cannot be clicked.+ * @param participantNameToAdmit - the name of the participant to admit.+ */+ async admitLobbyParticipant(participantNameToAdmit: string) {+ const participantToAdmit = await this.findLobbyParticipantByName(participantNameToAdmit);++ await participantToAdmit.moveTo();++ const participantIdToAdmit = (await participantToAdmit.getAttribute('id'))+ .substring('participant-item-'.length);+ const admitButton = this.participant.driver+ .$(`[data-testid="admit-${participantIdToAdmit}"]`);++ await admitButton.waitForExist();+ await admitButton.click();+ }++ /**+ * Tries to click on the reject button and fails if it cannot be clicked.+ * @param participantNameToReject - the name of the participant for this {@link ParticipantsPane} to reject.+ */+ async rejectLobbyParticipant(participantNameToReject: string) {+ const participantToReject+ = await this.findLobbyParticipantByName(participantNameToReject);++ await participantToReject.moveTo();++ const participantIdToReject = (await participantToReject.getAttribute('id'))+ .substring('participant-item-'.length);++ const moreOptionsButton+ = this.participant.driver.$(`aria/More moderation options ${participantNameToReject}`);++ await moreOptionsButton.click();++ const rejectButton = this.participant.driver+ .$(`[data-testid="reject-${participantIdToReject}"]`);++ await rejectButton.waitForExist();+ await rejectButton.click();+ }}diff --git a/tests/pageobjects/PreJoinScreen.ts b/tests/pageobjects/PreJoinScreen.tsnew file mode 100644index 0000000000..1cddb6b637--- /dev/null+++ b/tests/pageobjects/PreJoinScreen.ts@@ -0,0 +1,31 @@+import PreMeetingScreen from './PreMeetingScreen';++const DISPLAY_NAME_ID = 'premeeting-name-input';+const JOIN_BUTTON_TEST_ID = 'prejoin.joinMeeting';++/**+ * Page object for the PreJoin screen.+ */+export default class PreJoinScreen extends PreMeetingScreen {+ /**+ * Returns the join button element.+ */+ getJoinButton(): ChainablePromiseElement {+ return this.participant.driver.$(`[data-testid="${JOIN_BUTTON_TEST_ID}"]`);+ }++ /**+ * Returns the display name input element.+ */+ getDisplayNameInput(): ChainablePromiseElement {+ return this.participant.driver.$(`#${DISPLAY_NAME_ID}`);+ }++ /**+ * Waits for pre join screen to load.+ */+ async waitForLoading() {+ await this.participant.driver.$('[data-testid="prejoin.screen"]')+ .waitForDisplayed({ timeout: 3000 });+ }+}diff --git a/tests/pageobjects/PreMeetingScreen.ts b/tests/pageobjects/PreMeetingScreen.tsnew file mode 100644index 0000000000..69eeafe487--- /dev/null+++ b/tests/pageobjects/PreMeetingScreen.ts@@ -0,0 +1,90 @@+import BasePageObject from './BasePageObject';++const PASSWORD_BUTTON_TEST_ID = 'lobby.enterPasswordButton';++/**+ * Page object for the PreMeeting screen, common stuff between pre-join and lobby screens.+ */+export default abstract class PreMeetingScreen extends BasePageObject {+ /**+ * Waits for pre join or lobby screen to load.+ */+ abstract waitForLoading(): Promise<void>;++ /**+ * Returns the display name input element.+ */+ abstract getDisplayNameInput(): WebdriverIO.Element;++ /**+ * Returns the join button element.+ */+ abstract getJoinButton(): WebdriverIO.Element;++ /**+ * Interacts with the view to enter a display name.+ */+ async enterDisplayName(displayName: string) {+ const displayNameInput = this.getDisplayNameInput();++ await displayNameInput.click();++ // element.clear does not always work, make sure we delete the content+ await displayNameInput.clearValue();++ await this.participant.driver.keys(displayName);+ }++ /**+ * Checks internally whether lobby room is joined.+ *+ * @returns {Promise<void>}+ */+ async waitToJoinLobby(): Promise<void> {+ return this.participant.driver.waitUntil(+ async () => await this.isLobbyRoomJoined(),+ {+ timeout: 3_000, // 3 seconds+ timeoutMsg: `Timeout waiting to join lobby for ${this.participant.name}`+ }+ );+ }++ /**+ * Checks internally whether lobby room is joined.+ */+ async isLobbyRoomJoined() {+ return await this.participant.driver.execute(+ () => APP.conference._room?.room?.getLobby()?.lobbyRoom?.joined === true);+ }++ /**+ * Returns the password button element.+ */+ getPasswordButton() {+ return this.participant.driver.$(`[data-testid="${PASSWORD_BUTTON_TEST_ID}"]`);+ }++ /**+ * Interacts with the view to enter a password.+ */+ async enterPassword(password: string) {+ const passwordButton = this.getPasswordButton();++ await passwordButton.moveTo();+ await passwordButton.click();++ const passwordInput = this.participant.driver.$('[data-testid="lobby.password"]');++ await passwordInput.waitForDisplayed();+ await passwordInput.click();+ await passwordInput.clearValue();++ await this.participant.driver.keys(password);++ const joinButton = this.participant.driver.$('[data-testid="lobby.passwordJoinButton"]');++ await joinButton.waitForDisplayed();+ await joinButton.click();+ }+}diff --git a/tests/pageobjects/SecurityDialog.ts b/tests/pageobjects/SecurityDialog.tsnew file mode 100644index 0000000000..54867f7121--- /dev/null+++ b/tests/pageobjects/SecurityDialog.ts@@ -0,0 +1,136 @@+import { Key } from 'webdriverio';++import BaseDialog from './BaseDialog';++const ADD_PASSWORD_LINK = 'add-password';+const ADD_PASSWORD_FIELD = 'info-password-input';+const DIALOG_CONTAINER = 'security-dialog';+const LOCAL_LOCK = 'info-password-local';+const REMOTE_LOCK = 'info-password-remote';++/**+ * Page object for the security dialog.+ */+export default class SecurityDialog extends BaseDialog {+ /**+ * Waits for the settings dialog to be visible.+ */+ async waitForDisplay() {+ await this.participant.driver.$(`.${DIALOG_CONTAINER}`).waitForDisplayed();+ }++ /**+ * Returns the switch that can be used to detect lobby state or change lobby state.+ * @private+ */+ private getLobbySwitch() {+ return this.participant.driver.$('#lobby-section-switch');+ }++ /**+ * Returns is the lobby enabled.+ */+ async isLobbyEnabled() {+ return this.getLobbySwitch().isSelected();+ }++ /**+ * Toggles the lobby option from the security dialog.+ */+ async toggleLobby() {+ const lobbySwitch = this.getLobbySwitch();++ await lobbySwitch.moveTo();+ await lobbySwitch.click();+ }++ /**+ * Checks whether lobby section is present in the UI.+ */+ async isLobbySectionPresent() {+ return await this.getLobbySwitch().isExisting();+ }++ /**+ * Waits for the lobby to be enabled or disabled.+ * @param reverse+ */+ async waitForLobbyEnabled(reverse = false) {+ const lobbySwitch = this.getLobbySwitch();++ return this.participant.driver.waitUntil(+ async () => await lobbySwitch.isSelected() !== reverse,+ {+ timeout: 5_000, // 30 seconds+ timeoutMsg: `Timeout waiting for lobby being ${reverse ? 'disabled' : 'enabled'} for ${+ this.participant.name}.`+ }+ );+ }++ /**+ * Checks if the current conference is locked with a locally set password.+ *+ * @return {@code true} if the conference is displayed as locked locally in+ * the security dialog, {@code false} otherwise.+ */+ private async isLockedLocally() {+ return this.participant.driver.$(`.${LOCAL_LOCK}`).isExisting();+ }++ /**+ * Checks if the current conference is locked with a locally set password.+ *+ * @return {@code true} if the conference is displayed as locked remotely+ * in the security dialog, {@code false} otherwise.+ */+ private async isLockedRemotely() {+ return await this.participant.driver.$(`.${REMOTE_LOCK}`).isExisting();+ }++ /**+ * Checks if the current conference is locked based on the security dialog's+ * display state.+ *+ * @return {@code true} if the conference is displayed as locked in the+ * security dialog, {@code false} otherwise.+ */+ async isLocked() {+ return await this.isLockedLocally() || await this.isLockedRemotely();+ }++ /**+ * Sets a password on the current conference to lock it.+ *+ * @param password - The password to use to lock the conference.+ */+ async addPassword(password: string) {+ const addPasswordLink = this.participant.driver.$(`.${ADD_PASSWORD_LINK}`);++ await addPasswordLink.waitForClickable();+ await addPasswordLink.click();++ const passwordEntry = this.participant.driver.$(`#${ADD_PASSWORD_FIELD}`);++ await passwordEntry.waitForDisplayed();+ await passwordEntry.click();++ await this.participant.driver.keys(password);+ await this.participant.driver.$('button=Add').click();++ let validationMessage;++ // There are two cases here, validation is enabled and the field passwordEntry maybe there+ // with validation failed, or maybe successfully hidden after setting the password+ // So let's give it some time to act on any of the above+ if (!await passwordEntry.isExisting()) {+ // validation had failed on password field as it is still on the page+ validationMessage = passwordEntry.getAttribute('validationMessage');+ }++ if (validationMessage) {+ await this.participant.driver.keys([ Key.Escape ]);+ expect(validationMessage).toBe('');+ }+ }+}diff --git a/tests/pageobjects/Toolbar.ts b/tests/pageobjects/Toolbar.tsindex 77deb73718..c294749263 100644--- a/tests/pageobjects/Toolbar.ts+++ b/tests/pageobjects/Toolbar.ts@@ -12,6 +12,7 @@ const OVERFLOW = 'More actions';const PARTICIPANTS = 'Open participants pane';const PROFILE = 'Edit your profile';const RAISE_HAND = 'Raise your hand';+const SECURITY = 'Security options';const SETTINGS = 'Open settings';const STOP_DESKTOP = 'Stop sharing your screen';const ENTER_TILE_VIEW_BUTTON = 'Enter tile view';@@ -201,6 +202,13 @@ export default class Toolbar extends BasePageObject {await this.getButton(HANGUP).click();}+ /**+ * Clicks on the security toolbar button which opens the security panel.+ */+ async clickSecurityButton() {+ await this.clickButtonInOverflowMenu(SECURITY);+ }+/*** Clicks on the settings toolbar button which opens or closes the settings panel.*/diff --git a/tests/specs/2way/iFrameApiParticipantsPresence.spec.ts b/tests/specs/2way/iFrameApiParticipantsPresence.spec.tsindex d59622cc6a..700cb23491 100644--- a/tests/specs/2way/iFrameApiParticipantsPresence.spec.ts+++ b/tests/specs/2way/iFrameApiParticipantsPresence.spec.ts@@ -1,6 +1,6 @@import { isEqual } from 'lodash-es';-import type { Participant } from '../../helpers/Participant';+import { P1_DISPLAY_NAME, P2_DISPLAY_NAME, Participant } from '../../helpers/Participant';import { ensureTwoParticipants, parseJid } from '../../helpers/participants';/**@@ -310,8 +310,8 @@ describe('Participants presence', () => {const p1EpId = await p1.getEndpointId();const p2EpId = await p2.getEndpointId();- const newP1Name = 'p1';- const newP2Name = 'p2';+ const newP1Name = P1_DISPLAY_NAME;+ const newP2Name = P2_DISPLAY_NAME;const newNames: ({ id: string; name: string; })[] = [ {id: p2EpId,name: newP2Namediff --git a/tests/specs/3way/lobby.spec.ts b/tests/specs/3way/lobby.spec.tsindex ffc8f3850d..7646972cef 100644--- a/tests/specs/3way/lobby.spec.ts+++ b/tests/specs/3way/lobby.spec.ts@@ -1,4 +1,4 @@-import type { Participant } from '../../helpers/Participant';+import { P1_DISPLAY_NAME, P3_DISPLAY_NAME, Participant } from '../../helpers/Participant';import { ensureOneParticipant, ensureThreeParticipants, ensureTwoParticipants } from '../../helpers/participants';import type { IJoinOptions } from '../../helpers/types';import type PreMeetingScreen from '../../pageobjects/PreMeetingScreen';@@ -19,54 +19,336 @@ describe('Lobby', () => {});it('entering in lobby and approve', async () => {- const { p1 } = ctx;+ const { p1, p2 } = ctx;await enterLobby(p1, true);++ const { p3 } = ctx;++ await p1.getNotifications().allowLobbyParticipant();++ const notificationText = await p2.getNotifications().getLobbyParticipantAccessGranted();++ expect(notificationText.includes(P1_DISPLAY_NAME)).toBe(true);+ expect(notificationText.includes(P3_DISPLAY_NAME)).toBe(true);++ await p2.getNotifications().closeLobbyParticipantAccessGranted();++ // ensure 3 participants in the call will check for the third one that muc is joined, ice connected,+ // media is being receiving and there are two remote streams+ await p3.waitToJoinMUC();+ await p3.waitForIceConnected();+ await p3.waitForSendReceiveData();+ await p3.waitForRemoteStreams(2);++ // now check third one display name in the room, is the one set in the prejoin screen+ const name = await p1.getFilmstrip().getRemoteDisplayName(await p3.getEndpointId());++ expect(name).toBe(P3_DISPLAY_NAME);++ await p3.hangup();});it('entering in lobby and deny', async () => {- //+ const { p1, p2 } = ctx;++ // the first time tests is executed we need to enter display name,+ // for next execution that will be locally stored+ await enterLobby(p1, false);++ // moderator rejects access+ await p1.getNotifications().rejectLobbyParticipant();++ // deny notification on 2nd participant+ const notificationText = await p2.getNotifications().getLobbyParticipantAccessDenied();++ expect(notificationText.includes(P1_DISPLAY_NAME)).toBe(true);+ expect(notificationText.includes(P3_DISPLAY_NAME)).toBe(true);++ await p2.getNotifications().closeLobbyParticipantAccessDenied();++ const { p3 } = ctx;++ // check the denied one is out of lobby, sees the notification about it+ await p3.getNotifications().waitForLobbyAccessDeniedNotification();++ expect(await p3.getLobbyScreen().isLobbyRoomJoined()).toBe(false);++ await p3.hangup();});it('approve from participants pane', async () => {- //+ const { p1 } = ctx;++ const knockingParticipant = await enterLobby(p1, false);++ // moderator allows access+ const p1ParticipantsPane = p1.getParticipantsPane();++ await p1ParticipantsPane.open();+ await p1ParticipantsPane.admitLobbyParticipant(knockingParticipant);+ await p1ParticipantsPane.close();++ const { p3 } = ctx;++ // ensure 3 participants in the call will check for the third one that muc is joined, ice connected,+ // media is being receiving and there are two remote streams+ await p3.waitToJoinMUC();+ await p3.waitForIceConnected();+ await p3.waitForSendReceiveData();+ await p3.waitForRemoteStreams(2);++ // now check third one display name in the room, is the one set in the prejoin screen+ // now check third one display name in the room, is the one set in the prejoin screen+ const name = await p1.getFilmstrip().getRemoteDisplayName(await p3.getEndpointId());++ expect(name).toBe(P3_DISPLAY_NAME);++ await p3.hangup();});it('reject from participants pane', async () => {- //+ const { p1 } = ctx;++ const knockingParticipant = await enterLobby(p1, false);++ // moderator rejects access+ const p1ParticipantsPane = p1.getParticipantsPane();++ await p1ParticipantsPane.open();+ await p1ParticipantsPane.rejectLobbyParticipant(knockingParticipant);+ await p1ParticipantsPane.close();++ const { p3 } = ctx;++ // check the denied one is out of lobby, sees the notification about it+ // The third participant should see a warning that his access to the room was denied+ await p3.getNotifications().waitForLobbyAccessDeniedNotification();++ // check Lobby room not left+ expect(await p3.getLobbyScreen().isLobbyRoomJoined()).toBe(false);++ await p3.hangup();});it('lobby user leave', async () => {- //+ const { p1 } = ctx;++ await enterLobby(p1, false);++ await ctx.p3.hangup();++ // check that moderator (participant 1) no longer sees notification about participant in lobby+ await p1.getNotifications().waitForHideOfKnockingParticipants();});it('conference ended in lobby', async () => {- //+ const { p1, p2 } = ctx;++ await enterLobby(p1, false);++ await p1.hangup();+ await p2.hangup();++ const { p3 } = ctx;++ await p3.driver.$('.dialog.leaveReason').isExisting();++ await p3.driver.waitUntil(+ async () => !await p3.getLobbyScreen().isLobbyRoomJoined(),+ {+ timeout: 2000,+ timeoutMsg: 'p2 did not leave lobby'+ }+ );++ await p3.hangup();});it('disable while participant in lobby', async () => {- //+ await ensureTwoParticipants(ctx);++ const { p1 } = ctx;++ await enableLobby();+ await enterLobby(p1);++ // WebParticipant participant1 = getParticipant1();+ const p1SecurityDialog = p1.getSecurityDialog();++ await p1.getToolbar().clickSecurityButton();+ await p1SecurityDialog.waitForDisplay();++ await p1SecurityDialog.toggleLobby();+ await p1SecurityDialog.waitForLobbyEnabled();++ const { p3 } = ctx;++ await p3.waitToJoinMUC();++ expect(await p3.getLobbyScreen().isLobbyRoomJoined()).toBe(false);});it('change of moderators in lobby', async () => {- //+ await Promise.all([ ctx.p1.hangup(), ctx.p2.hangup(), ctx.p3.hangup() ]);++ await ensureTwoParticipants(ctx);++ const { p1, p2 } = ctx;++ // hanging up the first one, which is moderator and second one should be+ await p1.hangup();++ await p2.driver.waitUntil(+ async () => await p2.isModerator(),+ {+ timeout: 3000,+ timeoutMsg: 'p2 is not moderator after p1 leaves'+ }+ );++ const p2SecurityDialog = p2.getSecurityDialog();++ await p2.getToolbar().clickSecurityButton();+ await p2SecurityDialog.waitForDisplay();++ await p2SecurityDialog.toggleLobby();+ await p2SecurityDialog.waitForLobbyEnabled();++ // 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() ]);});it('shared password', async () => {- //+ await ensureTwoParticipants(ctx);++ const { p1 } = ctx;++ await enableLobby();++ const p1SecurityDialog = p1.getSecurityDialog();++ await p1.getToolbar().clickSecurityButton();+ await p1SecurityDialog.waitForDisplay();++ expect(await p1SecurityDialog.isLocked()).toBe(false);++ const roomPasscode = String(Math.random() * 1_000);++ await p1SecurityDialog.addPassword(roomPasscode);++ await p1.driver.waitUntil(+ async () => await p1SecurityDialog.isLocked(),+ {+ timeout: 2000,+ timeoutMsg: 'room did not lock for p1'+ }+ );++ await enterLobby(p1, false);++ const { p3 } = ctx;++ // now fill in password+ const lobbyScreen = p3.getLobbyScreen();++ await lobbyScreen.enterPassword(roomPasscode);++ await p3.waitToJoinMUC();+ await p3.waitForIceConnected();+ await p3.waitForSendReceiveData();});it('enable with more than two participants', async () => {- //+ await Promise.all([ ctx.p1.hangup(), ctx.p2.hangup(), ctx.p3.hangup() ]);+++ await ensureThreeParticipants(ctx);++ await enableLobby();++ // we need to check remote participants as isInMuc has not changed its value as+ // the bug is triggered by presence with status 322 which is not handled correctly+ const { p1, p2, p3 } = ctx;++ await p1.waitForRemoteStreams(2);+ await p2.waitForRemoteStreams(2);+ await p3.waitForRemoteStreams(2);});it('moderator leaves while lobby enabled', async () => {- //+ const { p1, p2, p3 } = ctx;++ await p3.hangup();+ await p1.hangup();++ await p2.driver.waitUntil(+ async () => await p2.isModerator(),+ {+ timeout: 3000,+ timeoutMsg: 'p2 is not moderator after p1 leaves'+ }+ );++ const lobbyScreen = p2.getLobbyScreen();++ expect(await lobbyScreen.isLobbyRoomJoined()).toBe(true);});it('reject and approve in pre-join', async () => {- //+ await ctx.p2.hangup();++ await ensureTwoParticipants(ctx);+ await enableLobby();++ const { p1 } = ctx;++ const knockingParticipant = await enterLobby(p1, true, true);++ // moderator rejects access+ const p1ParticipantsPane = p1.getParticipantsPane();++ await p1ParticipantsPane.open();+ await p1ParticipantsPane.rejectLobbyParticipant(knockingParticipant);+ await p1ParticipantsPane.close();++ const { p3 } = ctx;++ // check the denied one is out of lobby, sees the notification about it+ // The third participant should see a warning that his access to the room was denied+ await p3.getNotifications().waitForLobbyAccessDeniedNotification();++ // check Lobby room left+ expect(await p3.getLobbyScreen().isLobbyRoomJoined()).toBe(false);++ // try again entering the lobby with the third one and approve it+ // check that everything is fine in the meeting+ await p3.getNotifications().closeLocalLobbyAccessDenied();++ // let's retry to enter the lobby and approve this time+ const lobbyScreen = p3.getPreJoinScreen();++ // click join button+ await lobbyScreen.getJoinButton().click();+ await lobbyScreen.waitToJoinLobby();++ // check that moderator (participant 1) sees notification about participant in lobby+ const name = await p1.getNotifications().getKnockingParticipantName();++ expect(name).toBe(P3_DISPLAY_NAME);+ expect(await lobbyScreen.isLobbyRoomJoined()).toBe(true);++ await p1ParticipantsPane.open();+ await p1ParticipantsPane.admitLobbyParticipant(knockingParticipant);+ await p1ParticipantsPane.close();++ await p3.waitForParticipants(2);+ await p3.waitForRemoteStreams(2);++ expect(await p3.getFilmstrip().countVisibleThumbnails()).toBe(3);});});@@ -76,10 +358,6 @@ describe('Lobby', () => {async function enableLobby() {const { p1, p2 } = ctx;- // TODO? remove- // we set the name so we can check it on the notifications- // participant1.setDisplayName(participant1.getName());-const p1SecurityDialog = p1.getSecurityDialog();await p1.getToolbar().clickSecurityButton();@@ -153,7 +431,7 @@ async function enterLobby(participant: Participant, enterDisplayName = false, usscreen = p3.getLobbyScreen();}- // // participant 3 should be now on pre-join screen+ // participant 3 should be now on pre-join screenawait screen.waitForLoading();const displayNameInput = screen.getDisplayNameInput();@@ -178,7 +456,7 @@ async function enterLobby(participant: Participant, enterDisplayName = false, us// this check needs to be added once the functionality exists// enter display name- await screen.enterDisplayName(p3.name);+ await screen.enterDisplayName(P3_DISPLAY_NAME);// check join button is enabledclasses = await joinButton.getAttribute('class');@@ -202,7 +480,7 @@ async function enterLobby(participant: Participant, enterDisplayName = false, us// check that moderator (participant 1) sees notification about participant in lobbyconst name = await participant.getNotifications().getKnockingParticipantName();- expect(name).toBe(p3.name);+ expect(name).toBe(P3_DISPLAY_NAME);expect(await screen.isLobbyRoomJoined()).toBe(true);return name;