Compare commits

..

1 Commits

Author SHA1 Message Date
damencho
5ff3219935 debug: Drop. 2025-10-02 14:40:39 -05:00
19 changed files with 261 additions and 444 deletions

View File

@@ -48,7 +48,6 @@ local NOTIFY_LOBBY_ACCESS_DENIED = 'LOBBY-ACCESS-DENIED';
local util = module:require "util";
local ends_with = util.ends_with;
local get_room_by_name_and_subdomain = util.get_room_by_name_and_subdomain;
local get_room_from_jid = util.get_room_from_jid;
local is_healthcheck_room = util.is_healthcheck_room;
local presence_check_status = util.presence_check_status;
local process_host_module = util.process_host_module;
@@ -106,7 +105,7 @@ end
-- Sends a json message notifying that the jid was granted/denied access in lobby
-- the message from is the actor that did the operation
function notify_lobby_access(room_jid, actor, jid, display_name, granted)
function notify_lobby_access(room, actor, jid, display_name, granted)
local notify_json = {
value = jid,
name = display_name
@@ -117,12 +116,6 @@ function notify_lobby_access(room_jid, actor, jid, display_name, granted)
notify_json.event = NOTIFY_LOBBY_ACCESS_DENIED;
end
local room = get_room_from_jid(room_jid);
if not room then
module:log('error', 'Room not found for %s', room_jid)
return;
end
broadcast_json_msg(room, actor, notify_json);
end
@@ -234,7 +227,7 @@ function attach_lobby_room(room, actor)
-- avoid lobby destroy while it is enabled
new_room:set_persistent(true);
module:log("info","Lobby room jid = %s created from:%s", lobby_room_jid, actor);
new_room.main_room_jid = room.jid;
new_room.main_room = room;
room._data.lobbyroom = new_room.jid;
room:save(true);
return true
@@ -252,8 +245,6 @@ function destroy_lobby_room(room, newjid, message)
if lobby_room_obj then
lobby_room_obj:set_persistent(false);
lobby_room_obj:destroy(newjid, message);
module:log('info', 'Lobby room destroyed %s', lobby_room_obj.jid)
end
room._data.lobbyroom = nil;
room._data.lobby_extra_reason = nil;
@@ -421,18 +412,13 @@ function process_lobby_muc_loaded(lobby_muc, host_module)
local room_mt = lobby_muc_service.room_mt;
-- we base affiliations (roles) in lobby muc component to be based on the roles in the main muc
room_mt.get_affiliation = function(room, jid)
if not room.main_room_jid then
if not room.main_room then
module:log('error', 'No main room(%s) for %s!', room.jid, jid);
return 'none';
end
-- moderators in main room are moderators here
local main_room = get_room_from_jid(room.main_room_jid);
if not main_room then
module:log('error', 'Main room not found for %s!', room.main_room_jid);
return 'none';
end
local role = main_room.get_affiliation(main_room, jid);
local role = room.main_room.get_affiliation(room.main_room, jid);
if role then
return role;
end
@@ -447,7 +433,7 @@ function process_lobby_muc_loaded(lobby_muc, host_module)
local display_name = occupant:get_presence():get_child_text(
'nick', 'http://jabber.org/protocol/nick');
-- we need to notify in the main room
notify_lobby_access(room.main_room_jid, actor, occupant.nick, display_name, false);
notify_lobby_access(room.main_room, actor, occupant.nick, display_name, false);
end
end);
end
@@ -603,7 +589,7 @@ process_host_module(main_muc_component_config, function(host_module, host)
local display_name = occupant:get_presence():get_child_text(
'nick', 'http://jabber.org/protocol/nick');
notify_lobby_access(room.jid, from, occupant.nick, display_name, true);
notify_lobby_access(room, from, occupant.nick, display_name, true);
end
end
end

View File

@@ -108,13 +108,7 @@ module:hook("muc-occupant-pre-join", function (event)
if not room.join_rate_queue_timer then
timer.add_task(1, function ()
if room.destroying then
-- if room was destroyed in the mean time, ignore
return;
end
local status, result = pcall(
timer_process_queue_elements,
local status, result = pcall(timer_process_queue_elements,
join_rate_per_conference,
room.join_rate_presence_queue,
function(ev)

View File

@@ -4,7 +4,18 @@
export const config = {
/** Enable debug logging. Note this includes private information from .env */
debug: Boolean(process.env.JITSI_DEBUG?.trim()),
expectationsFile: process.env.EXPECTATIONS?.trim(),
/** Whether to expect the environment to automatically elect a new moderator when the existing moderator leaves. */
autoModerator: (() => {
if (typeof process.env.AUTO_MODERATOR !== 'undefined') {
return process.env.AUTO_MODERATOR?.trim() === 'true';
}
// If not explicitly configured, fallback to recognizing whether we're running against one of the JaaS
// environments which are known to have the setting disabled.
return !Boolean(
process.env.JWT_PRIVATE_KEY_PATH && process.env.JWT_KID?.startsWith('vpaas-magic-cookie-')
);
})(),
jaas: {
customerId: (() => {
if (typeof process.env.JAAS_TENANT !== 'undefined') {

View File

@@ -1,50 +0,0 @@
import fs from 'fs';
import { merge } from 'lodash-es';
import { config } from './TestsConfig';
const defaultExpectations = {
dialIn: {
/*
* The dial-in functionality is enabled.
* true -> assert the config is enabled, the UI elements are displayed, and the feature works.
* false -> assert the config is disabled and the UI elements are not displayed.
* null -> if the config is enabled, assert the UI elements are displayed and the feature works.
*/
enabled: null,
},
jaas: {
/**
* Whether the jaas account is configured with the account-level setting to allow unauthenticated users to join.
*/
unauthenticatedJoins: false
},
moderation: {
// Everyone is a moderator.
allModerators: false,
// When a moderator leaves, another one is elected.
autoModerator: true,
// The first to join is a moderator.
firstModerator: true,
// The grantOwner function is available.
grantModerator: true
}
};
let overrides: any = {};
if (config.expectationsFile) {
try {
const str = fs.readFileSync(config.expectationsFile, 'utf8');
// Remove comments and multiline comments.
overrides = JSON.parse(str.replace(/\/\/.*|\/\*[\s\S]*?\*\//g, ''));
} catch (e) {
console.error('Error reading expectations file', e);
}
console.log('Loaded expectations from', config.expectationsFile);
}
export const expectations = merge(defaultExpectations, overrides);
console.log('Expectations:', expectations);

View File

@@ -1,6 +1,5 @@
import process from 'node:process';
import { expectations } from '../../helpers/expectations';
import { ensureOneParticipant, ensureTwoParticipants } from '../../helpers/participants';
import { cleanup, isDialInEnabled, waitForAudioFromDialInParticipant } from '../helpers/DialIn';
@@ -17,15 +16,8 @@ describe('Fake Dial-In', () => {
await ensureOneParticipant();
const configEnabled = await isDialInEnabled(ctx.p1);
if (expectations.dialIn.enabled !== null) {
expect(configEnabled).toBe(expectations.dialIn.enabled);
}
// check dial-in is enabled, so skip
if (configEnabled) {
console.log('Dial in config is enabled, skipping fake dial in');
if (await isDialInEnabled(ctx.p1)) {
ctx.skipSuiteTests = true;
}
});

View File

@@ -0,0 +1,42 @@
import { ensureOneParticipant, ensureTwoParticipants } from '../../helpers/participants';
describe('Grant moderator', () => {
it('joining the meeting', async () => {
await ensureOneParticipant();
if (await ctx.p1.execute(() => typeof APP.conference._room.grantOwner !== 'function')) {
ctx.skipSuiteTests = true;
return;
}
await ensureTwoParticipants();
});
it('grant moderator and validate', async () => {
const { p1, p2 } = ctx;
if (!await p1.isModerator()) {
ctx.skipSuiteTests = true;
return;
}
if (await p2.isModerator()) {
ctx.skipSuiteTests = true;
return;
}
await p1.getFilmstrip().grantModerator(p2);
await p2.driver.waitUntil(
() => p2.isModerator(),
{
timeout: 3000,
timeoutMsg: 'p2 did not become moderator'
}
);
});
});

View File

@@ -0,0 +1,44 @@
import { ensureTwoParticipants } from '../../helpers/participants';
describe('Kick', () => {
it('joining the meeting', async () => {
await ensureTwoParticipants();
if (!await ctx.p1.isModerator()) {
ctx.skipSuiteTests = true;
}
});
it('kick and check', () => kickParticipant2AndCheck());
it('kick p2p and check', async () => {
await ensureTwoParticipants({
configOverwrite: {
p2p: {
enabled: true
}
}
});
await kickParticipant2AndCheck();
});
});
/**
* Kicks the second participant and checks that the participant is removed from the conference and that dialog is open.
*/
async function kickParticipant2AndCheck() {
const { p1, p2 } = ctx;
await p1.getFilmstrip().kickParticipant(await p2.getEndpointId());
await p1.waitForParticipants(0);
// check that the kicked participant sees the kick reason dialog
// let's wait for this to appear at least 2 seconds
await p2.driver.waitUntil(
async () => p2.isLeaveReasonDialogOpen(), {
timeout: 2000,
timeoutMsg: 'No leave reason dialog shown for p2'
});
}

View File

@@ -1,5 +1,5 @@
import { Participant } from '../../helpers/Participant';
import { expectations } from '../../helpers/expectations';
import { config } from '../../helpers/TestsConfig';
import {
ensureOneParticipant,
ensureThreeParticipants, ensureTwoParticipants,
@@ -79,7 +79,7 @@ describe('AVModeration', () => {
it('hangup and change moderator', async () => {
// The test below is only correct when the environment is configured to automatically elect a new moderator
// when the moderator leaves. For environments where this is not the case, the test is skipped.
if (!expectations.autoModerator) {
if (!config.autoModerator) {
return;
}

View File

@@ -1,5 +1,5 @@
import { P1, P3, Participant } from '../../helpers/Participant';
import { expectations } from '../../helpers/expectations';
import { config } from '../../helpers/TestsConfig';
import {
ensureOneParticipant,
ensureThreeParticipants,
@@ -198,7 +198,7 @@ describe('Lobby', () => {
it('change of moderators in lobby', async () => {
// The test below is only correct when the environment is configured to automatically elect a new moderator
// when the moderator leaves. For environments where this is not the case, the test is skipped.
if (!expectations.autoModerator) {
if (!config.autoModerator) {
return;
}
await hangupAllParticipants();
@@ -291,7 +291,7 @@ describe('Lobby', () => {
it('moderator leaves while lobby enabled', async () => {
// The test below is only correct when the environment is configured to automatically elect a new moderator
// when the moderator leaves. For environments where this is not the case, the test is skipped.
if (!expectations.autoModerator) {
if (!config.autoModerator) {
return;
}
const { p1, p2, p3 } = ctx;

View File

@@ -1,12 +1,10 @@
import {
checkForScreensharingTile,
ensureOneParticipant,
ensureTwoParticipants,
hangupAllParticipants,
joinSecondParticipant,
joinThirdParticipant
} from '../../helpers/participants';
import { unmuteVideoAndCheck } from '../helpers/mute';
describe('StartMuted', () => {
it('checkboxes test', async () => {
@@ -139,142 +137,139 @@ describe('StartMuted', () => {
await p3.getParticipantsPane().assertVideoMuteIconIsDisplayed(p2, true);
// Unmute and see if the audio works
// we need 1 and 2 to be muted so we have a dominant speaker event for correct audio levels calculations
await p1.getToolbar().clickAudioMuteButton();
await p2.getToolbar().clickAudioMuteButton();
await p3.getToolbar().clickAudioUnmuteButton();
p1.log('configOptionsTest, unmuted third participant');
await p1.waitForAudioMuted(p3, false /* unmuted */);
});
it('startWithVideoMuted=true can unmute', async () => {
// Maybe disable if there is FF or Safari participant.
await hangupAllParticipants();
// Explicitly enable P2P due to a regression with unmute not updating
// large video while in P2P.
const options = {
configOverwrite: {
p2p: {
enabled: true
},
startWithVideoMuted: true
}
};
await ensureTwoParticipants(options);
const { p1, p2 } = ctx;
await p1.getParticipantsPane().assertVideoMuteIconIsDisplayed(p2);
await p2.getParticipantsPane().assertVideoMuteIconIsDisplayed(p1);
await Promise.all([
p1.getLargeVideo().waitForSwitchTo(await p2.getEndpointId()),
p2.getLargeVideo().waitForSwitchTo(await p1.getEndpointId())
]);
await unmuteVideoAndCheck(p2, p1);
await p1.getLargeVideo().assertPlaying();
});
it('startWithAudioMuted=true can unmute', async () => {
await hangupAllParticipants();
const options = {
configOverwrite: {
startWithAudioMuted: true,
testing: {
testMode: true,
debugAudioLevels: true
}
}
};
await ensureTwoParticipants(options);
const { p1, p2 } = ctx;
await Promise.all([ p1.waitForAudioMuted(p2, true), p2.waitForAudioMuted(p1, true) ]);
await p1.getToolbar().clickAudioUnmuteButton();
await Promise.all([ p1.waitForAudioMuted(p2, true), p2.waitForAudioMuted(p1, false) ]);
});
it('startWithAudioVideoMuted=true can unmute', async () => {
await hangupAllParticipants();
const options = {
configOverwrite: {
startWithAudioMuted: true,
startWithVideoMuted: true,
p2p: {
enabled: true
}
}
};
await ensureOneParticipant(options);
await joinSecondParticipant({
configOverwrite: {
testing: {
testMode: true,
debugAudioLevels: true
},
p2p: {
enabled: true
}
}
});
const { p1, p2 } = ctx;
await p2.waitForIceConnected();
await p2.waitForSendMedia();
await p2.waitForAudioMuted(p1, true);
await p2.getParticipantsPane().assertVideoMuteIconIsDisplayed(p1);
// Unmute p1's both audio and video and check on p2.
await p1.getToolbar().clickAudioUnmuteButton();
await p2.waitForAudioMuted(p1, false);
await unmuteVideoAndCheck(p1, p2);
await p2.getLargeVideo().assertPlaying();
});
it('test p2p JVB switch and switch back', async () => {
const { p1, p2 } = ctx;
// Mute p2's video just before p3 joins.
await p2.getToolbar().clickVideoMuteButton();
await joinThirdParticipant({
configOverwrite: {
p2p: {
enabled: true
}
}
});
const { p3 } = ctx;
// Unmute p2 and check if its video is being received by p1 and p3.
await unmuteVideoAndCheck(p2, p3);
await p1.getParticipantsPane().assertVideoMuteIconIsDisplayed(p2, true);
// Mute p2's video just before p3 leaves.
await p2.getToolbar().clickVideoMuteButton();
await p3.hangup();
await p1.getParticipantsPane().assertVideoMuteIconIsDisplayed(p2);
await p2.getToolbar().clickVideoUnmuteButton();
// Check if p2's video is playing on p1.
await p1.getParticipantsPane().assertVideoMuteIconIsDisplayed(p2, true);
await p1.getLargeVideo().assertPlaying();
});
// it('startWithVideoMuted=true can unmute', async () => {
// // Maybe disable if there is FF or Safari participant.
//
// await hangupAllParticipants();
//
// // Explicitly enable P2P due to a regression with unmute not updating
// // large video while in P2P.
// const options = {
// configOverwrite: {
// p2p: {
// enabled: true
// },
// startWithVideoMuted: true
// }
// };
//
// await ensureTwoParticipants(options);
//
// const { p1, p2 } = ctx;
//
// await p1.getParticipantsPane().assertVideoMuteIconIsDisplayed(p2);
// await p2.getParticipantsPane().assertVideoMuteIconIsDisplayed(p1);
//
// await Promise.all([
// p1.getLargeVideo().waitForSwitchTo(await p2.getEndpointId()),
// p2.getLargeVideo().waitForSwitchTo(await p1.getEndpointId())
// ]);
//
// await unmuteVideoAndCheck(p2, p1);
// await p1.getLargeVideo().assertPlaying();
// });
//
// it('startWithAudioMuted=true can unmute', async () => {
// await hangupAllParticipants();
//
// const options = {
// configOverwrite: {
// startWithAudioMuted: true,
// testing: {
// testMode: true,
// debugAudioLevels: true
// }
// }
// };
//
// await ensureTwoParticipants(options);
//
// const { p1, p2 } = ctx;
//
// await Promise.all([ p1.waitForAudioMuted(p2, true), p2.waitForAudioMuted(p1, true) ]);
// await p1.getToolbar().clickAudioUnmuteButton();
// await Promise.all([ p1.waitForAudioMuted(p2, true), p2.waitForAudioMuted(p1, false) ]);
// });
//
// it('startWithAudioVideoMuted=true can unmute', async () => {
// await hangupAllParticipants();
//
// const options = {
// configOverwrite: {
// startWithAudioMuted: true,
// startWithVideoMuted: true,
// p2p: {
// enabled: true
// }
// }
// };
//
// await ensureOneParticipant(options);
// await joinSecondParticipant({
// configOverwrite: {
// testing: {
// testMode: true,
// debugAudioLevels: true
// },
// p2p: {
// enabled: true
// }
// }
// });
//
// const { p1, p2 } = ctx;
//
// await p2.waitForIceConnected();
// await p2.waitForSendMedia();
//
// await p2.waitForAudioMuted(p1, true);
// await p2.getParticipantsPane().assertVideoMuteIconIsDisplayed(p1);
//
// // Unmute p1's both audio and video and check on p2.
// await p1.getToolbar().clickAudioUnmuteButton();
// await p2.waitForAudioMuted(p1, false);
//
// await unmuteVideoAndCheck(p1, p2);
// await p2.getLargeVideo().assertPlaying();
// });
//
//
// it('test p2p JVB switch and switch back', async () => {
// const { p1, p2 } = ctx;
//
// // Mute p2's video just before p3 joins.
// await p2.getToolbar().clickVideoMuteButton();
//
// await joinThirdParticipant({
// configOverwrite: {
// p2p: {
// enabled: true
// }
// }
// });
//
// const { p3 } = ctx;
//
// // Unmute p2 and check if its video is being received by p1 and p3.
// await unmuteVideoAndCheck(p2, p3);
// await p1.getParticipantsPane().assertVideoMuteIconIsDisplayed(p2, true);
//
// // Mute p2's video just before p3 leaves.
// await p2.getToolbar().clickVideoMuteButton();
//
// await p3.hangup();
//
// await p1.getParticipantsPane().assertVideoMuteIconIsDisplayed(p2);
//
// await p2.getToolbar().clickVideoUnmuteButton();
//
// // Check if p2's video is playing on p1.
// await p1.getParticipantsPane().assertVideoMuteIconIsDisplayed(p2, true);
// await p1.getLargeVideo().assertPlaying();
// });
});

View File

@@ -1,7 +1,6 @@
import process from 'node:process';
import { config as testsConfig } from '../../helpers/TestsConfig';
import { expectations } from '../../helpers/expectations';
import { ensureOneParticipant } from '../../helpers/participants';
import { cleanup, dialIn, isDialInEnabled, waitForAudioFromDialInParticipant } from '../helpers/DialIn';
@@ -26,14 +25,7 @@ describe('Dial-In', () => {
expect(await ctx.p1.isInMuc()).toBe(true);
const configEnabled = await isDialInEnabled(ctx.p1);
if (expectations.dialIn.enabled !== null) {
expect(configEnabled).toBe(expectations.dialIn.enabled);
}
if (!configEnabled) {
console.log('Dial in config is disabled, skipping dial-in tests');
if (!await isDialInEnabled(ctx.p1)) {
ctx.skipSuiteTests = true;
}
});

View File

@@ -1,11 +1,11 @@
import { Participant } from '../../helpers/Participant';
import { config as testsConfig } from '../../helpers/TestsConfig';
import { expectations } from '../../helpers/expectations';
import { ensureOneParticipant } from '../../helpers/participants';
import { assertDialInDisplayed, assertUrlDisplayed, isDialInEnabled, verifyMoreNumbersPage } from '../helpers/DialIn';
describe('Invite', () => {
let p1: Participant;
let dialInEnabled: boolean;
it('setup', async () => {
// This is a temporary hack to avoid failing when running against a jaas env. The same cases are covered in
@@ -19,30 +19,23 @@ describe('Invite', () => {
await ensureOneParticipant();
p1 = ctx.p1;
dialInEnabled = await isDialInEnabled(p1);
});
// The URL should always be displayed.
it('url displayed', () => assertUrlDisplayed(p1));
it('config values', async () => {
const dialInEnabled = await isDialInEnabled(p1);
if (expectations.dialIn.enabled !== null) {
expect(dialInEnabled).toBe(expectations.dialIn.enabled);
}
});
it('dial-in displayed', async () => {
if (expectations.dialIn.enabled !== null) {
await assertDialInDisplayed(p1, expectations.dialIn.enabled);
if (!dialInEnabled) {
return;
}
await assertDialInDisplayed(p1);
});
it('view more numbers page', async () => {
if (expectations.dialIn.enabled === true) {
// TODO: assert the page is NOT shown when the expectation is false.
await verifyMoreNumbersPage(p1);
if (!dialInEnabled) {
return;
}
await verifyMoreNumbersPage(p1);
});
});

View File

@@ -95,14 +95,14 @@ export async function assertUrlDisplayed(p: Participant) {
await inviteDialog.waitTillOpen(true);
}
export async function assertDialInDisplayed(p: Participant, displayed: boolean = false) {
export async function assertDialInDisplayed(p: Participant) {
const inviteDialog = p.getInviteDialog();
await inviteDialog.open();
await inviteDialog.waitTillOpen();
expect((await inviteDialog.getDialInNumber()).length > 0).toBe(displayed);
expect((await inviteDialog.getPinNumber()).length > 0).toBe(displayed);
expect((await inviteDialog.getDialInNumber()).length > 0).toBe(true);
expect((await inviteDialog.getPinNumber()).length > 0).toBe(true);
}
export async function verifyMoreNumbersPage(p: Participant) {

View File

@@ -2,7 +2,6 @@ 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,
@@ -35,21 +34,14 @@ describe('Dial-in', () => {
webhooksProxy = ctx.webhooksProxy;
expect(await p1.isInMuc()).toBe(true);
if (expectations.dialIn.enabled !== null) {
expect(await isDialInEnabled(p1)).toBe(expectations.dialIn.enabled);
}
expect(await isDialInEnabled(p1)).toBe(true);
expect(customerId).toBeDefined();
});
it ('Invite UI', async () => {
await assertUrlDisplayed(p1);
if (expectations.dialIn.enabled !== null) {
await assertDialInDisplayed(p1, expectations.dialIn.enabled);
}
if (expectations.dialIn.enabled === true) {
// TODO: assert the page is NOT shown when the expectation is false.
await verifyMoreNumbersPage(p1);
}
await assertDialInDisplayed(p1);
await verifyMoreNumbersPage(p1);
});
it('dial-in', async () => {

View File

@@ -1,5 +1,4 @@
import { setTestProperties } from '../../helpers/TestProperties';
import { expectations } from '../../helpers/expectations';
import { joinJaasMuc, generateJaasToken as t } from '../../helpers/jaas';
import { TOKEN_AUTH_FAILED_TEST_ID, TOKEN_AUTH_FAILED_TITLE_TEST_ID } from '../../pageobjects/Notifications';
@@ -87,15 +86,11 @@ describe('XMPP login and MUC join test', () => {
console.log('Joining a MUC without a token');
const p = await joinJaasMuc();
if (expectations.jaas.unauthenticatedJoins) {
expect(Boolean(await p.isInMuc())).toBe(true);
} else {
expect(Boolean(await p.isInMuc())).toBe(false);
expect(Boolean(await p.isInMuc())).toBe(false);
const errorText = await p.getNotifications().getNotificationText(TOKEN_AUTH_FAILED_TEST_ID);
const errorText = await p.getNotifications().getNotificationText(TOKEN_AUTH_FAILED_TEST_ID);
expect(errorText).toContain('not allowed to join');
}
expect(errorText).toContain('not allowed to join');
});
// it('without sending a conference-request', async () => {

View File

@@ -1,55 +0,0 @@
import { Participant } from '../../helpers/Participant';
import { setTestProperties } from '../../helpers/TestProperties';
import { expectations } from '../../helpers/expectations';
import { ensureOneParticipant, ensureTwoParticipants } from '../../helpers/participants';
setTestProperties(__filename, {
usesBrowsers: [ 'p1', 'p2' ]
});
describe('Grant moderator', () => {
let p1: Participant, p2: Participant;
it('setup', async () => {
if (expectations.moderation.allModerators) {
ctx.skipSuiteTests = true;
console.log('Skipping because allModerators is expected.');
return;
}
await ensureOneParticipant();
p1 = ctx.p1;
expect(await p1.isModerator()).toBe(true);
const functionAvailable = await p1.execute(() => typeof APP.conference._room.grantOwner === 'function');
if (expectations.moderation.grantModerator) {
expect(functionAvailable).toBe(true);
} else {
if (!functionAvailable) {
ctx.skipSuiteTests = true;
console.log('Skipping because the grant moderator function is not available and not expected.');
return;
}
}
await ensureTwoParticipants();
p2 = ctx.p2;
expect(await p2.isModerator()).toBe(false);
});
it('grant moderator', async () => {
await p1.getFilmstrip().grantModerator(p2);
await p2.driver.waitUntil(
() => p2.isModerator(),
{
timeout: 3000,
timeoutMsg: 'p2 did not become moderator'
}
);
});
});

View File

@@ -1,75 +0,0 @@
import { Participant } from '../../helpers/Participant';
import { setTestProperties } from '../../helpers/TestProperties';
import { expectations } from '../../helpers/expectations';
import { ensureTwoParticipants } from '../../helpers/participants';
setTestProperties(__filename, {
usesBrowsers: [ 'p1', 'p2' ]
});
describe('Kick', () => {
let p1: Participant, p2: Participant;
it('setup', async () => {
await ensureTwoParticipants();
p1 = ctx.p1;
p2 = ctx.p2;
// We verify elsewhere (moderation.spec.ts) that the first participant is a moderator.
if (!await p1.isModerator()) {
ctx.skipSuiteTests = true;
}
});
it('kick (p2p disabled)', () => kickAndCheck(p1, p2));
it('setup (p2p enabled)', async () => {
await p1.hangup();
await p2.hangup();
await ensureTwoParticipants({
configOverwrite: {
p2p: {
enabled: true
}
}
});
p1 = ctx.p1;
p2 = ctx.p2;
});
it('kick (p2p enabled)', async () => {
await kickAndCheck(p1, p2);
});
it('non-moderator cannot kick', async () => {
if (!expectations.moderation.allModerators) {
await ensureTwoParticipants();
p2 = ctx.p2;
expect(await p2.isModerator()).toBe(false);
await p2.execute(
epId => APP.conference._room.kickParticipant(epId, 'for funzies'),
await p1.getEndpointId()
);
await p1.driver.pause(3000);
expect(await p1.isInMuc()).toBe(true);
}
});
});
/**
* Kicks the second participant and checks that the participant is removed from the conference and that dialogue is open.
*/
async function kickAndCheck(kicker: Participant, kickee: Participant) {
await kicker.getFilmstrip().kickParticipant(await kickee.getEndpointId());
await kicker.waitForParticipants(0);
// check that the kicked participant sees the kick reason dialog
await kickee.driver.waitUntil(
async () => kickee.isLeaveReasonDialogOpen(), {
timeout: 2000,
timeoutMsg: 'No leave reason dialog shown for p2'
});
}

View File

@@ -1,39 +0,0 @@
import { Participant } from '../../helpers/Participant';
import { setTestProperties } from '../../helpers/TestProperties';
import { expectations } from '../../helpers/expectations';
import { joinMuc } from '../../helpers/joinMuc';
setTestProperties(__filename, {
usesBrowsers: [ 'p1', 'p2' ]
});
// Just make sure that users are given moderator rights as specified in the expectations config.
describe('Moderation', () => {
let p1: Participant, p2: Participant;
it('setup', async () => {
p1 = await joinMuc({ name: 'p1' });
p2 = await joinMuc({ name: 'p2' });
});
it('first moderator', async () => {
if (expectations.moderation.firstModerator) {
expect(await p1.isModerator()).toBe(true);
} else {
expect(await p1.isModerator()).toBe(false);
}
});
it('all moderators', async () => {
if (expectations.moderation.allModerators) {
expect(await p1.isModerator()).toBe(true);
expect(await p2.isModerator()).toBe(true);
}
});
it('auto moderator promotion', async () => {
if (expectations.moderation.autoModerator && !expectations.moderation.allModerators) {
expect(await p1.isModerator()).toBe(true);
expect(await p2.isModerator()).toBe(false);
await p1.hangup();
await p2.driver.waitUntil(async () => (await p2.isModerator()));
}
});
});

View File

@@ -58,7 +58,7 @@ const chromePreferences = {
};
const specs = [
'specs/**/*.spec.ts'
'specs/**/startMuted.spec.ts'
];
/**