Skip to content

Commit debe431

Browse files
Copilotgermanocaumo
andcommitted
Add tests for presentation permission tab (moderatorOnly, requireApproval, freeForAll)
Co-authored-by: germanocaumo <2726293+germanocaumo@users.noreply.github.com>
1 parent 561f429 commit debe431

4 files changed

Lines changed: 107 additions & 2 deletions

File tree

bigbluebutton-tests/playwright/core/elements.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,15 @@ export const elements = {
472472
guestPolicySelector: '[data-test="guestPolicySelector"]',
473473
participantPermissionsTab: '[data-test="participantPermissionsTab"]',
474474
presentationPermissionsTab: '[data-test="presentationPermissionsTab"]',
475+
presentationPolicySelector: '[data-test="presentationPolicySelector"]',
476+
presModeratorOnly: 'li[data-test="presModeratorOnly"]',
477+
presRequireApproval: 'li[data-test="presRequireApproval"]',
478+
presFreeForAll: 'li[data-test="presFreeForAll"]',
479+
takePresenterButton: 'button[data-test="takePresenterButton"]',
480+
requestPresenterButton: 'button[data-test="requestPresenterButton"]',
481+
waitingPresenterButton: 'button[data-test="waitingPresenterButton"]',
482+
approvePresenter: 'button[data-test="approvePresenter"]',
483+
denyPresenter: 'button[data-test="denyPresenter"]',
475484
lockShareWebcam: 'input[data-test="lockShareWebcam"]',
476485
lockSeeOtherViewersWebcam: 'input[data-test="lockSeeOtherViewersWebcam"]',
477486
lockShareMicrophone: 'input[data-test="lockShareMicrophone"]',

bigbluebutton-tests/playwright/user/lockViewers.ts

Lines changed: 68 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { ELEMENT_WAIT_LONGER_TIME, ELEMENT_WAIT_TIME } from '../core/constants';
55
import { elements as e } from '../core/elements';
66
import { getNotesLocator } from '../sharednotes/util';
77
import { MultiUsers } from './multiusers';
8-
import { drawArrow, openLockViewers } from './util';
8+
import { drawArrow, openLockViewers, setPresentationPermission } from './util';
99

1010
export class LockViewers extends MultiUsers {
1111
async lockShareWebcam() {
@@ -423,4 +423,71 @@ export class LockViewers extends MultiUsers {
423423
'should be displayed the other viewer whiteboard cursor indicator when unlocking user is unlocked',
424424
);
425425
}
426+
427+
async presenterPolicyModeratorOnly() {
428+
// Lock the viewer (disableCam) so the moderatorOnly restriction applies, and set moderatorOnly policy
429+
await openLockViewers(this.modPage);
430+
await this.modPage.waitAndClick(e.participantPermissionsTab);
431+
await this.modPage.waitAndClickElement(e.lockShareWebcam);
432+
await this.modPage.waitAndClick(e.presentationPermissionsTab);
433+
await this.modPage.waitAndClick(e.presentationPolicySelector);
434+
await this.modPage.waitAndClick(e.presModeratorOnly);
435+
await this.modPage.waitAndClick(e.applyLockSettings);
436+
// Locked viewer should see no action button in the media area
437+
await this.userPage.waitAndClick(e.mediaAreaButton);
438+
await this.userPage.wasRemoved(
439+
e.takePresenterButton,
440+
'should not display a take presenter button for a locked viewer under moderatorOnly policy',
441+
);
442+
await this.userPage.wasRemoved(
443+
e.requestPresenterButton,
444+
'should not display a request presenter button for a locked viewer under moderatorOnly policy',
445+
);
446+
}
447+
448+
async presenterPolicyRequireApproval() {
449+
await setPresentationPermission(this.modPage, e.presRequireApproval);
450+
// Viewer opens media area and sees the request presenter button
451+
await this.userPage.waitAndClick(e.mediaAreaButton);
452+
await this.userPage.hasElement(
453+
e.requestPresenterButton,
454+
'should display the request presenter button for the viewer under requireApproval policy',
455+
);
456+
// Viewer requests presenter role
457+
await this.userPage.waitAndClick(e.requestPresenterButton);
458+
await this.userPage.hasElement(
459+
e.waitingPresenterButton,
460+
'should display the waiting presenter button while the request is pending',
461+
);
462+
// Moderator approves the request
463+
await this.modPage.hasElement(
464+
e.approvePresenter,
465+
'should display the approve presenter button for the moderator',
466+
ELEMENT_WAIT_LONGER_TIME,
467+
);
468+
await this.modPage.waitAndClick(e.approvePresenter);
469+
// Viewer becomes presenter
470+
await this.userPage.hasElement(
471+
e.wbToolbar,
472+
'should display the whiteboard toolbar after viewer becomes presenter',
473+
ELEMENT_WAIT_LONGER_TIME,
474+
);
475+
}
476+
477+
async presenterPolicyFreeForAll() {
478+
await setPresentationPermission(this.modPage, e.presFreeForAll);
479+
// Viewer opens media area and sees the take presenter button directly
480+
await this.userPage.waitAndClick(e.mediaAreaButton);
481+
await this.userPage.hasElement(
482+
e.takePresenterButton,
483+
'should display the take presenter button for the viewer under freeForAll policy',
484+
);
485+
// Viewer takes presenter without moderator approval
486+
await this.userPage.waitAndClick(e.takePresenterButton);
487+
await this.userPage.hasElement(
488+
e.wbToolbar,
489+
'should display the whiteboard toolbar after viewer takes presenter under freeForAll policy',
490+
ELEMENT_WAIT_LONGER_TIME,
491+
);
492+
}
426493
}

bigbluebutton-tests/playwright/user/user.spec.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,26 @@ test.describe.parallel('User', { tag: '@ci' }, () => {
245245
await lockViewers.initPages(page, testInfo);
246246
await lockViewers.lockSeeOtherViewersCursor();
247247
});
248+
249+
test.describe.parallel('Presentation permissions', () => {
250+
test('Moderator only', async ({ browser, context, page }, testInfo) => {
251+
const lockViewers = new LockViewers(browser, context);
252+
await lockViewers.initPages(page, testInfo);
253+
await lockViewers.presenterPolicyModeratorOnly();
254+
});
255+
256+
test('Require approval', async ({ browser, context, page }, testInfo) => {
257+
const lockViewers = new LockViewers(browser, context);
258+
await lockViewers.initPages(page, testInfo);
259+
await lockViewers.presenterPolicyRequireApproval();
260+
});
261+
262+
test('Free for all', async ({ browser, context, page }, testInfo) => {
263+
const lockViewers = new LockViewers(browser, context);
264+
await lockViewers.initPages(page, testInfo);
265+
await lockViewers.presenterPolicyFreeForAll();
266+
});
267+
});
248268
});
249269

