This commit is contained in:
101
tests/specs/jaas/joinMuc.spec.ts
Normal file
101
tests/specs/jaas/joinMuc.spec.ts
Normal file
@@ -0,0 +1,101 @@
|
||||
import { setTestProperties } from '../../helpers/TestProperties';
|
||||
import { TOKEN_AUTH_FAILED_TEST_ID, TOKEN_AUTH_FAILED_TITLE_TEST_ID } from '../../pageobjects/Notifications';
|
||||
import { joinMuc, generateJaasToken as t } from '../helpers/jaas';
|
||||
|
||||
setTestProperties(__filename, {
|
||||
useJaas: true
|
||||
});
|
||||
|
||||
describe('XMPP login and MUC join test', () => {
|
||||
it('with a valid token (wildcard room)', async () => {
|
||||
console.log('Joining a MUC with a valid token (wildcard room)');
|
||||
const p = await joinMuc('p1', t({ room: '*' }));
|
||||
|
||||
expect(await p.isInMuc()).toBe(true);
|
||||
expect(await p.isModerator()).toBe(false);
|
||||
});
|
||||
|
||||
it('with a valid token (specific room)', async () => {
|
||||
console.log('Joining a MUC with a valid token (specific room)');
|
||||
const p = await joinMuc('p1', t({ room: ctx.roomName }));
|
||||
|
||||
expect(await p.isInMuc()).toBe(true);
|
||||
expect(await p.isModerator()).toBe(false);
|
||||
});
|
||||
|
||||
it('with a token with bad signature', async () => {
|
||||
console.log('Joining a MUC with a token with bad signature');
|
||||
const token = t({ room: ctx.roomName });
|
||||
|
||||
token.jwt = token.jwt + 'badSignature';
|
||||
|
||||
const p = await joinMuc('p1', token);
|
||||
|
||||
expect(Boolean(await p.isInMuc())).toBe(false);
|
||||
|
||||
const errorText = await p.getNotifications().getNotificationText(TOKEN_AUTH_FAILED_TEST_ID)
|
||||
|| await p.getNotifications().getNotificationText(TOKEN_AUTH_FAILED_TITLE_TEST_ID);
|
||||
|
||||
expect(errorText).toContain('not allowed to join');
|
||||
});
|
||||
|
||||
it('with an expired token', async () => {
|
||||
console.log('Joining a MUC with an expired token');
|
||||
const p = await joinMuc('p1', t({ exp: '-1m' }));
|
||||
|
||||
expect(Boolean(await p.isInMuc())).toBe(false);
|
||||
|
||||
const errorText = await p.getNotifications().getNotificationText(TOKEN_AUTH_FAILED_TITLE_TEST_ID);
|
||||
|
||||
expect(errorText).toContain('Token is expired');
|
||||
});
|
||||
|
||||
it('with a token using the wrong key ID', async () => {
|
||||
console.log('Joining a MUC with a token using the wrong key ID');
|
||||
const p = await joinMuc('p1', t({ keyId: 'invalid-key-id' }));
|
||||
|
||||
expect(Boolean(await p.isInMuc())).toBe(false);
|
||||
|
||||
const errorText = await p.getNotifications().getNotificationText(TOKEN_AUTH_FAILED_TEST_ID);
|
||||
|
||||
expect(errorText).toContain('not allowed to join');
|
||||
});
|
||||
|
||||
it('with a token for a different room', async () => {
|
||||
console.log('Joining a MUC with a token for a different room');
|
||||
const p = await joinMuc('p1', t({ room: ctx.roomName + 'different' }));
|
||||
|
||||
expect(Boolean(await p.isInMuc())).toBe(false);
|
||||
|
||||
const errorText = await p.getNotifications().getNotificationText(TOKEN_AUTH_FAILED_TEST_ID);
|
||||
|
||||
expect(errorText).toContain('not allowed to join');
|
||||
});
|
||||
|
||||
it('with a moderator token', async () => {
|
||||
console.log('Joining a MUC with a moderator token');
|
||||
const p = await joinMuc('p1', t({ moderator: true }));
|
||||
|
||||
expect(await p.isInMuc()).toBe(true);
|
||||
expect(await p.isModerator()).toBe(true);
|
||||
});
|
||||
|
||||
// This is dependent on jaas account configuration. All tests under jaas/ expect that "unauthenticated access" is
|
||||
// disabled.
|
||||
it('without a token', async () => {
|
||||
console.log('Joining a MUC without a token');
|
||||
const p = await joinMuc('p1');
|
||||
|
||||
expect(Boolean(await p.isInMuc())).toBe(false);
|
||||
|
||||
const errorText = await p.getNotifications().getNotificationText(TOKEN_AUTH_FAILED_TEST_ID);
|
||||
|
||||
expect(errorText).toContain('not allowed to join');
|
||||
});
|
||||
|
||||
// it('without sending a conference-request', async () => {
|
||||
// console.log('Joining a MUC without sending a conference-request');
|
||||
// // TODO verify failure
|
||||
// //expect(await joinMuc(ctx.roomName, 'p1', token)).toBe(true);
|
||||
// });
|
||||
});
|
||||
31
tests/specs/jaas/maxOccupants.spec.ts
Normal file
31
tests/specs/jaas/maxOccupants.spec.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { setTestProperties } from '../../helpers/TestProperties';
|
||||
import { joinMuc, generateJaasToken as t } from '../helpers/jaas';
|
||||
|
||||
setTestProperties(__filename, {
|
||||
useJaas: true,
|
||||
useWebhookProxy: true,
|
||||
usesBrowsers: [ 'p1', 'p2', 'p3' ]
|
||||
});
|
||||
|
||||
describe('MaxOccupants limit enforcement', () => {
|
||||
it('test maxOccupants limit', async () => {
|
||||
ctx.webhooksProxy.defaultMeetingSettings = {
|
||||
maxOccupants: 2
|
||||
};
|
||||
|
||||
const p1 = await joinMuc('p1', t({ room: ctx.roomName }));
|
||||
const p2 = await joinMuc('p2', t({ room: ctx.roomName }));
|
||||
|
||||
expect(await p1.isInMuc()).toBe(true);
|
||||
expect(await p2.isInMuc()).toBe(true);
|
||||
|
||||
// Third participant should be rejected (exceeding maxOccupants), even if it's a moderator
|
||||
let p3 = await joinMuc('p3', t({ room: ctx.roomName, moderator: true }));
|
||||
|
||||
expect(Boolean(await p3.isInMuc())).toBe(false);
|
||||
|
||||
await p1.hangup();
|
||||
p3 = await joinMuc('p3', t({ room: ctx.roomName }));
|
||||
expect(await p3.isInMuc()).toBe(true);
|
||||
});
|
||||
});
|
||||
51
tests/specs/jaas/passcode.spec.ts
Normal file
51
tests/specs/jaas/passcode.spec.ts
Normal file
@@ -0,0 +1,51 @@
|
||||
import { setTestProperties } from '../../helpers/TestProperties';
|
||||
import { IToken } from '../../helpers/token';
|
||||
import { joinMuc, generateJaasToken as t } from '../helpers/jaas';
|
||||
|
||||
setTestProperties(__filename, {
|
||||
useJaas: true,
|
||||
useWebhookProxy: true,
|
||||
usesBrowsers: [ 'p1', 'p2' ]
|
||||
});
|
||||
|
||||
const passcode = '1234';
|
||||
|
||||
describe('Setting passcode through settings provisioning', () => {
|
||||
it('With a valid passcode', async () => {
|
||||
ctx.webhooksProxy.defaultMeetingSettings = {
|
||||
passcode: passcode,
|
||||
visitorsEnabled: true
|
||||
};
|
||||
|
||||
// We want to keep the room from getting destroyed, because the visitors queue has a timeout and causes
|
||||
// problems. We could use different rooms instead, but the webhooksProxy is only configured for the default room.
|
||||
await joinWithPassword('p1', t({ room: ctx.roomName }));
|
||||
await joinWithPassword('p2', t({ room: ctx.roomName, moderator: true }));
|
||||
await joinWithPassword('p2', t({ room: ctx.roomName, visitor: true }));
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Join a password-protected room. Assert that a password is required, that a wrong password does not work, and that
|
||||
* the correct password does work.
|
||||
*/
|
||||
async function joinWithPassword(instanceId: string, token: IToken) {
|
||||
// @ts-ignore
|
||||
const p = await joinMuc(instanceId, token, ctx.roomName);
|
||||
|
||||
await p.waitForMucJoinedOrError();
|
||||
expect(await p.isInMuc()).toBe(false);
|
||||
expect(await p.getPasswordDialog().isOpen()).toBe(true);
|
||||
|
||||
await p.getPasswordDialog().submitPassword('wrong password');
|
||||
await p.waitForMucJoinedOrError();
|
||||
expect(await p.isInMuc()).toBe(false);
|
||||
expect(await p.getPasswordDialog().isOpen()).toBe(true);
|
||||
|
||||
await p.getPasswordDialog().submitPassword(passcode);
|
||||
await p.waitToJoinMUC();
|
||||
|
||||
expect(await p.isInMuc()).toBe(true);
|
||||
expect(await p.getPasswordDialog().isOpen()).toBe(false);
|
||||
}
|
||||
|
||||
25
tests/specs/jaas/passcodeInvalid.spec.ts
Normal file
25
tests/specs/jaas/passcodeInvalid.spec.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { setTestProperties } from '../../helpers/TestProperties';
|
||||
import { joinMuc, generateJaasToken as t } from '../helpers/jaas';
|
||||
|
||||
setTestProperties(__filename, {
|
||||
useJaas: true,
|
||||
useWebhookProxy: true
|
||||
});
|
||||
|
||||
// This test is separate from passcode.spec.ts, because it needs to use a different room name, and webhooksProxy is only
|
||||
// setup for the default room name.
|
||||
describe('Setting passcode through settings provisioning', () => {
|
||||
it('With an invalid passcode', async () => {
|
||||
ctx.webhooksProxy.defaultMeetingSettings = {
|
||||
passcode: 'passcode-must-be-digits-only'
|
||||
};
|
||||
|
||||
const p = await joinMuc('p1', t({ room: ctx.roomName }), ctx.roomName);
|
||||
|
||||
// The settings provisioning contains an invalid passcode, the expected result is that the room is not
|
||||
// configured to require a passcode.
|
||||
await p.waitToJoinMUC();
|
||||
expect(await p.isInMuc()).toBe(true);
|
||||
expect(await p.getPasswordDialog().isOpen()).toBe(false);
|
||||
});
|
||||
});
|
||||
50
tests/specs/jaas/visitors/participantsSoftLimit.spec.ts
Normal file
50
tests/specs/jaas/visitors/participantsSoftLimit.spec.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
import { setTestProperties } from '../../../helpers/TestProperties';
|
||||
import { joinMuc, generateJaasToken as t } from '../../helpers/jaas';
|
||||
|
||||
setTestProperties(__filename, {
|
||||
useJaas: true,
|
||||
useWebhookProxy: true,
|
||||
usesBrowsers: [ 'p1', 'p2', 'p3' ]
|
||||
});
|
||||
|
||||
describe('Visitors triggered by reaching participantsSoftLimit', () => {
|
||||
it('test participantsSoftLimit', async () => {
|
||||
ctx.webhooksProxy.defaultMeetingSettings = {
|
||||
participantsSoftLimit: 2,
|
||||
visitorsEnabled: true
|
||||
};
|
||||
|
||||
/// XXX the "name" of the participant MUST match one of the "capabilities" defined in wdio. It's not a "participant", it's an instance configuration!
|
||||
const m = await joinMuc(
|
||||
'p1',
|
||||
t({ room: ctx.roomName, displayName: 'Mo de Rator', moderator: true })
|
||||
);
|
||||
|
||||
expect(await m.isInMuc()).toBe(true);
|
||||
expect(await m.isModerator()).toBe(true);
|
||||
expect(await m.isVisitor()).toBe(false);
|
||||
console.log('Moderator joined');
|
||||
|
||||
// Joining with a participant token before participantSoftLimit has been reached
|
||||
const p = await joinMuc(
|
||||
'p2',
|
||||
t({ room: ctx.roomName, displayName: 'Parti Cipant' })
|
||||
);
|
||||
|
||||
expect(await p.isInMuc()).toBe(true);
|
||||
expect(await p.isModerator()).toBe(false);
|
||||
expect(await p.isVisitor()).toBe(false);
|
||||
console.log('Participant joined');
|
||||
|
||||
// Joining with a participant token after participantSoftLimit has been reached
|
||||
const v = await joinMuc(
|
||||
'p3',
|
||||
t({ room: ctx.roomName, displayName: 'Visi Tor' })
|
||||
);
|
||||
|
||||
expect(await v.isInMuc()).toBe(true);
|
||||
expect(await v.isModerator()).toBe(false);
|
||||
expect(await v.isVisitor()).toBe(true);
|
||||
console.log('Visitor joined');
|
||||
});
|
||||
});
|
||||
61
tests/specs/jaas/visitors/videoWithSingleSender.spec.ts
Normal file
61
tests/specs/jaas/visitors/videoWithSingleSender.spec.ts
Normal file
@@ -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');
|
||||
});
|
||||
});
|
||||
58
tests/specs/jaas/visitors/visitorTokens.spec.ts
Normal file
58
tests/specs/jaas/visitors/visitorTokens.spec.ts
Normal file
@@ -0,0 +1,58 @@
|
||||
import { setTestProperties } from '../../../helpers/TestProperties';
|
||||
import { joinMuc, generateJaasToken as t } from '../../helpers/jaas';
|
||||
|
||||
setTestProperties(__filename, {
|
||||
useJaas: true,
|
||||
useWebhookProxy: true,
|
||||
usesBrowsers: [ 'p1', 'p2', 'p3' ]
|
||||
});
|
||||
|
||||
describe('Visitors triggered by visitor tokens', () => {
|
||||
it('test visitor tokens', async () => {
|
||||
ctx.webhooksProxy.defaultMeetingSettings = {
|
||||
visitorsEnabled: true
|
||||
};
|
||||
|
||||
const m = await joinMuc(
|
||||
'p1',
|
||||
t({ room: ctx.roomName, displayName: 'Mo de Rator', moderator: true })
|
||||
);
|
||||
|
||||
expect(await m.isInMuc()).toBe(true);
|
||||
expect(await m.isModerator()).toBe(true);
|
||||
expect(await m.isVisitor()).toBe(false);
|
||||
console.log('Moderator joined');
|
||||
|
||||
// Joining with a participant token before any visitors
|
||||
const p = await joinMuc(
|
||||
'p2',
|
||||
t({ room: ctx.roomName, displayName: 'Parti Cipant' })
|
||||
);
|
||||
|
||||
expect(await p.isInMuc()).toBe(true);
|
||||
expect(await p.isModerator()).toBe(false);
|
||||
expect(await p.isVisitor()).toBe(false);
|
||||
console.log('Participant joined');
|
||||
|
||||
// Joining with a visitor token
|
||||
const v = await joinMuc(
|
||||
'p3',
|
||||
t({ room: ctx.roomName, displayName: 'Visi Tor', visitor: true })
|
||||
);
|
||||
|
||||
expect(await v.isInMuc()).toBe(true);
|
||||
expect(await v.isModerator()).toBe(false);
|
||||
expect(await v.isVisitor()).toBe(true);
|
||||
console.log('Visitor joined');
|
||||
|
||||
// Joining with a participant token after visitors...:mindblown:
|
||||
const v2 = await joinMuc(
|
||||
'p2',
|
||||
t({ room: ctx.roomName, displayName: 'Visi Tor 2' }));
|
||||
|
||||
expect(await v2.isInMuc()).toBe(true);
|
||||
expect(await v2.isModerator()).toBe(false);
|
||||
expect(await v2.isVisitor()).toBe(true);
|
||||
console.log('Visitor2 joined');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user