Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

test: Add a test for visitors with single sender (PLI). (#16364)

bgrozev61ee9af304df
diff --git a/tests/helpers/Participant.ts b/tests/helpers/Participant.ts
index 29e8ced9a8..9bdbb7c057 100644
--- a/tests/helpers/Participant.ts
+++ b/tests/helpers/Participant.ts
@@ -468,7 +468,7 @@ export class Participant {
}
/**
- * Waits for remote streams.
+ * Waits until there are at least [number] participants that have at least one track.
*
* @param {number} number - The number of remote streams to wait for.
* @returns {Promise<boolean>}
@@ -874,26 +874,46 @@ export class Participant {
}
}
+ /**
+ * Checks if video is currently received for the given remote endpoint ID (there is a track, it's not muted,
+ * and it's streaming status according to the connection-indicator is active).
+ */
+ async isRemoteVideoReceived(endpointId: string): Promise<boolean> {
+ return this.execute(e => JitsiMeetJS.app.testing.isRemoteVideoReceived(e), endpointId);
+ }
+
+ /**
+ * Checks if the remove video is displayed for the given remote endpoint ID.
+ * @param endpointId
+ */
+ async isRemoteVideoDisplayed(endpointId: string): Promise<boolean> {
+ return this.driver.$(
+ `//span[@id="participant_${endpointId}" and contains(@class, "display-video")]`).isExisting();
+ }
+
+ /**
+ * Check if remote video for a specific remote endpoint is both received and displayed.
+ * @param endpointId
+ */
+ async isRemoteVideoReceivedAndDisplayed(endpointId: string): Promise<boolean> {
+ return await this.isRemoteVideoReceived(endpointId) && await this.isRemoteVideoDisplayed(endpointId);
+ }
/**
* Waits for remote video state - receiving and displayed.
* @param endpointId
- * @param reverse
+ * @param reverse if true, waits for the remote video to NOT be received AND NOT displayed.
*/
async waitForRemoteVideo(endpointId: string, reverse = false) {
if (reverse) {
await this.driver.waitUntil(async () =>
- !await this.execute(epId => JitsiMeetJS.app.testing.isRemoteVideoReceived(`${epId}`),
- endpointId) && !await this.driver.$(
- `//span[@id="participant_${endpointId}" and contains(@class, "display-video")]`).isExisting(), {
+ !await this.isRemoteVideoReceived(endpointId) && !await this.isRemoteVideoDisplayed(endpointId), {
timeout: 15_000,
timeoutMsg: `expected remote video for ${endpointId} to not be received 15s by ${this.name}`
});
} else {
await this.driver.waitUntil(async () =>
- await this.execute(epId => JitsiMeetJS.app.testing.isRemoteVideoReceived(`${epId}`),
- endpointId) && await this.driver.$(
- `//span[@id="participant_${endpointId}" and contains(@class, "display-video")]`).isExisting(), {
+ await this.isRemoteVideoReceivedAndDisplayed(endpointId), {
timeout: 15_000,
timeoutMsg: `expected remote video for ${endpointId} to be received 15s by ${this.name}`
});
diff --git a/tests/specs/jaas/visitors/videoWithSingleSender.spec.ts b/tests/specs/jaas/visitors/videoWithSingleSender.spec.ts
new file mode 100644
index 0000000000..8214b13df6
--- /dev/null
+++ b/tests/specs/jaas/visitors/videoWithSingleSender.spec.ts
@@ -0,0 +1,61 @@
+import { setTestProperties } from '../../../helpers/TestProperties';
+import { joinMuc, generateJaasToken as t } from '../../helpers/jaas';
+
+setTestProperties(__filename, {
+ useJaas: true,
+ useWebhookProxy: true,
+ usesBrowsers: [ 'p1', 'p2', 'p3', 'p4' ]
+});
+
+/**
+ * This is a case which fails if jitsi-videobridge doesn't properly forward PLIs from visitors.
+ */
+describe('Visitor receiving video from a single remote participant', () => {
+ it('joining the meeting', async () => {
+ ctx.webhooksProxy.defaultMeetingSettings = {
+ visitorsEnabled: true,
+ visitorsLive: true,
+ };
+
+ // Force a connection via JVB.
+ const configOverwrite = {
+ p2p: {
+ enabled: false
+ }
+ };
+ const sender = await joinMuc(
+ 'p1',
+ t({ room: ctx.roomName, displayName: 'Sender', moderator: true }), {
+ configOverwrite
+ }
+ );
+ const senderEndpointId = await sender.getEndpointId();
+
+ const testVisitor = async function(instanceId: 'p1' | 'p2' | 'p3' | 'p4') {
+ const visitor = await joinMuc(
+ instanceId,
+ t({ room: ctx.roomName, displayName: 'Visitor', visitor: true }), {
+ configOverwrite
+ }
+ );
+
+ await visitor.waitForIceConnected();
+
+ const iceConnected = performance.now();
+
+ await visitor.driver.waitUntil(
+ () => visitor.isRemoteVideoReceivedAndDisplayed(senderEndpointId), {
+ timeout: 10_000,
+ timeoutMsg: `Visitor (${instanceId}) is not receiving video from the sender`
+ });
+
+ const duration = performance.now() - iceConnected;
+
+ console.log(`Video displayed after ${duration} ms after ICE connected (${instanceId})`);
+ };
+
+ await testVisitor('p2');
+ await testVisitor('p3');
+ await testVisitor('p4');
+ });
+});
diff --git a/tests/wdio.conf.ts b/tests/wdio.conf.ts
index 5407689503..5c5adec9e8 100644
--- a/tests/wdio.conf.ts
+++ b/tests/wdio.conf.ts
@@ -233,6 +233,7 @@ export const config: WebdriverIO.MultiremoteConfig = {
}));
globalAny.ctx.roomName = generateRoomName(testName);
+ console.log(`Using room name: ${globalAny.ctx.roomName}`);
// If we are running the iFrameApi tests, we need to mark it as such and if needed to create the proxy
// and connect to it.