diff --git a/tests/pageobjects/Filmstrip.ts b/tests/pageobjects/Filmstrip.ts index 9a752b0dde..28309f1e12 100644 --- a/tests/pageobjects/Filmstrip.ts +++ b/tests/pageobjects/Filmstrip.ts @@ -80,10 +80,12 @@ export default class Filmstrip extends BasePageObject { * @param participant The participant. */ async pinParticipant(participant: Participant) { - const id = participant === this.participant - ? 'localVideoContainer' : `participant_${await participant.getEndpointId()}`; + if (participant === this.participant) { + // when looking up the element and clicking it, it doesn't work if we do it twice in a row (oneOnOne.spec) + return this.participant.execute(() => document?.getElementById('localVideoContainer')?.click()); + } - await this.participant.driver.$(`//span[@id="${id}"]`).click(); + return this.participant.driver.$(`//span[@id="participant_${await participant.getEndpointId()}"]`).click(); } /** @@ -155,12 +157,19 @@ export default class Filmstrip extends BasePageObject { return this.clickOnRemoteMenuLink(participantId, 'kicklink', true); } + /** + * Hover over local video. + */ + hoverOverLocalVideo() { + return this.participant.driver.$(LOCAL_VIDEO_MENU_TRIGGER).moveTo(); + } + /** * Clicks on the hide self view button from local video. */ async hideSelfView() { // open local video menu - await this.participant.driver.$(LOCAL_VIDEO_MENU_TRIGGER).moveTo(); + await this.hoverOverLocalVideo(); await this.participant.driver.$(LOCAL_USER_CONTROLS).moveTo(); // click Hide self view button @@ -215,4 +224,16 @@ export default class Filmstrip extends BasePageObject { return (await this.participant.driver.$$('//div[@id="remoteVideos"]//span[contains(@class,"videocontainer")]') .filter(thumbnail => thumbnail.isDisplayed())).length; } + + /** + * Check if remote videos in filmstrip are visible. + * + * @param isDisplayed whether or not filmstrip remote videos should be visible + */ + verifyRemoteVideosDisplay(isDisplayed: boolean) { + return this.participant.driver.$('//div[contains(@class, "remote-videos")]/div').waitForDisplayed({ + timeout: 5_000, + reverse: !isDisplayed, + }); + } } diff --git a/tests/specs/3way/oneOnOne.spec.ts b/tests/specs/3way/oneOnOne.spec.ts new file mode 100644 index 0000000000..341b3adbba --- /dev/null +++ b/tests/specs/3way/oneOnOne.spec.ts @@ -0,0 +1,81 @@ +import type { Participant } from '../../helpers/Participant'; +import { + ensureThreeParticipants, + ensureTwoParticipants +} from '../../helpers/participants'; + +const ONE_ON_ONE_CONFIG_OVERRIDES = { + configOverwrite: { + disable1On1Mode: false, + toolbarConfig: { + timeout: 500, + alwaysVisible: false + } + } +}; + +describe('OneOnOne', () => { + it('filmstrip hidden in 1on1', async () => { + await ensureTwoParticipants(ctx, ONE_ON_ONE_CONFIG_OVERRIDES); + + const { p1, p2 } = ctx; + + await configureToolbarsToHideQuickly(p1); + await configureToolbarsToHideQuickly(p2); + + await p1.getFilmstrip().verifyRemoteVideosDisplay(false); + await p2.getFilmstrip().verifyRemoteVideosDisplay(false); + }); + + it('filmstrip visible with more than 2', async () => { + await ensureThreeParticipants(ctx, ONE_ON_ONE_CONFIG_OVERRIDES); + + const { p1, p2, p3 } = ctx; + + await configureToolbarsToHideQuickly(p3); + + await p1.getFilmstrip().verifyRemoteVideosDisplay(true); + await p2.getFilmstrip().verifyRemoteVideosDisplay(true); + await p3.getFilmstrip().verifyRemoteVideosDisplay(true); + }); + + it('filmstrip display when returning to 1on1', async () => { + const { p1, p2, p3 } = ctx; + + await p2.getFilmstrip().pinParticipant(p2); + + await p3.hangup(); + + await p1.getFilmstrip().verifyRemoteVideosDisplay(false); + await p2.getFilmstrip().verifyRemoteVideosDisplay(true); + }); + + it('filmstrip visible on self view focus', async () => { + const { p1 } = ctx; + + await p1.getFilmstrip().pinParticipant(p1); + await p1.getFilmstrip().verifyRemoteVideosDisplay(true); + + await p1.getFilmstrip().pinParticipant(p1); + await p1.getFilmstrip().verifyRemoteVideosDisplay(false); + }); + + it('filmstrip hover show videos', async () => { + const { p1 } = ctx; + + await p1.getFilmstrip().hoverOverLocalVideo(); + + await p1.getFilmstrip().verifyRemoteVideosDisplay(true); + }); +}); + +/** + * Hangs up all participants (p1, p2 and p3) + * @returns {Promise} + */ +function configureToolbarsToHideQuickly(participant: Participant): Promise { + return participant.execute(() => { + APP.UI.dockToolbar(false); + APP.UI.showToolbar(250); + }); +}