bigbluebutton-Github/bigbluebutton-tests/playwright/user/user.spec.js

300 lines
13 KiB
JavaScript
Raw Normal View History

const { devices } = require('@playwright/test');
const { test } = require('../fixtures');
const { MultiUsers } = require('./multiusers');
2022-01-20 03:50:59 +08:00
const { GuestPolicy } = require('./guestPolicy');
2022-01-29 03:52:22 +08:00
const { LockViewers } = require('./lockViewers');
2022-01-20 03:50:59 +08:00
const { MobileDevices } = require('./mobileDevices');
2023-10-26 04:29:52 +08:00
const { Timer } = require('./timer');
2024-03-13 21:28:39 +08:00
const { encodeCustomParams } = require('../parameters/util');
const { PARAMETER_HIDE_PRESENTATION_TOAST } = require('../core/constants');
2021-12-10 21:30:29 +08:00
const motoG4 = devices['Moto G4'];
const iPhone11 = devices['iPhone 11'];
2024-03-13 21:28:39 +08:00
const hidePresentationToast = encodeCustomParams(PARAMETER_HIDE_PRESENTATION_TOAST);
2022-01-20 03:50:59 +08:00
test.describe.parallel('User', () => {
2024-07-08 21:42:57 +08:00
test.describe.parallel('Actions', { tag: '@ci' }, () => {
2022-07-26 03:42:48 +08:00
// https://docs.bigbluebutton.org/2.6/release-tests.html#set-status--raise-hand-automated
2023-07-31 22:24:25 +08:00
test('Raise and lower Hand', async ({ browser, context, page }) => {
2022-01-20 21:12:54 +08:00
const multiusers = new MultiUsers(browser, context);
await multiusers.initModPage(page, true);
2022-03-29 21:53:07 +08:00
await multiusers.raiseAndLowerHand();
2022-01-20 21:12:54 +08:00
});
2022-02-08 03:22:48 +08:00
2023-02-04 04:04:45 +08:00
test('Raise Hand Rejected', async ({ browser, context, page }) => {
const multiusers = new MultiUsers(browser, context);
await multiusers.initModPage(page, true);
await multiusers.raiseHandRejected();
});
2024-05-15 05:07:58 +08:00
test('Toggle user list', async ({ browser, context, page }) => {
2022-02-08 03:22:48 +08:00
const multiusers = new MultiUsers(browser, context);
await multiusers.initModPage(page);
await multiusers.toggleUserList();
});
2024-05-15 05:07:58 +08:00
test('Stopwatch', async ({ browser, context, page })=> {
const timer = new Timer(browser, context);
await timer.initModPage(page, true);
await timer.stopwatchTest();
});
test('Timer', async ({ browser, context, page })=> {
2024-05-15 05:07:58 +08:00
const timer = new Timer(browser, context);
await timer.initModPage(page, true);
await timer.timerTest();
});
});
test.describe.parallel('List', { tag: '@ci' } , () => {
2022-01-20 21:12:54 +08:00
test('User presence check (multiple users)', async ({ browser, context, page }) => {
const multiusers = new MultiUsers(browser, context);
await multiusers.initPages(page);
await multiusers.userPresence();
});
2022-02-08 02:01:47 +08:00
2022-07-26 03:42:48 +08:00
// https://docs.bigbluebutton.org/2.6/release-tests.html#make-viewer-a-presenter-automated
test('Make presenter', async ({ browser, context, page }) => {
2022-02-08 02:45:42 +08:00
const multiusers = new MultiUsers(browser, context);
await multiusers.initPages(page);
await multiusers.makePresenter();
});
2022-07-26 03:42:48 +08:00
// https://docs.bigbluebutton.org/2.6/release-tests.html#taking-presenter-status-back-automated
test('Take presenter', async ({ browser, context, page }) => {
2022-02-08 02:45:42 +08:00
const multiusers = new MultiUsers(browser, context);
await multiusers.initModPage(page);
await multiusers.initModPage2();
await multiusers.takePresenter();
});
test('Promote to moderator', async ({ browser, context, page }) => {
2022-02-08 02:01:47 +08:00
const multiusers = new MultiUsers(browser, context);
2022-02-08 03:22:48 +08:00
await multiusers.initPages(page);
2022-02-08 02:01:47 +08:00
await multiusers.promoteToModerator();
});
test('Demote to viewer', async ({ browser, context, page }) => {
2022-02-08 02:01:47 +08:00
const multiusers = new MultiUsers(browser, context);
await multiusers.initModPage(page);
await multiusers.initModPage2();
await multiusers.demoteToViewer();
});
2022-12-09 02:32:31 +08:00
test('Give and remove whiteboard access', async ({ browser, context, page }) => {
2022-12-09 02:32:31 +08:00
const multiusers = new MultiUsers(browser, context);
await multiusers.initPages(page);
2022-12-09 02:32:31 +08:00
await multiusers.giveAndRemoveWhiteboardAccess();
});
test('Remove user', async ({ browser, context, page }) => {
const multiusers = new MultiUsers(browser, context);
await multiusers.initModPage(page, true);
await multiusers.initModPage2(true);
await multiusers.removeUser();
});
// User is currently getting stuck when trying to rejoin - no error message is shown
2024-07-08 21:42:57 +08:00
test('Remove user and prevent rejoining', { tag: '@flaky' }, async ({ browser, context, page }) => {
const multiusers = new MultiUsers(browser, context);
await multiusers.initModPage(page, true);
2023-08-23 04:25:50 +08:00
await multiusers.initModPage2(true, context, { joinParameter: 'userID=Moderator2' });
await multiusers.removeUserAndPreventRejoining(context);
});
2021-12-10 21:30:29 +08:00
});
2022-01-20 21:12:54 +08:00
test.describe.parallel('Manage', () => {
2024-07-08 21:42:57 +08:00
test.describe.parallel('Guest policy', { tag: '@ci' }, () => {
2024-05-15 05:07:58 +08:00
test.describe.parallel('ASK_MODERATOR', () => {
2022-10-11 04:08:47 +08:00
// https://docs.bigbluebutton.org/2.6/release-tests.html#ask-moderator
2022-10-11 01:47:44 +08:00
test('Message to guest lobby', async ({ browser, context, page }) => {
const guestPolicy = new GuestPolicy(browser, context);
await guestPolicy.initModPage(page);
await guestPolicy.messageToGuestLobby();
});
2023-09-14 04:11:15 +08:00
test('Allow Everyone', async ({ browser, context, page }) => {
2022-10-11 01:47:44 +08:00
const guestPolicy = new GuestPolicy(browser, context);
await guestPolicy.initModPage(page);
await guestPolicy.allowEveryone();
});
test('Deny Everyone', async ({ browser, context, page }) => {
const guestPolicy = new GuestPolicy(browser, context);
await guestPolicy.initModPage(page);
await guestPolicy.denyEveryone();
});
2022-11-26 03:54:32 +08:00
2022-10-11 01:47:44 +08:00
test('Remember choice', async ({ browser, context, page }) => {
const guestPolicy = new GuestPolicy(browser, context);
await guestPolicy.initModPage(page);
await guestPolicy.rememberChoice();
});
2024-07-08 21:42:57 +08:00
test.describe.parallel('Actions to specific pending user', { tag: '@ci' }, () => {
2022-10-11 01:47:44 +08:00
test('Message', async ({ browser, context, page }) => {
const guestPolicy = new GuestPolicy(browser, context);
await guestPolicy.initModPage(page);
await guestPolicy.messageToSpecificUser();
});
2022-11-26 03:54:32 +08:00
2023-09-14 04:11:15 +08:00
test('Accept', async ({ browser, context, page }) => {
2022-10-11 01:47:44 +08:00
const guestPolicy = new GuestPolicy(browser, context);
await guestPolicy.initModPage(page);
await guestPolicy.acceptSpecificUser();
});
2022-11-26 03:54:32 +08:00
2022-10-11 01:47:44 +08:00
test('Deny', async ({ browser, context, page }) => {
const guestPolicy = new GuestPolicy(browser, context);
await guestPolicy.initModPage(page);
await guestPolicy.denySpecificUser();
});
});
2022-01-20 21:12:54 +08:00
});
2021-12-10 21:30:29 +08:00
2022-01-20 21:12:54 +08:00
test('ALWAYS_ACCEPT', async ({ browser, context, page }) => {
const guestPolicy = new GuestPolicy(browser, context);
await guestPolicy.initModPage(page);
await guestPolicy.alwaysAccept();
});
2022-10-11 04:08:47 +08:00
// https://docs.bigbluebutton.org/2.6/release-tests.html#always-deny
2024-05-15 05:07:58 +08:00
test('ALWAYS_DENY', async ({ browser, context, page }) => {
2022-01-20 21:12:54 +08:00
const guestPolicy = new GuestPolicy(browser, context);
await guestPolicy.initModPage(page);
await guestPolicy.alwaysDeny();
});
2022-01-20 03:50:59 +08:00
});
2022-02-04 04:07:25 +08:00
2024-07-08 21:42:57 +08:00
test.describe.parallel('Lock viewers', { tag: '@ci' }, () => {
2022-07-26 03:42:48 +08:00
// https://docs.bigbluebutton.org/2.6/release-tests.html#webcam
2022-02-04 04:07:25 +08:00
test('Lock Share webcam', async ({ browser, context, page }) => {
const lockViewers = new LockViewers(browser, context);
await lockViewers.initPages(page);
2023-07-05 21:05:57 +08:00
await lockViewers.lockShareWebcam();
2022-02-04 04:07:25 +08:00
});
2022-07-26 03:42:48 +08:00
// https://docs.bigbluebutton.org/2.6/release-tests.html#see-other-viewers-webcams
2023-11-03 02:51:51 +08:00
test('Lock See other viewers webcams', async ({ browser, context, page }) => {
2022-02-04 04:07:25 +08:00
const lockViewers = new LockViewers(browser, context);
await lockViewers.initPages(page);
2023-07-05 21:05:57 +08:00
await lockViewers.lockSeeOtherViewersWebcams();
2022-02-04 04:07:25 +08:00
});
2022-07-26 03:42:48 +08:00
// https://docs.bigbluebutton.org/2.6/release-tests.html#microphone
2022-02-04 04:07:25 +08:00
test('Lock Share microphone', async ({ browser, context, page }) => {
const lockViewers = new LockViewers(browser, context);
await lockViewers.initPages(page);
2023-07-05 21:05:57 +08:00
await lockViewers.lockShareMicrophone();
2022-02-04 04:07:25 +08:00
});
2022-07-26 03:42:48 +08:00
// https://docs.bigbluebutton.org/2.6/release-tests.html#public-chat
2022-02-04 04:07:25 +08:00
test('Lock Send public chat messages', async ({ browser, context, page }) => {
const lockViewers = new LockViewers(browser, context);
await lockViewers.initPages(page);
2023-07-05 21:05:57 +08:00
await lockViewers.lockSendPublicChatMessages();
2022-02-04 04:07:25 +08:00
});
2022-07-26 03:42:48 +08:00
// https://docs.bigbluebutton.org/2.6/release-tests.html#private-chat
2022-02-04 04:07:25 +08:00
test('Lock Send private chat messages', async ({ browser, context, page }) => {
const lockViewers = new LockViewers(browser, context);
await lockViewers.initPages(page);
2023-07-05 21:05:57 +08:00
await lockViewers.lockSendPrivateChatMessages();
2022-02-04 04:07:25 +08:00
});
2022-07-26 03:42:48 +08:00
// https://docs.bigbluebutton.org/2.6/release-tests.html#shared-notes-1
test('Lock Edit Shared Notes', async ({ browser, context, page }) => {
2022-02-04 04:07:25 +08:00
const lockViewers = new LockViewers(browser, context);
await lockViewers.initPages(page);
2023-07-05 21:05:57 +08:00
await lockViewers.lockEditSharedNotes();
2022-02-04 04:07:25 +08:00
});
2022-07-26 03:42:48 +08:00
// https://docs.bigbluebutton.org/2.6/release-tests.html#see-other-viewers-in-the-users-list
2023-10-06 20:09:20 +08:00
test('Lock See other viewers in the Users list', async ({ browser, context, page }) => {
2022-02-04 04:07:25 +08:00
const lockViewers = new LockViewers(browser, context);
await lockViewers.initPages(page);
2023-07-05 21:05:57 +08:00
await lockViewers.lockSeeOtherViewersUserList();
2023-07-03 21:01:05 +08:00
});
2024-07-08 21:42:57 +08:00
test('Lock see other viewers annotations', { tag: '@flaky' }, async ({ browser, context, page }) => {
2023-07-03 21:01:05 +08:00
const lockViewers = new LockViewers(browser, context);
await lockViewers.initModPage(page, true, { joinParameter: hidePresentationToast });
await lockViewers.initUserPage(true, context, { joinParameter: hidePresentationToast });
2023-07-05 21:05:57 +08:00
await lockViewers.lockSeeOtherViewersAnnotations();
2023-07-03 21:01:05 +08:00
});
2024-07-08 21:42:57 +08:00
test('Lock see other viewers cursor', { tag: '@flaky' }, async ({ browser, context, page }) => {
2023-07-03 21:01:05 +08:00
const lockViewers = new LockViewers(browser, context);
await lockViewers.initPages(page);
2023-07-05 21:05:57 +08:00
await lockViewers.lockSeeOtherViewersCursor();
2022-02-04 04:07:25 +08:00
});
});
2022-07-26 03:42:48 +08:00
// https://docs.bigbluebutton.org/2.6/release-tests.html#saving-usernames
2024-07-08 21:42:57 +08:00
test('Save user names', { tag: '@ci' }, async ({ browser, context, page }, testInfo) => {
2022-03-21 23:04:43 +08:00
const multiusers = new MultiUsers(browser, context);
await multiusers.initPages(page);
await multiusers.saveUserNames(testInfo);
});
2022-12-14 02:42:11 +08:00
test('Mute all users', async ({ browser, context, page }) => {
const multiusers = new MultiUsers(browser, context);
await multiusers.initModPage(page, false);
await multiusers.initModPage2(false);
await multiusers.initUserPage(false);
await multiusers.muteAllUsers();
});
test('Mute all users except presenter', async ({ browser, context, page }) => {
const multiusers = new MultiUsers(browser, context);
await multiusers.initModPage(page, false);
await multiusers.initModPage2(false);
await multiusers.initUserPage(false);
await multiusers.muteAllUsersExceptPresenter();
});
2021-12-10 21:30:29 +08:00
});
2022-01-20 03:50:59 +08:00
test.describe.parallel('Mobile devices', () => {
test.beforeEach(({ browserName }) => {
test.skip(browserName === 'firefox', 'Mobile tests are not able in Firefox browser');
});
2024-07-08 21:42:57 +08:00
test('Mobile Tag Name For Mobile User', { tag: '@ci' }, async ({ browser }) => {
2022-01-20 03:50:59 +08:00
const context = await browser.newContext({ ...iPhone11 });
const mobilePage = await context.newPage();
const mobileDevices = new MobileDevices(browser, context);
await mobileDevices.initModPage(mobilePage);
await mobileDevices.mobileTagName();
});
2021-12-10 21:30:29 +08:00
2023-02-14 21:59:46 +08:00
test('Whiteboard should not be accessible when chat panel or user list are active on mobile devices', async ({ browser }) => {
2022-01-20 03:50:59 +08:00
test.fixme();
const iphoneContext = await browser.newContext({ ...iPhone11 });
const motoContext = await browser.newContext({ ...motoG4 });
const modPage = await iphoneContext.newPage();
const mobileDevices = new MobileDevices(browser, iphoneContext);
await mobileDevices.initModPage(modPage);
await mobileDevices.initUserPage(true, motoContext);
await mobileDevices.whiteboardNotAppearOnMobile();
});
2023-02-14 21:59:46 +08:00
test('User List should not appear when Chat Panel or Whiteboard are active on mobile devices', async ({ browser }) => {
2023-08-23 04:25:50 +08:00
test.fixme();
2022-01-20 03:50:59 +08:00
const iphoneContext = await browser.newContext({ ...iPhone11 });
const motoContext = await browser.newContext({ ...motoG4 });
const modPage = await iphoneContext.newPage();
const mobileDevices = new MobileDevices(browser, iphoneContext);
await mobileDevices.initModPage(modPage);
await mobileDevices.initUserPage(true, motoContext);
2023-02-14 21:59:46 +08:00
await mobileDevices.userListNotAppearOnMobile();
2022-01-20 03:50:59 +08:00
});
2021-12-10 21:30:29 +08:00
2023-02-14 21:59:46 +08:00
test('Chat Panel should not appear when UserList or Whiteboard are active on mobile devices', async ({ browser }) => {
2022-01-20 03:50:59 +08:00
const iphoneContext = await browser.newContext({ ...iPhone11 });
const motoContext = await browser.newContext({ ...motoG4 });
const modPage = await iphoneContext.newPage();
const mobileDevices = new MobileDevices(browser, iphoneContext);
await mobileDevices.initModPage(modPage);
await mobileDevices.initUserPage(true, motoContext);
await mobileDevices.chatPanelNotAppearOnMobile();
});
2021-12-10 21:30:29 +08:00
});
2021-11-03 06:50:20 +08:00
});