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): Send logs to browser to keep correct order.

damenchofa9703a41e2f
diff --git a/tests/helpers/Participant.ts b/tests/helpers/Participant.ts
index 3fb140ee57..43742f6fbd 100644
--- a/tests/helpers/Participant.ts
+++ b/tests/helpers/Participant.ts
@@ -191,8 +191,8 @@ export class Participant {
* @param {string} message - The message to log.
* @returns {void}
*/
- log(message: string): void {
- logInfo(this.driver, message);
+ async log(message: string): Promise<void> {
+ await logInfo(this.driver, message);
}
/**
diff --git a/tests/helpers/browserLogger.ts b/tests/helpers/browserLogger.ts
index 46bec40883..4ba66c5e23 100644
--- a/tests/helpers/browserLogger.ts
+++ b/tests/helpers/browserLogger.ts
@@ -70,17 +70,14 @@ export function saveLogs(driver: WebdriverIO.Browser, value: string) {
* @param {string} message - The message to add.
* @returns {void}
*/
-export function logInfo(driver: WebdriverIO.Browser, message: string) {
+export async function logInfo(driver: WebdriverIO.Browser, message: string) {
// @ts-ignore
if (!driver.logFile) {
return;
}
- try {
- // @ts-ignore
- fs.appendFileSync(driver.logFile, `${new Date().toISOString()} ${LOG_PREFIX} ${message}\n`);
- } catch (err) {
- console.error(err);
- }
+ return driver.execute((prefix, msg) =>
+ console.log(`${new Date().toISOString()} ${prefix} ${msg}\n`),
+ LOG_PREFIX, message);
}
diff --git a/tests/pageobjects/InviteDialog.ts b/tests/pageobjects/InviteDialog.ts
index ce06cc29c5..66bb4031ec 100644
--- a/tests/pageobjects/InviteDialog.ts
+++ b/tests/pageobjects/InviteDialog.ts
@@ -51,7 +51,7 @@ export default class InviteDialog extends BaseDialog {
const fullText = await elem.getText();
- this.participant.log(`Extracted text in invite dialog: ${fullText}`);
+ await this.participant.log(`Extracted text in invite dialog: ${fullText}`);
return fullText.split(':')[1].trim();
}
diff --git a/tests/pageobjects/Toolbar.ts b/tests/pageobjects/Toolbar.ts
index ba2ce166e5..1a7def7bbc 100644
--- a/tests/pageobjects/Toolbar.ts
+++ b/tests/pageobjects/Toolbar.ts
@@ -55,8 +55,8 @@ export default class Toolbar extends BasePageObject {
*
* @returns {Promise<void>}
*/
- clickAudioMuteButton(): Promise<void> {
- this.participant.log('Clicking on: Audio Mute Button');
+ async clickAudioMuteButton(): Promise<void> {
+ await this.participant.log('Clicking on: Audio Mute Button');
return this.audioMuteBtn.click();
}
@@ -66,8 +66,8 @@ export default class Toolbar extends BasePageObject {
*
* @returns {Promise<void>}
*/
- clickAudioUnmuteButton(): Promise<void> {
- this.participant.log('Clicking on: Audio Unmute Button');
+ async clickAudioUnmuteButton(): Promise<void> {
+ await this.participant.log('Clicking on: Audio Unmute Button');
return this.audioUnMuteBtn.click();
}
@@ -91,8 +91,8 @@ export default class Toolbar extends BasePageObject {
*
* @returns {Promise<void>}
*/
- clickVideoMuteButton(): Promise<void> {
- this.participant.log('Clicking on: Video Mute Button');
+ async clickVideoMuteButton(): Promise<void> {
+ await this.participant.log('Clicking on: Video Mute Button');
return this.videoMuteBtn.click();
}
@@ -102,8 +102,8 @@ export default class Toolbar extends BasePageObject {
*
* @returns {Promise<void>}
*/
- clickVideoUnmuteButton(): Promise<void> {
- this.participant.log('Clicking on: Video Unmute Button');
+ async clickVideoUnmuteButton(): Promise<void> {
+ await this.participant.log('Clicking on: Video Unmute Button');
return this.videoUnMuteBtn.click();
}
@@ -113,8 +113,8 @@ export default class Toolbar extends BasePageObject {
*
* @returns {Promise<void>}
*/
- clickCloseParticipantsPaneButton(): Promise<void> {
- this.participant.log('Clicking on: Close Participants pane Button');
+ async clickCloseParticipantsPaneButton(): Promise<void> {
+ await this.participant.log('Clicking on: Close Participants pane Button');
return this.getButton(CLOSE_PARTICIPANTS_PANE).click();
}
@@ -124,8 +124,8 @@ export default class Toolbar extends BasePageObject {
*
* @returns {Promise<void>}
*/
- clickParticipantsPaneButton(): Promise<void> {
- this.participant.log('Clicking on: Participants pane Button');
+ async clickParticipantsPaneButton(): Promise<void> {
+ await 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
@@ -150,8 +150,8 @@ export default class Toolbar extends BasePageObject {
/**
* Clicks on the raise hand button that enables participants will to speak.
*/
- clickRaiseHandButton(): Promise<void> {
- this.participant.log('Clicking on: Raise hand Button');
+ async clickRaiseHandButton(): Promise<void> {
+ await this.participant.log('Clicking on: Raise hand Button');
return this.getButton(RAISE_HAND).click();
}
@@ -159,8 +159,8 @@ export default class Toolbar extends BasePageObject {
/**
* Clicks on the chat button that opens chat panel.
*/
- clickChatButton(): Promise<void> {
- this.participant.log('Clicking on: Chat Button');
+ async clickChatButton(): Promise<void> {
+ await this.participant.log('Clicking on: Chat Button');
return this.getButton(CHAT).click();
}
@@ -168,8 +168,8 @@ export default class Toolbar extends BasePageObject {
/**
* Clicks on the chat button that closes chat panel.
*/
- clickCloseChatButton(): Promise<void> {
- this.participant.log('Clicking on: Close Chat Button');
+ async clickCloseChatButton(): Promise<void> {
+ await this.participant.log('Clicking on: Close Chat Button');
return this.getButton(CLOSE_CHAT).click();
}
@@ -205,8 +205,8 @@ export default class Toolbar extends BasePageObject {
/**
* Clicks on the hangup button that ends the conference.
*/
- clickHangupButton(): Promise<void> {
- this.participant.log('Clicking on: Hangup Button');
+ async clickHangupButton(): Promise<void> {
+ await this.participant.log('Clicking on: Hangup Button');
return this.getButton(HANGUP).click();
}
@@ -237,7 +237,7 @@ export default class Toolbar extends BasePageObject {
// so let's move focus away before clicking the button
await this.participant.driver.$('#overflow-context-menu').moveTo();
- this.participant.log(`Clicking on: ${accessibilityLabel}`);
+ await this.participant.log(`Clicking on: ${accessibilityLabel}`);
await this.getButton(accessibilityLabel).click();
await this.closeOverflowMenu();
diff --git a/tests/specs/media/activeSpeaker.spec.ts b/tests/specs/media/activeSpeaker.spec.ts
index 39f7e76544..309373e564 100644
--- a/tests/specs/media/activeSpeaker.spec.ts
+++ b/tests/specs/media/activeSpeaker.spec.ts
@@ -272,19 +272,19 @@ describe('Active speaker', () => {
*/
async function testActiveSpeaker(
activeSpeaker: Participant, otherParticipant1: Participant, otherParticipant2: Participant) {
- activeSpeaker.log(`Start testActiveSpeaker for participant: ${activeSpeaker.name}`);
+ await activeSpeaker.log(`Start testActiveSpeaker for participant: ${activeSpeaker.name}`);
const speakerEndpoint = await activeSpeaker.getEndpointId();
// just a debug print to go in logs
- activeSpeaker.log('Unmuting in testActiveSpeaker');
+ await activeSpeaker.log('Unmuting in testActiveSpeaker');
// Unmute
await activeSpeaker.getToolbar().clickAudioUnmuteButton();
// just a debug print to go in logs
- otherParticipant1.log(`Participant unmuted in testActiveSpeaker ${speakerEndpoint}`);
- otherParticipant2.log(`Participant unmuted in testActiveSpeaker ${speakerEndpoint}`);
+ await otherParticipant1.log(`Participant unmuted in testActiveSpeaker ${speakerEndpoint}`);
+ await otherParticipant2.log(`Participant unmuted in testActiveSpeaker ${speakerEndpoint}`);
await activeSpeaker.getFilmstrip().assertAudioMuteIconIsDisplayed(activeSpeaker, true);
@@ -297,14 +297,14 @@ async function testActiveSpeaker(
30_000); // 30 seconds
// just a debug print to go in logs
- activeSpeaker.log('Muting in testActiveSpeaker');
+ await activeSpeaker.log('Muting in testActiveSpeaker');
// Mute back again
await activeSpeaker.getToolbar().clickAudioMuteButton();
// just a debug print to go in logs
- otherParticipant1.log(`Participant muted in testActiveSpeaker ${speakerEndpoint}`);
- otherParticipant2.log(`Participant muted in testActiveSpeaker ${speakerEndpoint}`);
+ await otherParticipant1.log(`Participant muted in testActiveSpeaker ${speakerEndpoint}`);
+ await otherParticipant2.log(`Participant muted in testActiveSpeaker ${speakerEndpoint}`);
await otherParticipant1.getFilmstrip().assertAudioMuteIconIsDisplayed(activeSpeaker);
}
diff --git a/tests/specs/media/startMuted.spec.ts b/tests/specs/media/startMuted.spec.ts
index 02a9693bca..7d58a0573b 100644
--- a/tests/specs/media/startMuted.spec.ts
+++ b/tests/specs/media/startMuted.spec.ts
@@ -127,7 +127,7 @@ describe('Start muted', () => {
const p2ID = await p2.getEndpointId();
- p1.log(`Start configOptionsTest, second participant: ${p2ID}`);
+ await p1.log(`Start configOptionsTest, second participant: ${p2ID}`);
// Participant 3 should be muted, 1 and 2 unmuted.
await p3.getFilmstrip().assertAudioMuteIconIsDisplayed(p3);
@@ -148,7 +148,7 @@ describe('Start muted', () => {
await p1.getToolbar().clickAudioMuteButton();
await p2.getToolbar().clickAudioMuteButton();
await p3.getToolbar().clickAudioUnmuteButton();
- p1.log('configOptionsTest, unmuted third participant');
+ await p1.log('configOptionsTest, unmuted third participant');
await p1.waitForAudioMuted(p3, false /* unmuted */);
});