250270
// https://docs.bigbluebutton.org/3.0/testing/release-testing/#saving-usernames

bigbluebutton-tests/playwright/user/util.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { Locator } from '@playwright/test';
22

3+
import { ELEMENT_WAIT_TIME } from '../core/constants';
34
import { elements as e } from '../core/elements';
45
import { Page } from '../core/page';
56

67
export async function openLockViewers(testPage: Page) {
7-
const isLockViewersButtonVisible = await testPage.page.locator(e.lockViewersButton).isVisible({ timeout: 1000 }).catch(() => false);
8+
const isLockViewersButtonVisible = await testPage.page.locator(e.lockViewersButton).isVisible({ timeout: ELEMENT_WAIT_TIME }).catch(() => false);
89
if (!isLockViewersButtonVisible) {
910
await testPage.waitAndClick(e.usersListSidebarButton);
1011
}
@@ -19,6 +20,14 @@ export async function setGuestPolicyOption(testPage: Page, option: string) {
1920
await testPage.waitAndClick(e.applyLockSettings);
2021
}
2122

23+
export async function setPresentationPermission(testPage: Page, option: string) {
24+
await openLockViewers(testPage);
25+
await testPage.waitAndClick(e.presentationPermissionsTab);
26+
await testPage.waitAndClick(e.presentationPolicySelector);
27+
await testPage.waitAndClick(option);
28+
await testPage.waitAndClick(e.applyLockSettings);
29+
}
30+
2231
export async function checkAvatarIcon(testPage: Page, checkModIcon = true) {
2332
await testPage.hasElement(
2433
`${e.currentUser} ${checkModIcon ? e.moderatorAvatar : e.viewerAvatar}`,

0 commit comments

Comments
 (0)