snapshot of https://github.com/jitsi/jitsi-meet.git @ fd1749dd28f4138aa80234fc7f311b19aaffa0e7 (2026-09-15)
This commit is contained in:
82
tests/specs/jaas/dial/dialin.spec.ts
Normal file
82
tests/specs/jaas/dial/dialin.spec.ts
Normal file
@@ -0,0 +1,82 @@
|
||||
import type { Participant } from '../../../helpers/Participant';
|
||||
import { setTestProperties } from '../../../helpers/TestProperties';
|
||||
import { config as testsConfig } from '../../../helpers/TestsConfig';
|
||||
import WebhookProxy from '../../../helpers/WebhookProxy';
|
||||
import { expectations } from '../../../helpers/expectations';
|
||||
import { joinJaasMuc, generateJaasToken as t } from '../../../helpers/jaas';
|
||||
import {
|
||||
assertDialInDisplayed, assertUrlDisplayed,
|
||||
dialIn,
|
||||
isDialInEnabled, verifyMoreNumbersPage,
|
||||
} from '../../helpers/DialIn';
|
||||
|
||||
import { verifyEndedWebhook, verifyStartedWebhooks, waitForMedia } from './util';
|
||||
|
||||
setTestProperties(__filename, {
|
||||
useJaas: true,
|
||||
useWebhookProxy: true
|
||||
});
|
||||
|
||||
describe('Dial-in', () => {
|
||||
let p1: Participant, webhooksProxy: WebhookProxy;
|
||||
const customerId: string = testsConfig.jaas.customerId || '';
|
||||
|
||||
it('setup', async () => {
|
||||
const room = ctx.roomName;
|
||||
|
||||
if (!process.env.DIAL_IN_REST_URL) {
|
||||
ctx.skipSuiteTests = 'DIAL_IN_REST_URL is not set.';
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
p1 = await joinJaasMuc({ name: 'p1', token: t({ room, moderator: true }) });
|
||||
webhooksProxy = ctx.webhooksProxy;
|
||||
if (!webhooksProxy) {
|
||||
console.error('WebhooksProxy is not available, will not verify webhooks.');
|
||||
}
|
||||
|
||||
expect(await p1.isInMuc()).toBe(true);
|
||||
if (expectations.dialIn.enabled !== null) {
|
||||
expect(await isDialInEnabled(p1)).toBe(expectations.dialIn.enabled);
|
||||
}
|
||||
expect(customerId).toBeDefined();
|
||||
});
|
||||
|
||||
it ('Invite UI', async () => {
|
||||
await assertUrlDisplayed(p1);
|
||||
if (expectations.dialIn.enabled !== null) {
|
||||
await assertDialInDisplayed(p1, expectations.dialIn.enabled);
|
||||
}
|
||||
if (expectations.dialIn.moreNumbersPage) {
|
||||
// TODO: assert the page is NOT shown when the expectation is false.
|
||||
await verifyMoreNumbersPage(p1);
|
||||
}
|
||||
});
|
||||
|
||||
it('dial-in', async () => {
|
||||
const dialInPin = await p1.getDialInPin();
|
||||
|
||||
expect(dialInPin.length).toBeGreaterThanOrEqual(8);
|
||||
|
||||
await dialIn(dialInPin);
|
||||
await waitForMedia(p1);
|
||||
|
||||
let startedPayload: any;
|
||||
|
||||
if (webhooksProxy) {
|
||||
startedPayload
|
||||
= await verifyStartedWebhooks(webhooksProxy, 'in', 'DIAL_IN_STARTED', customerId);
|
||||
}
|
||||
|
||||
const endpointId = await p1.execute(() => APP?.conference?.listMembers()[0].getId());
|
||||
|
||||
await p1.getFilmstrip().kickParticipant(endpointId);
|
||||
|
||||
if (webhooksProxy) {
|
||||
await verifyEndedWebhook(webhooksProxy, 'DIAL_IN_ENDED', customerId, startedPayload);
|
||||
}
|
||||
|
||||
await p1.hangup();
|
||||
});
|
||||
});
|
||||
50
tests/specs/jaas/dial/dialout.spec.ts
Normal file
50
tests/specs/jaas/dial/dialout.spec.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
import type { Participant } from '../../../helpers/Participant';
|
||||
import { setTestProperties } from '../../../helpers/TestProperties';
|
||||
import { config as testsConfig } from '../../../helpers/TestsConfig';
|
||||
import WebhookProxy from '../../../helpers/WebhookProxy';
|
||||
import { joinJaasMuc, generateJaasToken as t } from '../../../helpers/jaas';
|
||||
|
||||
import { verifyEndedWebhook, verifyStartedWebhooks, waitForMedia } from './util';
|
||||
|
||||
setTestProperties(__filename, {
|
||||
requireWebhookProxy: true,
|
||||
useJaas: true
|
||||
});
|
||||
|
||||
describe('Dial-out', () => {
|
||||
let p1: Participant, webhooksProxy: WebhookProxy;
|
||||
const dialOutUrl = process.env.DIAL_OUT_URL || '';
|
||||
const customerId = testsConfig.jaas.customerId || '';
|
||||
|
||||
it('setup', async () => {
|
||||
const room = ctx.roomName;
|
||||
|
||||
if (!dialOutUrl) {
|
||||
ctx.skipSuiteTests = 'DIAL_OUT_URL is not set.';
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
webhooksProxy = ctx.webhooksProxy;
|
||||
p1 = await joinJaasMuc({ name: 'p1', iFrameApi: true, token: t({ room, moderator: true }) });
|
||||
|
||||
expect(await p1.isInMuc()).toBe(true);
|
||||
expect(Boolean(await p1.execute(() => config.dialOutAuthUrl))).toBe(true);
|
||||
});
|
||||
|
||||
it('dial-out', async () => {
|
||||
await p1.switchToMainFrame();
|
||||
await p1.getIframeAPI().invitePhone(dialOutUrl);
|
||||
await p1.switchToIFrame();
|
||||
await p1.waitForParticipants(1);
|
||||
await waitForMedia(p1);
|
||||
|
||||
const startedPayload
|
||||
= await verifyStartedWebhooks(webhooksProxy, 'out', 'DIAL_OUT_STARTED', customerId);
|
||||
const endpointId = await p1.execute(() => APP?.conference?.listMembers()[0].getId());
|
||||
|
||||
await p1.getFilmstrip().kickParticipant(endpointId);
|
||||
|
||||
await verifyEndedWebhook(webhooksProxy, 'DIAL_OUT_ENDED', customerId, startedPayload);
|
||||
});
|
||||
});
|
||||
79
tests/specs/jaas/dial/sipjibri.spec.ts
Normal file
79
tests/specs/jaas/dial/sipjibri.spec.ts
Normal file
@@ -0,0 +1,79 @@
|
||||
import type { Participant } from '../../../helpers/Participant';
|
||||
import { setTestProperties } from '../../../helpers/TestProperties';
|
||||
import { config as testsConfig } from '../../../helpers/TestsConfig';
|
||||
import WebhookProxy from '../../../helpers/WebhookProxy';
|
||||
import { joinJaasMuc, generateJaasToken as t } from '../../../helpers/jaas';
|
||||
|
||||
import { waitForMedia } from './util';
|
||||
|
||||
setTestProperties(__filename, {
|
||||
requireWebhookProxy: true,
|
||||
useJaas: true,
|
||||
});
|
||||
|
||||
|
||||
describe('SIP jibri invite', () => {
|
||||
let p1: Participant, webhooksProxy: WebhookProxy;
|
||||
const customerId = testsConfig.jaas.customerId || '';
|
||||
const dialOutUrl = process.env.SIP_JIBRI_DIAL_OUT_URL || '';
|
||||
|
||||
it('setup', async () => {
|
||||
const room = ctx.roomName;
|
||||
|
||||
if (!dialOutUrl) {
|
||||
ctx.skipSuiteTests = 'SIP_JIBRI_DIAL_OUT_URL is not set.';
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
p1 = await joinJaasMuc({ name: 'p1', iFrameApi: true, token: t({ room, moderator: true }) });
|
||||
webhooksProxy = ctx.webhooksProxy;
|
||||
|
||||
expect(await p1.isInMuc()).toBe(true);
|
||||
expect(Boolean(await p1.execute(() => config.inviteServiceUrl))).toBe(true);
|
||||
});
|
||||
|
||||
it('sip jibri', async () => {
|
||||
await p1.switchToMainFrame();
|
||||
await p1.getIframeAPI().inviteSIP(dialOutUrl);
|
||||
await p1.switchToIFrame();
|
||||
await p1.waitForParticipants(1);
|
||||
await waitForMedia(p1);
|
||||
|
||||
const startedEvent: {
|
||||
customerId: string;
|
||||
data: {
|
||||
participantFullJid: string;
|
||||
participantId: string;
|
||||
participantJid: string;
|
||||
sipAddress: string;
|
||||
};
|
||||
eventType: string;
|
||||
} = await webhooksProxy.waitForEvent('SIP_CALL_OUT_STARTED');
|
||||
|
||||
expect('SIP_CALL_OUT_STARTED').toBe(startedEvent.eventType);
|
||||
expect(startedEvent.data.sipAddress).toBe(`sip:${process.env.SIP_JIBRI_DIAL_OUT_URL}`);
|
||||
expect(startedEvent.customerId).toBe(customerId);
|
||||
|
||||
const endpointId = await p1.execute(() => APP?.conference?.listMembers()[0].getId());
|
||||
|
||||
await p1.getFilmstrip().kickParticipant(endpointId);
|
||||
|
||||
const endedEvent: {
|
||||
customerId: string;
|
||||
data: {
|
||||
direction: string;
|
||||
participantFullJid: string;
|
||||
participantId: string;
|
||||
participantJid: string;
|
||||
};
|
||||
eventType: string;
|
||||
} = await webhooksProxy.waitForEvent('SIP_CALL_OUT_ENDED');
|
||||
|
||||
expect('SIP_CALL_OUT_ENDED').toBe(endedEvent.eventType);
|
||||
expect(endedEvent.customerId).toBe(customerId);
|
||||
expect(endedEvent.data.participantFullJid).toBe(startedEvent.data.participantFullJid);
|
||||
expect(endedEvent.data.participantId).toBe(startedEvent.data.participantId);
|
||||
expect(endedEvent.data.participantJid).toBe(startedEvent.data.participantJid);
|
||||
});
|
||||
});
|
||||
81
tests/specs/jaas/dial/util.ts
Normal file
81
tests/specs/jaas/dial/util.ts
Normal file
@@ -0,0 +1,81 @@
|
||||
import { Participant } from '../../../helpers/Participant';
|
||||
import WebhookProxy from '../../../helpers/WebhookProxy';
|
||||
|
||||
interface IStartedWebhookPayload {
|
||||
direction: string;
|
||||
participantFullJid: string;
|
||||
participantId: string;
|
||||
participantJid: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks the dial events for a participant and clean up at the end.
|
||||
* @param webhooksProxy
|
||||
* @param startedEventName
|
||||
* @param direction
|
||||
* @param customerId
|
||||
*/
|
||||
export async function verifyStartedWebhooks(
|
||||
webhooksProxy: WebhookProxy,
|
||||
direction: 'in' | 'out',
|
||||
startedEventName: string,
|
||||
customerId: string): Promise<IStartedWebhookPayload> {
|
||||
|
||||
const startedEvent: {
|
||||
customerId: string;
|
||||
data: IStartedWebhookPayload;
|
||||
eventType: string;
|
||||
} = await webhooksProxy.waitForEvent(startedEventName);
|
||||
|
||||
expect(startedEventName).toBe(startedEvent.eventType);
|
||||
expect(startedEvent.data.direction).toBe(direction);
|
||||
expect(startedEvent.customerId).toBe(customerId);
|
||||
|
||||
const usageEvent: {
|
||||
customerId: string;
|
||||
data: any;
|
||||
eventType: string;
|
||||
} = await webhooksProxy.waitForEvent('USAGE');
|
||||
|
||||
expect('USAGE').toBe(usageEvent.eventType);
|
||||
expect(usageEvent.customerId).toBe(customerId);
|
||||
|
||||
expect(usageEvent.data.some((el: any) =>
|
||||
el.participantId === startedEvent.data.participantId && el.callDirection === direction)).toBe(true);
|
||||
|
||||
return startedEvent.data;
|
||||
}
|
||||
|
||||
export async function verifyEndedWebhook(
|
||||
webhooksProxy: WebhookProxy,
|
||||
endedEventName: string,
|
||||
customerId: string,
|
||||
startedPayload: IStartedWebhookPayload) {
|
||||
const endedEvent: {
|
||||
customerId: string;
|
||||
data: {
|
||||
direction: string;
|
||||
participantFullJid: string;
|
||||
participantId: string;
|
||||
participantJid: string;
|
||||
};
|
||||
eventType: string;
|
||||
} = await webhooksProxy.waitForEvent(endedEventName);
|
||||
|
||||
expect(endedEventName).toBe(endedEvent.eventType);
|
||||
expect(endedEvent.customerId).toBe(customerId);
|
||||
expect(endedEvent.data.participantFullJid).toBe(startedPayload.participantFullJid);
|
||||
expect(endedEvent.data.participantId).toBe(startedPayload.participantId);
|
||||
expect(endedEvent.data.participantJid).toBe(startedPayload.participantJid);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wait until there is at least one remote participant, ICE is connected, the participant has a stream, and data is
|
||||
* both received and sent.
|
||||
*/
|
||||
export async function waitForMedia(p: Participant) {
|
||||
await p.waitForParticipants(1);
|
||||
await p.waitForIceConnected();
|
||||
await p.waitForRemoteStreams(1);
|
||||
await p.waitForSendReceiveData(20_000);
|
||||
}
|
||||
Reference in New Issue
Block a user