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
fix(tests): Simplifies await async.
damencho2c92ea57f09a
diff --git a/tests/helpers/Participant.ts b/tests/helpers/Participant.tsindex 5e44f9b998..9e18ea2438 100644--- a/tests/helpers/Participant.ts+++ b/tests/helpers/Participant.ts@@ -252,7 +252,7 @@ export class Participant {*/async waitForPageToLoad(): Promise<void> {return this.driver.waitUntil(- async () => await this.driver.execute(() => document.readyState === 'complete'),+ () => this.driver.execute(() => document.readyState === 'complete'),{timeout: 30_000, // 30 secondstimeoutMsg: `Timeout waiting for Page Load Request to complete for ${this.name}.`@@ -325,8 +325,8 @@ export class Participant {async waitForIceConnected(): Promise<void> {const driver = this.driver;- return driver.waitUntil(async () =>- await driver.execute(() => APP.conference.getConnectionState() === 'connected'), {+ return driver.waitUntil(() =>+ driver.execute(() => APP.conference.getConnectionState() === 'connected'), {timeout: 15_000,timeoutMsg: `expected ICE to be connected for 15s for ${this.name}`});@@ -341,17 +341,16 @@ export class Participant {timeout = 15_000, msg = `expected to receive/send data in 15s for ${this.name}`): Promise<void> {const driver = this.driver;- return driver.waitUntil(async () =>- await driver.execute(() => {- const stats = APP.conference.getStats();- const bitrateMap = stats?.bitrate || {};- const rtpStats = {- uploadBitrate: bitrateMap.upload || 0,- downloadBitrate: bitrateMap.download || 0- };-- return rtpStats.uploadBitrate > 0 && rtpStats.downloadBitrate > 0;- }), {+ return driver.waitUntil(() => driver.execute(() => {+ const stats = APP.conference.getStats();+ const bitrateMap = stats?.bitrate || {};+ const rtpStats = {+ uploadBitrate: bitrateMap.upload || 0,+ downloadBitrate: bitrateMap.download || 0+ };++ return rtpStats.uploadBitrate > 0 && rtpStats.downloadBitrate > 0;+ }), {timeout,timeoutMsg: msg});@@ -366,16 +365,15 @@ export class Participant {timeout = 15_000, msg = `expected to send data in 15s for ${this.name}`): Promise<void> {const driver = this.driver;- return driver.waitUntil(async () =>- await driver.execute(() => {- const stats = APP.conference.getStats();- const bitrateMap = stats?.bitrate || {};- const rtpStats = {- uploadBitrate: bitrateMap.upload || 0- };+ return driver.waitUntil(() => driver.execute(() => {+ const stats = APP.conference.getStats();+ const bitrateMap = stats?.bitrate || {};+ const rtpStats = {+ uploadBitrate: bitrateMap.upload || 0+ };- return rtpStats.uploadBitrate > 0;- }), {+ return rtpStats.uploadBitrate > 0;+ }), {timeout,timeoutMsg: msg});@@ -390,8 +388,8 @@ export class Participant {waitForRemoteStreams(number: number): Promise<void> {const driver = this.driver;- return driver.waitUntil(async () =>- await driver.execute(count => APP.conference.getNumberOfParticipantsWithTracks() >= count, number), {+ return driver.waitUntil(() =>+ driver.execute(count => APP.conference.getNumberOfParticipantsWithTracks() >= count, number), {timeout: 15_000,timeoutMsg: `expected number of remote streams:${number} in 15s for ${this.name}`});@@ -407,8 +405,7 @@ export class Participant {waitForParticipants(number: number, msg?: string): Promise<void> {const driver = this.driver;- return driver.waitUntil(async () =>- await driver.execute(count => APP.conference.listMembers().length === count, number), {+ return driver.waitUntil(() => driver.execute(count => APP.conference.listMembers().length === count, number), {timeout: 15_000,timeoutMsg: msg || `not the expected participants ${number} in 15s for ${this.name}`});@@ -580,7 +577,7 @@ export class Participant {* Returns the local display name.*/async getLocalDisplayName() {- return await (await this.getLocalDisplayNameElement()).getText();+ return (await this.getLocalDisplayNameElement()).getText();}/**@@ -631,7 +628,7 @@ export class Participant {* Returns the source of the large video currently shown.*/async getLargeVideoId() {- return await this.driver.execute('return document.getElementById("largeVideo").srcObject.id');+ return this.driver.execute('return document.getElementById("largeVideo").srcObject.id');}/**@@ -700,7 +697,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 this.driver.$('div[data-testid="dialog.leaveReason"]').isDisplayed();}/**diff --git a/tests/pageobjects/AVModerationMenu.ts b/tests/pageobjects/AVModerationMenu.tsindex 7d0c77d6b0..74295b43ca 100644--- a/tests/pageobjects/AVModerationMenu.ts+++ b/tests/pageobjects/AVModerationMenu.ts@@ -12,29 +12,29 @@ export default class AVModerationMenu extends BasePageObject {/*** Clicks the start audio moderation menu item.*/- async clickStartAudioModeration() {- await this.clickButton(START_AUDIO_MODERATION);+ clickStartAudioModeration() {+ return this.clickButton(START_AUDIO_MODERATION);}/*** Clicks the stop audio moderation menu item.*/- async clickStopAudioModeration() {- await this.clickButton(STOP_AUDIO_MODERATION);+ clickStopAudioModeration() {+ return this.clickButton(STOP_AUDIO_MODERATION);}/*** Clicks the start video moderation menu item.*/- async clickStartVideoModeration() {- await this.clickButton(START_VIDEO_MODERATION);+ clickStartVideoModeration() {+ return this.clickButton(START_VIDEO_MODERATION);}/*** Clicks the stop audio moderation menu item.*/- async clickStopVideoModeration() {- await this.clickButton(STOP_VIDEO_MODERATION);+ clickStopVideoModeration() {+ return this.clickButton(STOP_VIDEO_MODERATION);}/**diff --git a/tests/pageobjects/BaseDialog.ts b/tests/pageobjects/BaseDialog.tsindex fffd35cf1b..0d948be615 100644--- a/tests/pageobjects/BaseDialog.ts+++ b/tests/pageobjects/BaseDialog.ts@@ -10,14 +10,14 @@ export default class BaseDialog extends BasePageObject {/*** Clicks on the X (close) button.*/- async clickCloseButton(): Promise<void> {- await this.participant.driver.$(`#${CLOSE_BUTTON}`).click();+ clickCloseButton(): Promise<void> {+ return this.participant.driver.$(`#${CLOSE_BUTTON}`).click();}/*** Clicks on the ok button.*/- async clickOkButton(): Promise<void> {- await this.participant.driver.$(`#${OK_BUTTON}`).click();+ clickOkButton(): Promise<void> {+ return this.participant.driver.$(`#${OK_BUTTON}`).click();}}diff --git a/tests/pageobjects/BreakoutRooms.ts b/tests/pageobjects/BreakoutRooms.tsindex 4d31c3da33..c2962ac161 100644--- a/tests/pageobjects/BreakoutRooms.ts+++ b/tests/pageobjects/BreakoutRooms.ts@@ -50,11 +50,11 @@ class BreakoutRoom extends BasePageObject {/*** Collapses the breakout room.*/- async collapse() {+ collapse() {const collapseElem = this.participant.driver.$(`div[data-testid="${this.id}"]`);- await collapseElem.click();+ return collapseElem.click();}/**@@ -209,21 +209,4 @@ export default class BreakoutRooms extends BasePageObject {await sendButton.waitForClickable();await sendButton.click();}-- // /**- // * Open context menu for given participant.- // */- // async openParticipantContextMenu(participant: Participant) {- // const listItem = this.participant.driver.$(- // `div[@id="participant-item-${await participant.getEndpointId()}"]`);- //- // await listItem.waitForDisplayed();- // await listItem.moveTo();- //- // const button = listItem.$(`aria/${PARTICIPANT_MORE_LABEL}`);- //- // await button.waitForClickable();- // await button.click();- // }}-diff --git a/tests/pageobjects/ChatPanel.ts b/tests/pageobjects/ChatPanel.tsindex ef18bc93f3..c4aff336d1 100644--- a/tests/pageobjects/ChatPanel.ts+++ b/tests/pageobjects/ChatPanel.ts@@ -7,8 +7,8 @@ export default class ChatPanel extends BasePageObject {/*** Is chat panel open.*/- async isOpen() {- return await this.participant.driver.$('#sideToolbarContainer').isExisting();+ isOpen() {+ return this.participant.driver.$('#sideToolbarContainer').isExisting();}/**diff --git a/tests/pageobjects/Filmstrip.ts b/tests/pageobjects/Filmstrip.tsindex ce5597108c..ddbe67599f 100644--- a/tests/pageobjects/Filmstrip.ts+++ b/tests/pageobjects/Filmstrip.ts@@ -70,8 +70,8 @@ export default class Filmstrip extends BasePageObject {/*** Returns the local video id.*/- async getLocalVideoId() {- return await this.participant.driver.execute(+ getLocalVideoId() {+ return this.participant.driver.execute('return document.getElementById("localVideo_container").srcObject.id');}@@ -94,7 +94,7 @@ export default class Filmstrip extends BasePageObject {const elem = this.participant.driver.$(`//span[@id='participant_${endpointId}']//img[contains(@class,'userAvatar')]`);- return await elem.isExisting() ? elem.getAttribute('src') : null;+ return await elem.isExisting() ? await elem.getAttribute('src') : null;}/**@@ -154,8 +154,8 @@ export default class Filmstrip extends BasePageObject {* Kicks a participant.* @param participantId*/- async kickParticipant(participantId: string) {- await this.clickOnRemoteMenuLink(participantId, 'kicklink', true);+ kickParticipant(participantId: string) {+ return this.clickOnRemoteMenuLink(participantId, 'kicklink', true);}/**@@ -177,8 +177,8 @@ export default class Filmstrip extends BasePageObject {/*** Checks whether the local self view is displayed or not.*/- async assertSelfViewIsHidden(hidden: boolean) {- await this.participant.driver.$(LOCAL_VIDEO_XPATH).waitForDisplayed({+ assertSelfViewIsHidden(hidden: boolean) {+ return this.participant.driver.$(LOCAL_VIDEO_XPATH).waitForDisplayed({reverse: hidden,timeout: 5000,timeoutMsg: `Local video thumbnail is${hidden ? '' : ' not'} displayed for ${this.participant.name}`@@ -200,8 +200,8 @@ export default class Filmstrip extends BasePageObject {* Asserts that the remote videos are hidden or not.* @param reverse*/- async assertRemoteVideosHidden(reverse = false) {- await this.participant.driver.waitUntil(+ assertRemoteVideosHidden(reverse = false) {+ return this.participant.driver.waitUntil(async () =>await this.participant.driver.$$('//div[@id="remoteVideos" and contains(@class, "hidden")]').length > 0,{diff --git a/tests/pageobjects/IframeAPI.ts b/tests/pageobjects/IframeAPI.tsindex 682b467a99..d30c79f108 100644--- a/tests/pageobjects/IframeAPI.ts+++ b/tests/pageobjects/IframeAPI.ts@@ -10,8 +10,8 @@ export default class IframeAPI extends BasePageObject {* Returns the json object from the iframeAPI helper.* @param event*/- async getEventResult(event: string): Promise<any> {- return await this.participant.driver.execute(+ getEventResult(event: string): Promise<any> {+ return this.participant.driver.execute(eventName => {const result = window.jitsiAPI.test[eventName];@@ -27,8 +27,8 @@ export default class IframeAPI extends BasePageObject {* Adds an event listener to the iframeAPI.* @param eventName The event name.*/- async addEventListener(eventName: string) {- return await this.participant.driver.execute(+ addEventListener(eventName: string) {+ return this.participant.driver.execute((event, prefix) => {console.log(`${new Date().toISOString()} ${prefix} Adding listener for event: ${event}`);window.jitsiAPI.addListener(event, evt => {@@ -42,15 +42,15 @@ export default class IframeAPI extends BasePageObject {/*** Returns an array of available rooms and details of it.*/- async getRoomsInfo() {- return await this.participant.driver.execute(() => window.jitsiAPI.getRoomsInfo());+ getRoomsInfo() {+ return this.participant.driver.execute(() => window.jitsiAPI.getRoomsInfo());}/*** Returns the number of participants in the conference.*/- async getNumberOfParticipants() {- return await this.participant.driver.execute(() => window.jitsiAPI.getNumberOfParticipants());+ getNumberOfParticipants() {+ return this.participant.driver.execute(() => window.jitsiAPI.getNumberOfParticipants());}/**@@ -58,8 +58,8 @@ export default class IframeAPI extends BasePageObject {* @param command The command.* @param args The arguments.*/- async executeCommand(command: string, ...args: any[]) {- return await this.participant.driver.execute(+ executeCommand(command: string, ...args: any[]) {+ return this.participant.driver.execute((commandName, commandArgs) =>window.jitsiAPI.executeCommand(commandName, ...commandArgs), command, args);@@ -68,15 +68,14 @@ export default class IframeAPI extends BasePageObject {/*** Returns the current state of the participant's pane.*/- async isParticipantsPaneOpen() {- return await this.participant.driver.execute(() => window.jitsiAPI.isParticipantsPaneOpen());+ isParticipantsPaneOpen() {+ return this.participant.driver.execute(() => window.jitsiAPI.isParticipantsPaneOpen());}/*** Removes the embedded Jitsi Meet conference.*/- async dispose() {- return await this.participant.driver.execute(() => window.jitsiAPI.dispose());+ dispose() {+ return this.participant.driver.execute(() => window.jitsiAPI.dispose());}-}diff --git a/tests/pageobjects/InviteDialog.ts b/tests/pageobjects/InviteDialog.tsindex e938ec65a4..ce06cc29c5 100644--- a/tests/pageobjects/InviteDialog.ts+++ b/tests/pageobjects/InviteDialog.ts@@ -13,7 +13,7 @@ export default class InviteDialog extends BaseDialog {/*** Checks if the dialog is open.*/- async isOpen() {+ isOpen() {return this.participant.driver.$(`.${DIALOG_CONTAINER}`).isExisting();}@@ -85,8 +85,8 @@ export default class InviteDialog extends BaseDialog {/*** Gets the string that contains the dial in number for the current conference.*/- async getDialInNumber() {- return await this.getValueAfterColon(PHONE_NUMBER);+ getDialInNumber() {+ return this.getValueAfterColon(PHONE_NUMBER);}/**diff --git a/tests/pageobjects/LobbyScreen.ts b/tests/pageobjects/LobbyScreen.tsindex 6f909f72d7..b35ca7afcd 100644--- a/tests/pageobjects/LobbyScreen.ts+++ b/tests/pageobjects/LobbyScreen.ts@@ -24,7 +24,7 @@ export default class LobbyScreen extends PreMeetingScreen {/*** Waits for lobby screen to load.*/- async waitForLoading() {- await this.participant.driver.$('.lobby-screen').waitForDisplayed({ timeout: 4000 });+ waitForLoading(): Promise<void> {+ return this.participant.driver.$('.lobby-screen').waitForDisplayed({ timeout: 4000 });}}diff --git a/tests/pageobjects/Notifications.ts b/tests/pageobjects/Notifications.tsindex 920f59980a..edf944490d 100644--- a/tests/pageobjects/Notifications.ts+++ b/tests/pageobjects/Notifications.ts@@ -47,10 +47,10 @@ export default class Notifications extends BasePageObject {/*** Dismisses any join notifications.*/- async dismissAnyJoinNotification() {- await Promise.allSettled(+ dismissAnyJoinNotification() {+ return Promise.allSettled([ `${JOIN_ONE_TEST_ID}-dismiss`, `${JOIN_TWO_TEST_ID}-dismiss`, `${JOIN_MULTIPLE_TEST_ID}-dismiss` ]- .map(async id => this.participant.driver.$(`#${id}"]`).click()));+ .map(id => this.participant.driver.$(`#${id}"]`).click()));}/**@@ -68,15 +68,15 @@ export default class Notifications extends BasePageObject {/*** Closes the self view notification.*/- async closeReEnableSelfViewNotification() {- await this.participant.driver.$(`div[data-testid="${REENABLE_SELF_VIEW_CLOSE_NOTIFICATION}"]`).click();+ closeReEnableSelfViewNotification() {+ return 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);+ getLobbyEnabledText() {+ return this.getNotificationText(LOBBY_ENABLED_TEST_ID);}/**@@ -101,8 +101,8 @@ export default class Notifications extends BasePageObject {/*** Closes the notification.*/- async closeLobbyEnabled() {- await this.closeLobbyNotification(LOBBY_ENABLED_TEST_ID);+ closeLobbyEnabled() {+ return this.closeLobbyNotification(LOBBY_ENABLED_TEST_ID);}/**@@ -135,15 +135,15 @@ export default class Notifications extends BasePageObject {/*** The notification that someone's access was approved.*/- async getLobbyParticipantAccessGranted() {- return await this.getNotificationText(LOBBY_PARTICIPANT_ACCESS_GRANTED_TEST_ID);+ getLobbyParticipantAccessGranted() {+ return this.getNotificationText(LOBBY_PARTICIPANT_ACCESS_GRANTED_TEST_ID);}/*** Closes the notification.*/- async closeLobbyParticipantAccessGranted() {- await this.closeLobbyNotification(LOBBY_PARTICIPANT_ACCESS_GRANTED_TEST_ID);+ closeLobbyParticipantAccessGranted() {+ return this.closeLobbyNotification(LOBBY_PARTICIPANT_ACCESS_GRANTED_TEST_ID);}/**@@ -173,15 +173,15 @@ export default class Notifications extends BasePageObject {/*** The notification test that someone's access was denied.*/- async getLobbyParticipantAccessDenied() {- return await this.getNotificationText(LOBBY_PARTICIPANT_ACCESS_DENIED_TEST_ID);+ getLobbyParticipantAccessDenied() {+ return this.getNotificationText(LOBBY_PARTICIPANT_ACCESS_DENIED_TEST_ID);}/*** Closes the notification.*/- async closeLobbyParticipantAccessDenied() {- await this.closeLobbyNotification(LOBBY_PARTICIPANT_ACCESS_DENIED_TEST_ID);+ closeLobbyParticipantAccessDenied() {+ return this.closeLobbyNotification(LOBBY_PARTICIPANT_ACCESS_DENIED_TEST_ID);}/**@@ -199,8 +199,8 @@ export default class Notifications extends BasePageObject {* 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)+ waitForHideOfKnockingParticipants() {+ return this.participant.driver.$(LOBBY_KNOCKING_PARTICIPANT_NOTIFICATION_XPATH).waitForDisplayed({timeout: 3000,reverse: truediff --git a/tests/pageobjects/ParticipantsPane.ts b/tests/pageobjects/ParticipantsPane.tsindex 432b31011b..038748ae5d 100644--- a/tests/pageobjects/ParticipantsPane.ts+++ b/tests/pageobjects/ParticipantsPane.ts@@ -26,7 +26,7 @@ export default class ParticipantsPane extends BasePageObject {/*** Checks if the pane is open.*/- async isOpen() {+ isOpen() {return this.participant.driver.$(`.${PARTICIPANTS_PANE}`).isExisting();}diff --git a/tests/pageobjects/PreJoinScreen.ts b/tests/pageobjects/PreJoinScreen.tsindex 1cddb6b637..8a2be7ec36 100644--- a/tests/pageobjects/PreJoinScreen.ts+++ b/tests/pageobjects/PreJoinScreen.ts@@ -24,8 +24,8 @@ export default class PreJoinScreen extends PreMeetingScreen {/*** Waits for pre join screen to load.*/- async waitForLoading() {- await this.participant.driver.$('[data-testid="prejoin.screen"]')+ waitForLoading(): Promise<void> {+ return this.participant.driver.$('[data-testid="prejoin.screen"]').waitForDisplayed({ timeout: 3000 });}}diff --git a/tests/pageobjects/PreMeetingScreen.ts b/tests/pageobjects/PreMeetingScreen.tsindex 69eeafe487..8bc032a0cc 100644--- a/tests/pageobjects/PreMeetingScreen.ts+++ b/tests/pageobjects/PreMeetingScreen.ts@@ -40,9 +40,9 @@ export default abstract class PreMeetingScreen extends BasePageObject {** @returns {Promise<void>}*/- async waitToJoinLobby(): Promise<void> {+ waitToJoinLobby(): Promise<void> {return this.participant.driver.waitUntil(- async () => await this.isLobbyRoomJoined(),+ () => this.isLobbyRoomJoined(),{timeout: 3_000, // 3 secondstimeoutMsg: `Timeout waiting to join lobby for ${this.participant.name}`@@ -53,8 +53,8 @@ export default abstract class PreMeetingScreen extends BasePageObject {/*** Checks internally whether lobby room is joined.*/- async isLobbyRoomJoined() {- return await this.participant.driver.execute(+ isLobbyRoomJoined() {+ return this.participant.driver.execute(() => APP.conference._room?.room?.getLobby()?.lobbyRoom?.joined === true);}diff --git a/tests/pageobjects/SecurityDialog.ts b/tests/pageobjects/SecurityDialog.tsindex 54867f7121..e705f7a9e9 100644--- a/tests/pageobjects/SecurityDialog.ts+++ b/tests/pageobjects/SecurityDialog.ts@@ -15,8 +15,8 @@ export default class SecurityDialog extends BaseDialog {/*** Waits for the settings dialog to be visible.*/- async waitForDisplay() {- await this.participant.driver.$(`.${DIALOG_CONTAINER}`).waitForDisplayed();+ waitForDisplay() {+ return this.participant.driver.$(`.${DIALOG_CONTAINER}`).waitForDisplayed();}/**@@ -30,7 +30,7 @@ export default class SecurityDialog extends BaseDialog {/*** Returns is the lobby enabled.*/- async isLobbyEnabled() {+ isLobbyEnabled() {return this.getLobbySwitch().isSelected();}@@ -47,15 +47,15 @@ export default class SecurityDialog extends BaseDialog {/*** Checks whether lobby section is present in the UI.*/- async isLobbySectionPresent() {- return await this.getLobbySwitch().isExisting();+ isLobbySectionPresent() {+ return this.getLobbySwitch().isExisting();}/*** Waits for the lobby to be enabled or disabled.* @param reverse*/- async waitForLobbyEnabled(reverse = false) {+ waitForLobbyEnabled(reverse = false) {const lobbySwitch = this.getLobbySwitch();return this.participant.driver.waitUntil(@@ -74,7 +74,7 @@ export default class SecurityDialog extends BaseDialog {* @return {@code true} if the conference is displayed as locked locally in* the security dialog, {@code false} otherwise.*/- private async isLockedLocally() {+ private isLockedLocally() {return this.participant.driver.$(`.${LOCAL_LOCK}`).isExisting();}@@ -84,8 +84,8 @@ export default class SecurityDialog extends BaseDialog {* @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();+ private isLockedRemotely() {+ return this.participant.driver.$(`.${REMOTE_LOCK}`).isExisting();}/**diff --git a/tests/pageobjects/SettingsDialog.ts b/tests/pageobjects/SettingsDialog.tsindex 9bc5cf9757..962f13d02d 100644--- a/tests/pageobjects/SettingsDialog.ts+++ b/tests/pageobjects/SettingsDialog.ts@@ -15,8 +15,8 @@ export default class SettingsDialog extends BaseDialog {/*** Waits for the settings dialog to be visible.*/- async waitForDisplay() {- await this.participant.driver.$(SETTINGS_DIALOG_CONTENT).waitForDisplayed();+ waitForDisplay() {+ return this.participant.driver.$(SETTINGS_DIALOG_CONTENT).waitForDisplayed();}/**@@ -34,22 +34,22 @@ export default class SettingsDialog extends BaseDialog {/*** Selects the Profile tab to be displayed.*/- async openProfileTab() {- await this.openTab(X_PATH_PROFILE_TAB);+ openProfileTab() {+ return this.openTab(X_PATH_PROFILE_TAB);}/*** Selects the More tab to be displayed.*/- async openMoreTab() {- await this.openTab(X_PATH_MORE_TAB);+ openMoreTab() {+ return this.openTab(X_PATH_MORE_TAB);}/*** Selects the moderator tab to be displayed.*/- async openModeratorTab() {- await this.openTab(X_PATH_MODERATOR_TAB);+ openModeratorTab() {+ return this.openTab(X_PATH_MODERATOR_TAB);}/**@@ -74,8 +74,8 @@ export default class SettingsDialog extends BaseDialog {/*** Clicks the OK button on the settings dialog to close the dialog and save any changes made.*/- async submit() {- await this.clickOkButton();+ submit() {+ return this.clickOkButton();}/**diff --git a/tests/pageobjects/Toolbar.ts b/tests/pageobjects/Toolbar.tsindex c294749263..31d0a3a3db 100644--- a/tests/pageobjects/Toolbar.ts+++ b/tests/pageobjects/Toolbar.ts@@ -55,9 +55,10 @@ export default class Toolbar extends BasePageObject {** @returns {Promise<void>}*/- async clickAudioMuteButton(): Promise<void> {+ clickAudioMuteButton(): Promise<void> {this.participant.log('Clicking on: Audio Mute Button');- await this.audioMuteBtn.click();++ return this.audioMuteBtn.click();}/**@@ -65,9 +66,10 @@ export default class Toolbar extends BasePageObject {** @returns {Promise<void>}*/- async clickAudioUnmuteButton(): Promise<void> {+ clickAudioUnmuteButton(): Promise<void> {this.participant.log('Clicking on: Audio Unmute Button');- await this.audioUnMuteBtn.click();++ return this.audioUnMuteBtn.click();}/**@@ -89,9 +91,10 @@ export default class Toolbar extends BasePageObject {** @returns {Promise<void>}*/- async clickVideoMuteButton(): Promise<void> {+ clickVideoMuteButton(): Promise<void> {this.participant.log('Clicking on: Video Mute Button');- await this.videoMuteBtn.click();++ return this.videoMuteBtn.click();}/**@@ -99,9 +102,10 @@ export default class Toolbar extends BasePageObject {** @returns {Promise<void>}*/- async clickVideoUnmuteButton(): Promise<void> {+ clickVideoUnmuteButton(): Promise<void> {this.participant.log('Clicking on: Video Unmute Button');- await this.videoUnMuteBtn.click();++ return this.videoUnMuteBtn.click();}/**@@ -109,9 +113,10 @@ export default class Toolbar extends BasePageObject {** @returns {Promise<void>}*/- async clickCloseParticipantsPaneButton(): Promise<void> {+ clickCloseParticipantsPaneButton(): Promise<void> {this.participant.log('Clicking on: Close Participants pane Button');- await this.getButton(CLOSE_PARTICIPANTS_PANE).click();++ return this.getButton(CLOSE_PARTICIPANTS_PANE).click();}/**@@ -119,101 +124,105 @@ export default class Toolbar extends BasePageObject {** @returns {Promise<void>}*/- async clickParticipantsPaneButton(): Promise<void> {+ clickParticipantsPaneButton(): Promise<void> {this.participant.log('Clicking on: Participants pane Button');// Special case for participants pane button, as it contains the number of participants and its label// is changing- await this.participant.driver.$(`[aria-label^="${PARTICIPANTS}"]`).click();+ return this.participant.driver.$(`[aria-label^="${PARTICIPANTS}"]`).click();}/*** Clicks on the video quality toolbar button which opens the* dialog for adjusting max-received video quality.*/- async clickVideoQualityButton(): Promise<void> {+ clickVideoQualityButton(): Promise<void> {return this.clickButtonInOverflowMenu(VIDEO_QUALITY);}/*** Clicks on the profile toolbar button which opens or closes the profile panel.*/- async clickProfileButton(): Promise<void> {+ clickProfileButton(): Promise<void> {return this.clickButtonInOverflowMenu(PROFILE);}/*** Clicks on the raise hand button that enables participants will to speak.*/- async clickRaiseHandButton(): Promise<void> {+ clickRaiseHandButton(): Promise<void> {this.participant.log('Clicking on: Raise hand Button');- await this.getButton(RAISE_HAND).click();++ return this.getButton(RAISE_HAND).click();}/*** Clicks on the chat button that opens chat panel.*/- async clickChatButton(): Promise<void> {+ clickChatButton(): Promise<void> {this.participant.log('Clicking on: Chat Button');- await this.getButton(CHAT).click();++ return this.getButton(CHAT).click();}/*** Clicks on the chat button that closes chat panel.*/- async clickCloseChatButton(): Promise<void> {+ clickCloseChatButton(): Promise<void> {this.participant.log('Clicking on: Close Chat Button');- await this.getButton(CLOSE_CHAT).click();++ return this.getButton(CLOSE_CHAT).click();}/*** Clicks on the desktop sharing button that starts desktop sharing.*/- async clickDesktopSharingButton() {- await this.getButton(DESKTOP).click();+ clickDesktopSharingButton() {+ return this.getButton(DESKTOP).click();}/*** Clicks on the desktop sharing button to stop it.*/- async clickStopDesktopSharingButton() {- await this.getButton(STOP_DESKTOP).click();+ clickStopDesktopSharingButton() {+ return this.getButton(STOP_DESKTOP).click();}/*** Clicks on the tile view button which enables tile layout.*/- async clickEnterTileViewButton() {- await this.getButton(ENTER_TILE_VIEW_BUTTON).click();+ clickEnterTileViewButton() {+ return this.getButton(ENTER_TILE_VIEW_BUTTON).click();}/*** Clicks on the tile view button which exits tile layout.*/- async clickExitTileViewButton() {- await this.getButton(EXIT_TILE_VIEW_BUTTON).click();+ clickExitTileViewButton() {+ return this.getButton(EXIT_TILE_VIEW_BUTTON).click();}/*** Clicks on the hangup button that ends the conference.*/- async clickHangupButton(): Promise<void> {+ clickHangupButton(): Promise<void> {this.participant.log('Clicking on: Hangup Button');- await this.getButton(HANGUP).click();++ return this.getButton(HANGUP).click();}/*** Clicks on the security toolbar button which opens the security panel.*/- async clickSecurityButton() {- await this.clickButtonInOverflowMenu(SECURITY);+ clickSecurityButton() {+ return this.clickButtonInOverflowMenu(SECURITY);}/*** Clicks on the settings toolbar button which opens or closes the settings panel.*/- async clickSettingsButton() {- await this.clickButtonInOverflowMenu(SETTINGS);+ clickSettingsButton() {+ return this.clickButtonInOverflowMenu(SETTINGS);}/**@@ -246,8 +255,8 @@ export default class Toolbar extends BasePageObject {* Clicks on the overflow toolbar button which opens or closes the overflow menu.* @private*/- private async clickOverflowButton(): Promise<void> {- await this.getButton(OVERFLOW).click();+ private clickOverflowButton(): Promise<void> {+ return this.getButton(OVERFLOW).click();}/**@@ -283,8 +292,8 @@ export default class Toolbar extends BasePageObject {* @param visible* @private*/- private async waitForOverFlowMenu(visible: boolean) {- await this.getButton(OVERFLOW_MENU).waitForDisplayed({+ private waitForOverFlowMenu(visible: boolean) {+ return this.getButton(OVERFLOW_MENU).waitForDisplayed({reverse: !visible,timeout: 3000,timeoutMsg: `Overflow menu is not ${visible ? 'visible' : 'hidden'}`diff --git a/tests/specs/2way/audioOnly.spec.ts b/tests/specs/2way/audioOnly.spec.tsindex 1352269787..9a47d1d123 100644--- a/tests/specs/2way/audioOnly.spec.ts+++ b/tests/specs/2way/audioOnly.spec.ts@@ -1,18 +1,12 @@import { ensureTwoParticipants } from '../../helpers/participants';describe('Audio only', () => {- it('joining the meeting', async () => {- await ensureTwoParticipants(ctx, {- skipFirstModerator: true- });- });+ it('joining the meeting', () => ensureTwoParticipants(ctx, { skipFirstModerator: true }));/*** Enables audio only mode for p1 and verifies that the other participant sees participant1 as video muted.*/- it('set and check', async () => {- await setAudioOnlyAndCheck(true);- });+ it('set and check', () => setAudioOnlyAndCheck(true));/*** Verifies that participant1 sees avatars for itself and other participants.@@ -29,9 +23,7 @@ describe('Audio only', () => {/*** Disables audio only mode and verifies that both participants see p1 as not video muted.*/- it('disable and check', async () => {- await setAudioOnlyAndCheck(false);- });+ it('disable and check', () => setAudioOnlyAndCheck(false));/*** Mutes video on participant1, toggles audio-only twice and then verifies if both participants see participant1diff --git a/tests/specs/2way/displayName.spec.ts b/tests/specs/2way/displayName.spec.tsindex 00981dfec0..8216d3564b 100644--- a/tests/specs/2way/displayName.spec.ts+++ b/tests/specs/2way/displayName.spec.ts@@ -1,11 +1,7 @@import { ensureTwoParticipants } from '../../helpers/participants';describe('DisplayName', () => {- it('joining the meeting', async () => {- await ensureTwoParticipants(ctx, {- skipDisplayName: true- });- });+ it('joining the meeting', () => ensureTwoParticipants(ctx, { skipDisplayName: true }));it('check change', async () => {const { p1, p2 } = ctx;diff --git a/tests/specs/2way/endConference.spec.ts b/tests/specs/2way/endConference.spec.tsindex e5e9cb5873..1ae9904aac 100644--- a/tests/specs/2way/endConference.spec.ts+++ b/tests/specs/2way/endConference.spec.ts@@ -1,9 +1,7 @@import { ensureTwoParticipants } from '../../helpers/participants';describe('End Conference', () => {- it('joining the meeting', async () => {- await ensureTwoParticipants(ctx);- });+ it('joining the meeting', () => ensureTwoParticipants(ctx));it('hangup call and check', async () => {const { p1 } = ctx;diff --git a/tests/specs/2way/iFrameApiParticipantsPresence.spec.ts b/tests/specs/2way/iFrameApiParticipantsPresence.spec.tsindex 700cb23491..c24260d762 100644--- a/tests/specs/2way/iFrameApiParticipantsPresence.spec.ts+++ b/tests/specs/2way/iFrameApiParticipantsPresence.spec.ts@@ -144,7 +144,7 @@ describe('Participants presence', () => {await p1.getIframeAPI().executeCommand('grantModerator', p2EpId);- await p2.driver.waitUntil(async () => await p2.getIframeAPI().getEventResult('isModerator'), {+ await p2.driver.waitUntil(() => p2.getIframeAPI().getEventResult('isModerator'), {timeout: 3000,timeoutMsg: 'Moderator role not granted'});@@ -202,13 +202,11 @@ describe('Participants presence', () => {await p1.getIframeAPI().executeCommand('kickParticipant', p2EpId);- const eventP1 = await p1.driver.waitUntil(async () =>- await p1.getIframeAPI().getEventResult('participantKickedOut'), {+ const eventP1 = await p1.driver.waitUntil(() => p1.getIframeAPI().getEventResult('participantKickedOut'), {timeout: 2000,timeoutMsg: 'participantKickedOut event not received on participant1 side'});- const eventP2 = await p2.driver.waitUntil(async () =>- await p2.getIframeAPI().getEventResult('participantKickedOut'), {+ const eventP2 = await p2.driver.waitUntil(() => p2.getIframeAPI().getEventResult('participantKickedOut'), {timeout: 2000,timeoutMsg: 'participantKickedOut event not received on participant2 side'});@@ -243,8 +241,8 @@ describe('Participants presence', () => {}})).toBe(true);- const eventConferenceLeftP2 = await p2.driver.waitUntil(async () =>- await p2.getIframeAPI().getEventResult('videoConferenceLeft'), {+ const eventConferenceLeftP2 = await p2.driver.waitUntil(() =>+ p2.getIframeAPI().getEventResult('videoConferenceLeft'), {timeout: 2000,timeoutMsg: 'videoConferenceLeft not received'});@@ -289,8 +287,7 @@ describe('Participants presence', () => {await p1.switchToAPI();- const event = await p1.driver.waitUntil(async () =>- await p1.getIframeAPI().getEventResult('participantJoined'), {+ const event = await p1.driver.waitUntil(() => p1.getIframeAPI().getEventResult('participantJoined'), {timeout: 2000,timeoutMsg: 'participantJoined not received'});@@ -341,8 +338,8 @@ describe('Participants presence', () => {await p2.getIframeAPI().executeCommand('hangup');- const eventConferenceLeftP2 = await p2.driver.waitUntil(async () =>- await p2.getIframeAPI().getEventResult('videoConferenceLeft'), {+ const eventConferenceLeftP2 = await p2.driver.waitUntil(() =>+ p2.getIframeAPI().getEventResult('videoConferenceLeft'), {timeout: 2000,timeoutMsg: 'videoConferenceLeft not received'});@@ -352,8 +349,7 @@ describe('Participants presence', () => {await checkParticipantLeftHook(p2, 'left');- const eventReadyToCloseP2 = await p2.driver.waitUntil(async () =>- await p2.getIframeAPI().getEventResult('readyToClose'), {+ const eventReadyToCloseP2 = await p2.driver.waitUntil(() => p2.getIframeAPI().getEventResult('readyToClose'), {timeout: 2000,timeoutMsg: 'readyToClose not received'});@@ -371,8 +367,8 @@ describe('Participants presence', () => {await p1.getIframeAPI().executeCommand('hangup');- const eventConferenceLeft = await p1.driver.waitUntil(async () =>- await p1.getIframeAPI().getEventResult('videoConferenceLeft'), {+ const eventConferenceLeft = await p1.driver.waitUntil(() =>+ p1.getIframeAPI().getEventResult('videoConferenceLeft'), {timeout: 2000,timeoutMsg: 'videoConferenceLeft not received'});@@ -397,8 +393,7 @@ describe('Participants presence', () => {expect(event.data.isBreakout).toBe(false);}- const eventReadyToClose = await p1.driver.waitUntil(async () =>- await p1.getIframeAPI().getEventResult('readyToClose'), {+ const eventReadyToClose = await p1.driver.waitUntil(() => p1.getIframeAPI().getEventResult('readyToClose'), {timeout: 2000,timeoutMsg: 'readyToClose not received'});diff --git a/tests/specs/2way/kick.spec.ts b/tests/specs/2way/kick.spec.tsindex ef01b9d87c..806dfbd284 100644--- a/tests/specs/2way/kick.spec.ts+++ b/tests/specs/2way/kick.spec.ts@@ -9,9 +9,7 @@ describe('Kick', () => {}});- it('kick and check', async () => {- await kickParticipant2AndCheck();- });+ it('kick and check', () => kickParticipant2AndCheck());it('kick p2p and check', async () => {await ensureTwoParticipants(ctx, {diff --git a/tests/specs/2way/selfView.spec.ts b/tests/specs/2way/selfView.spec.tsindex 8add001874..29036f9f94 100644--- a/tests/specs/2way/selfView.spec.ts+++ b/tests/specs/2way/selfView.spec.ts@@ -2,9 +2,7 @@ import type { Participant } from '../../helpers/Participant';import { ensureTwoParticipants } from '../../helpers/participants';describe('Self view', () => {- it('joining the meeting', async () => {- await ensureTwoParticipants(ctx);- });+ it('joining the meeting', () => ensureTwoParticipants(ctx));it('hide from menu', async () => {const { p1 } = ctx;diff --git a/tests/specs/3way/activeSpeaker.spec.ts b/tests/specs/3way/activeSpeaker.spec.tsindex 0ddb77185c..e4b82130c9 100644--- a/tests/specs/3way/activeSpeaker.spec.ts+++ b/tests/specs/3way/activeSpeaker.spec.ts@@ -61,8 +61,7 @@ async function testActiveSpeaker(const otherParticipant1Driver = otherParticipant1.driver;await otherParticipant1Driver.waitUntil(- async () => await otherParticipant1Driver.execute(- id => APP.UI.getLargeVideoID() === id, speakerEndpoint),+ () => otherParticipant1Driver.execute(id => APP.UI.getLargeVideoID() === id, speakerEndpoint),{timeout: 30_000, // 30 secondstimeoutMsg: 'Active speaker not displayed on large video.'diff --git a/tests/specs/3way/audioVideoModeration.spec.ts b/tests/specs/3way/audioVideoModeration.spec.tsindex f2927f796e..95fe51ce30 100644--- a/tests/specs/3way/audioVideoModeration.spec.ts+++ b/tests/specs/3way/audioVideoModeration.spec.ts@@ -135,7 +135,7 @@ describe('AVModeration', () => {await p1.getFilmstrip().grantModerator(p3);await p3.driver.waitUntil(- async () => await p3.isModerator(), {+ () => p3.isModerator(), {timeout: 5000,timeoutMsg: `${p3.name} is not moderator`});diff --git a/tests/specs/3way/avatars.spec.ts b/tests/specs/3way/avatars.spec.tsindex 46c649b4bd..88a8eb9b0a 100644--- a/tests/specs/3way/avatars.spec.ts+++ b/tests/specs/3way/avatars.spec.ts@@ -8,15 +8,14 @@ const EMAIL = '[email protected]';const HASH = '38f014e4b7dde0f64f8157d26a8c812e';describe('Avatar', () => {- it('setup the meeting', async () => {- // Start p1- await ensureTwoParticipants(ctx, {+ it('setup the meeting', () =>+ ensureTwoParticipants(ctx, {skipDisplayName: true,// no default avatar if we have used to join a token with an avatar and no option to set itskipFirstModerator: true- });- });+ })+ );it('change and check', async () => {const { p1, p2 } = ctx;diff --git a/tests/specs/3way/breakoutRooms.spec.ts b/tests/specs/3way/breakoutRooms.spec.tsindex 88e9f466e3..c14dda2622 100644--- a/tests/specs/3way/breakoutRooms.spec.ts+++ b/tests/specs/3way/breakoutRooms.spec.ts@@ -266,8 +266,8 @@ describe('BreakoutRooms', () => {});// there should be two participants in the main room, either p2 or p3 got moved to the main room- const checkParticipants = async (p: Participant) => {- await p.driver.waitUntil(+ const checkParticipants = (p: Participant) =>+ p.driver.waitUntil(async () => {const isInBreakoutRoom = await p.isInBreakoutRoom();const breakoutRooms = p.getBreakoutRooms();@@ -303,7 +303,6 @@ describe('BreakoutRooms', () => {timeout: 2000,timeoutMsg: `${p.name} is not seeing an empty breakout room and one with one participant`});- };await checkParticipants(p2);await checkParticipants(p3);diff --git a/tests/specs/3way/codecSelection.spec.ts b/tests/specs/3way/codecSelection.spec.tsindex 611d79c3a0..0db392a432 100644--- a/tests/specs/3way/codecSelection.spec.ts+++ b/tests/specs/3way/codecSelection.spec.ts@@ -104,14 +104,14 @@ describe('Codec selection', () => {// Check of p1 and p2 have switched to VP9.await p1.driver.waitUntil(- async () => await p1.driver.execute(() => JitsiMeetJS.app.testing.isLocalCameraEncodingVp9()),+ () => p1.driver.execute(() => JitsiMeetJS.app.testing.isLocalCameraEncodingVp9()),{timeout: 10000,timeoutMsg: 'p1 did not switch back to VP9'});await p2.driver.waitUntil(- async () => await p2.driver.execute(() => JitsiMeetJS.app.testing.isLocalCameraEncodingVp9()),+ () => p2.driver.execute(() => JitsiMeetJS.app.testing.isLocalCameraEncodingVp9()),{timeout: 10000,timeoutMsg: 'p1 did not switch back to VP9'diff --git a/tests/specs/3way/lobby.spec.ts b/tests/specs/3way/lobby.spec.tsindex 7646972cef..b20eaa55f0 100644--- a/tests/specs/3way/lobby.spec.ts+++ b/tests/specs/3way/lobby.spec.ts@@ -201,7 +201,7 @@ describe('Lobby', () => {await p1.hangup();await p2.driver.waitUntil(- async () => await p2.isModerator(),+ () => p2.isModerator(),{timeout: 3000,timeoutMsg: 'p2 is not moderator after p1 leaves'@@ -241,7 +241,7 @@ describe('Lobby', () => {await p1SecurityDialog.addPassword(roomPasscode);await p1.driver.waitUntil(- async () => await p1SecurityDialog.isLocked(),+ () => p1SecurityDialog.isLocked(),{timeout: 2000,timeoutMsg: 'room did not lock for p1'@@ -286,7 +286,7 @@ describe('Lobby', () => {await p1.hangup();await p2.driver.waitUntil(- async () => await p2.isModerator(),+ () => p2.isModerator(),{timeout: 3000,timeoutMsg: 'p2 is not moderator after p1 leaves'diff --git a/tests/specs/4way/desktopSharing.spec.ts b/tests/specs/4way/desktopSharing.spec.tsindex caba76cf13..9a8e814a71 100644--- a/tests/specs/4way/desktopSharing.spec.ts+++ b/tests/specs/4way/desktopSharing.spec.ts@@ -203,8 +203,7 @@ describe('Desktop sharing', () => {await checkForScreensharingTile(p3, p2);// the video should be playing- await p1.driver.waitUntil(async () =>- await p1.driver.execute(() => JitsiMeetJS.app.testing.isLargeVideoReceived()), {+ await p1.driver.waitUntil(() => p1.driver.execute(() => JitsiMeetJS.app.testing.isLargeVideoReceived()), {timeout: 5_000,timeoutMsg: 'expected remote screen share to be on large'});@@ -255,8 +254,7 @@ describe('Desktop sharing', () => {expect(await p1.driver.execute(() => APP.UI.getLargeVideoID())).toBe(`${await p3.getEndpointId()}-v1`);// the video should be playing- await p1.driver.waitUntil(async () =>- await p1.driver.execute(() => JitsiMeetJS.app.testing.isLargeVideoReceived()), {+ await p1.driver.waitUntil(() => p1.driver.execute(() => JitsiMeetJS.app.testing.isLargeVideoReceived()), {timeout: 5_000,timeoutMsg: 'expected remote screen share to be on large'});diff --git a/tests/specs/alone/chatPanel.spec.ts b/tests/specs/alone/chatPanel.spec.tsindex fae13da10d..f47d20746f 100644--- a/tests/specs/alone/chatPanel.spec.ts+++ b/tests/specs/alone/chatPanel.spec.ts@@ -1,9 +1,8 @@import { ensureOneParticipant } from '../../helpers/participants';describe('Chat Panel', () => {- it('join participant', async () => {- await ensureOneParticipant(ctx);- });+ it('join participant', () => ensureOneParticipant(ctx));+it('start closed', async () => {expect(await ctx.p1.getChatPanel().isOpen()).toBe(false);});diff --git a/tests/specs/alone/invite.spec.ts b/tests/specs/alone/invite.spec.tsindex 7be67c2301..285bf4ee65 100644--- a/tests/specs/alone/invite.spec.ts+++ b/tests/specs/alone/invite.spec.ts@@ -2,9 +2,7 @@ import { ensureOneParticipant } from '../../helpers/participants';import { isDialInEnabled } from '../helpers/DialIn';describe('Invite', () => {- it('join participant', async () => {- await ensureOneParticipant(ctx);- });+ it('join participant', () => ensureOneParticipant(ctx));it('url displayed', async () => {const { p1 } = ctx;