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 switch video test.
damenchof2238935b5aa
diff --git a/tests/pageobjects/Filmstrip.ts b/tests/pageobjects/Filmstrip.tsindex 28309f1e12..598592008c 100644--- a/tests/pageobjects/Filmstrip.ts+++ b/tests/pageobjects/Filmstrip.ts@@ -80,12 +80,49 @@ export default class Filmstrip extends BasePageObject {* @param participant The participant.*/async pinParticipant(participant: Participant) {+ let videoIdToSwitchTo;+if (participant === this.participant) {+ videoIdToSwitchTo = await this.getLocalVideoId();+// 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.execute(() => document?.getElementById('localVideoContainer')?.click());+ } else {+ const epId = await participant.getEndpointId();++ videoIdToSwitchTo = await this.getRemoteVideoId(epId);++ await this.participant.driver.$(`//span[@id="participant_${epId}"]`).click();}- return this.participant.driver.$(`//span[@id="participant_${await participant.getEndpointId()}"]`).click();+ await this.participant.driver.waitUntil(+ async () => await this.participant.getLargeVideo().getId() === videoIdToSwitchTo,+ {+ timeout: 3_000,+ timeoutMsg: `${this.participant.displayName} did not switch the large video to ${+ participant.displayName}`+ }+ );+ }++ /**+ * Unpins a participant by clicking on their thumbnail.+ * @param participant+ */+ async unpinParticipant(participant: Participant) {+ const epId = await participant.getEndpointId();++ if (participant === this.participant) {+ await this.participant.execute(() => document?.getElementById('localVideoContainer')?.click());+ } else {+ await this.participant.driver.$(`//span[@id="participant_${epId}"]`).click();+ }++ await this.participant.driver.$(`//div[ @id="pin-indicator-${epId}" ]`).waitForDisplayed({+ timeout: 2_000,+ timeoutMsg: `${this.participant.displayName} did not unpin ${participant.displayName}`,+ reverse: true+ });}/**diff --git a/tests/pageobjects/Toolbar.ts b/tests/pageobjects/Toolbar.tsindex 31d0a3a3db..ba2ce166e5 100644--- a/tests/pageobjects/Toolbar.ts+++ b/tests/pageobjects/Toolbar.ts@@ -277,7 +277,7 @@ export default class Toolbar extends BasePageObject {* Ensures the overflow menu is not displayed.* @private*/- private async closeOverflowMenu() {+ async closeOverflowMenu() {if (!await this.isOverflowMenuOpen()) {return;}diff --git a/tests/specs/2way/switchVideo.spec.ts b/tests/specs/2way/switchVideo.spec.tsnew file mode 100644index 0000000000..bb7e6c0f6d--- /dev/null+++ b/tests/specs/2way/switchVideo.spec.ts@@ -0,0 +1,39 @@+import { ensureTwoParticipants } from '../../helpers/participants';++describe('SwitchVideo', () => {+ it('joining the meeting', () => ensureTwoParticipants(ctx));++ it('p1 click on local', () => ctx.p1.getFilmstrip().pinParticipant(ctx.p1));++ it('p1 click on remote', async () => {+ await closeToolbarMenu();++ const { p1, p2 } = ctx;++ await p1.getFilmstrip().pinParticipant(p2);+ });++ it('p1 unpin remote', () => ctx.p1.getFilmstrip().unpinParticipant(ctx.p2));++ it('p2 pin remote', () => ctx.p2.getFilmstrip().pinParticipant(ctx.p1));++ it('p2 unpin remote', () => ctx.p2.getFilmstrip().unpinParticipant(ctx.p1));++ it('p2 click on local', () => ctx.p2.getFilmstrip().pinParticipant(ctx.p2));++ it('p2 click on remote', async () => {+ await closeToolbarMenu();++ const { p1, p2 } = ctx;++ await p2.getFilmstrip().pinParticipant(p1);+ });+});++/**+ * Closes the overflow menu on both participants.+ */+async function closeToolbarMenu() {+ await ctx.p1.getToolbar().closeOverflowMenu();+ await ctx.p2.getToolbar().closeOverflowMenu();+}diff --git a/tests/specs/3way/oneOnOne.spec.ts b/tests/specs/3way/oneOnOne.spec.tsindex 341b3adbba..28ccee3842 100644--- a/tests/specs/3way/oneOnOne.spec.ts+++ b/tests/specs/3way/oneOnOne.spec.ts@@ -56,7 +56,7 @@ describe('OneOnOne', () => {await p1.getFilmstrip().pinParticipant(p1);await p1.getFilmstrip().verifyRemoteVideosDisplay(true);- await p1.getFilmstrip().pinParticipant(p1);+ await p1.getFilmstrip().unpinParticipant(p1);await p1.getFilmstrip().verifyRemoteVideosDisplay(false);});