diff --git a/tests/helpers/Participant.ts b/tests/helpers/Participant.ts index f445379842..f580ecb1e5 100644 --- a/tests/helpers/Participant.ts +++ b/tests/helpers/Participant.ts @@ -363,11 +363,9 @@ export class Participant { * * @returns {Promise} */ - async waitForP2PIceConnected(): Promise { - const driver = this.driver; - - return driver.waitUntil(() => - driver.execute(() => APP?.conference?.getP2PConnectionState() === 'connected'), { + waitForP2PIceConnected(): Promise { + return this.driver.waitUntil(() => + this.execute(() => APP?.conference?.getP2PConnectionState() === 'connected'), { timeout: 15_000, timeoutMsg: `expected P2P ICE to be connected for 15s for ${this.name}` }); diff --git a/tests/specs/2way/mute.spect.ts b/tests/specs/2way/mute.spect.ts index 0c120bf9dd..8e848f12a7 100644 --- a/tests/specs/2way/mute.spect.ts +++ b/tests/specs/2way/mute.spect.ts @@ -3,7 +3,10 @@ import { checkForScreensharingTile, ensureOneParticipant, ensureTwoParticipants, - joinSecondParticipant + joinSecondParticipant, + muteAudioAndCheck, + unmuteAudioAndCheck, + unmuteVideoAndCheck } from '../../helpers/participants'; describe('Mute', () => { @@ -33,10 +36,7 @@ describe('Mute', () => { it('p2 unmute after p1 mute and check', async () => { const { p1, p2 } = ctx; - await p2.getToolbar().clickAudioUnmuteButton(); - - // and now check whether second participant is muted - await p1.getFilmstrip().assertAudioMuteIconIsDisplayed(p2, true); + await unmuteAudioAndCheck(p2, p1); }); it('p1 mutes before p2 joins', async () => { @@ -73,13 +73,10 @@ async function toggleMuteAndCheck( observer: Participant, muted: boolean) { if (muted) { - await testee.getToolbar().clickAudioMuteButton(); + await muteAudioAndCheck(testee, observer); } else { - await testee.getToolbar().clickAudioUnmuteButton(); + await unmuteAudioAndCheck(testee, observer); } - - await observer.getFilmstrip().assertAudioMuteIconIsDisplayed(testee, !muted); - await testee.getFilmstrip().assertAudioMuteIconIsDisplayed(testee, !muted); } /** @@ -136,7 +133,6 @@ async function muteP1BeforeP2JoinsAndScreenshare(p2p: boolean) { await p1.getToolbar().clickStopDesktopSharingButton(); await p2.getParticipantsPane().assertVideoMuteIconIsDisplayed(p1); - await p1.getToolbar().clickVideoUnmuteButton(); - await p2.getParticipantsPane().assertVideoMuteIconIsDisplayed(p1, true); + await unmuteVideoAndCheck(p1, p2); await p2.waitForRemoteVideo(await p1.getEndpointId()); } diff --git a/tests/specs/3way/avatars.spec.ts b/tests/specs/3way/avatars.spec.ts index e575f7a819..a8da55731a 100644 --- a/tests/specs/3way/avatars.spec.ts +++ b/tests/specs/3way/avatars.spec.ts @@ -173,10 +173,7 @@ describe('Avatar', () => { await p3.hangup(); // Unmute p1's and p2's videos - await p1.getToolbar().clickVideoUnmuteButton(); - - await p2.getParticipantsPane().assertVideoMuteIconIsDisplayed(p1, true); - await p1.getParticipantsPane().assertVideoMuteIconIsDisplayed(p1, true); + await unmuteVideoAndCheck(p1, p2); }); it('email persistence', async () => { diff --git a/tests/specs/3way/startMuted.spec.ts b/tests/specs/3way/startMuted.spec.ts index d84624fc94..7fa4d384d3 100644 --- a/tests/specs/3way/startMuted.spec.ts +++ b/tests/specs/3way/startMuted.spec.ts @@ -234,10 +234,8 @@ describe('StartMuted', () => { const { p3 } = ctx; // Unmute p2 and check if its video is being received by p1 and p3. - await p2.getToolbar().clickVideoUnmuteButton(); - + await unmuteVideoAndCheck(p2, p3); await p1.getParticipantsPane().assertVideoMuteIconIsDisplayed(p2, true); - await p3.getParticipantsPane().assertVideoMuteIconIsDisplayed(p2, true); // Mute p2's video just before p3 leaves. await p2.getToolbar().clickVideoMuteButton();