bigbluebutton-Github/bigbluebutton-tests/playwright/customparameters/customparameters.js

323 lines
12 KiB
JavaScript
Raw Normal View History

2023-02-22 02:28:53 +08:00
const { expect, default: test } = require('@playwright/test');
2021-12-15 01:10:44 +08:00
const { MultiUsers } = require('../user/multiusers');
const e = require('../core/elements');
const c = require('./constants');
2023-02-14 21:06:17 +08:00
const { VIDEO_LOADING_WAIT_TIME, ELEMENT_WAIT_LONGER_TIME, ELEMENT_WAIT_EXTRA_LONG_TIME } = require('../core/constants');
2021-12-15 01:10:44 +08:00
const util = require('./util');
2022-03-29 21:53:07 +08:00
const { getSettings } = require('../core/settings');
const { waitAndClearDefaultPresentationNotification } = require('../notifications/util');
2021-12-15 01:10:44 +08:00
class CustomParameters extends MultiUsers {
constructor(browser, context) {
super(browser, context);
}
2022-01-20 03:50:59 +08:00
async showPublicChatOnLogin() {
await this.modPage.waitForSelector(e.actions);
2022-01-20 21:03:18 +08:00
await this.modPage.wasRemoved(e.publicChat);
2021-12-15 01:10:44 +08:00
}
2022-01-20 03:50:59 +08:00
async recordMeeting() {
await this.modPage.hasElement(e.recordingIndicator);
2021-12-15 01:10:44 +08:00
}
2022-01-20 03:50:59 +08:00
async showParticipantsOnLogin() {
2023-04-25 04:52:47 +08:00
await this.modPage.wasRemoved(e.usersList);
2021-12-15 01:10:44 +08:00
}
async clientTitle() {
const pageTitle = await this.modPage.page.title();
await expect(pageTitle).toContain(`${c.docTitle} - `);
}
async askForFeedbackOnLogout() {
await this.modPage.logoutFromMeeting();
await this.modPage.waitForSelector(e.meetingEndedModal);
await this.modPage.hasElement(e.rating);
}
async displayBrandingArea() {
await this.modPage.waitForSelector(e.userListContent);
await this.modPage.hasElement(e.brandingAreaLogo);
}
async shortcuts() {
// Check the initial shortcuts that can be used right after joining the meeting
await util.checkShortcutsArray(this.modPage, c.initialShortcuts);
// Join audio
await this.modPage.waitAndClick(e.joinAudio);
await this.modPage.joinMicrophone();
// Open private chat
await this.modPage.waitAndClick(e.userListItem);
2022-01-20 21:03:18 +08:00
await this.modPage.waitAndClick(e.startPrivateChat);
2021-12-15 01:10:44 +08:00
await this.modPage.waitForSelector(e.hidePrivateChat);
// Check the later shortcuts that can be used after joining audio and opening private chat
await util.checkShortcutsArray(this.modPage, c.laterShortcuts);
}
async customStyle() {
await this.modPage.waitForSelector(e.chatButton);
2021-12-15 01:10:44 +08:00
const resp = await this.modPage.page.evaluate((elem) => {
return document.querySelectorAll(elem)[0].offsetHeight == 0;
}, e.presentationTitle);
await expect(resp).toBeTruthy();
}
async autoSwapLayout() {
await this.modPage.waitForSelector(e.actions);
2023-02-14 21:06:17 +08:00
await this.modPage.waitAndClick(e.minimizePresentation);
2021-12-15 01:10:44 +08:00
const resp = await this.modPage.page.evaluate((elem) => {
return document.querySelectorAll(elem)[0].offsetHeight !== 0;
}, e.restorePresentation);
await expect(resp).toBeTruthy();
}
2022-01-20 03:50:59 +08:00
async autoJoin() {
2023-02-14 21:06:17 +08:00
await this.modPage.waitForSelector(e.chatMessages, ELEMENT_WAIT_LONGER_TIME);
2022-01-20 03:50:59 +08:00
await this.modPage.wasRemoved(e.audioModal);
}
async listenOnlyMode() {
2023-02-14 21:06:17 +08:00
await this.modPage.waitForSelector(e.audioSettingsModal, ELEMENT_WAIT_EXTRA_LONG_TIME);
await this.modPage.waitAndClick(e.joinEchoTestButton);
await this.modPage.waitForSelector(e.establishingAudioLabel);
await this.modPage.waitForSelector(e.isTalking);
await this.modPage.leaveAudio();
await this.modPage.waitAndClick(e.joinAudio);
await this.modPage.waitForSelector(e.audioSettingsModal);
2022-01-20 03:50:59 +08:00
}
async forceListenOnly() {
2022-01-20 21:03:18 +08:00
await this.userPage.wasRemoved(e.audioModal);
2023-02-14 21:06:17 +08:00
await this.userPage.waitForSelector(e.toastContainer, ELEMENT_WAIT_LONGER_TIME);
2022-01-20 03:50:59 +08:00
await util.forceListenOnly(this.userPage);
}
async skipCheck() {
await waitAndClearDefaultPresentationNotification(this.modPage);
2022-01-20 03:50:59 +08:00
await this.modPage.waitAndClick(e.microphoneButton);
await this.modPage.waitForSelector(e.establishingAudioLabel);
await this.modPage.wasRemoved(e.establishingAudioLabel, ELEMENT_WAIT_LONGER_TIME);
2022-01-20 03:50:59 +08:00
await this.modPage.hasElement(e.smallToastMsg);
await this.modPage.hasElement(e.isTalking);
}
async skipCheckOnFirstJoin() {
2023-02-14 21:06:17 +08:00
await this.modPage.waitAndClick(e.microphoneButton, ELEMENT_WAIT_LONGER_TIME);
await this.modPage.hasElement(e.establishingAudioLabel);
await this.modPage.hasElement(e.smallToastMsg);
await this.modPage.hasElement(e.isTalking);
2022-01-20 03:50:59 +08:00
await this.modPage.leaveAudio();
await this.modPage.waitAndClick(e.joinAudio);
await this.modPage.waitAndClick(e.microphoneButton);
await this.modPage.hasElement(e.audioSettingsModal);
2021-12-15 01:10:44 +08:00
}
async bannerText() {
await this.modPage.waitForSelector(e.actions);
2022-01-20 21:03:18 +08:00
await this.modPage.hasElement(e.notificationBannerBar);
2021-12-15 01:10:44 +08:00
}
async bannerColor(colorToRGB) {
2022-01-20 21:03:18 +08:00
await this.modPage.waitForSelector(e.notificationBannerBar);
const notificationLocator = this.modPage.getLocator(e.notificationBannerBar);
2021-12-15 01:10:44 +08:00
const notificationBarColor = await notificationLocator.evaluate((elem) => {
return getComputedStyle(elem).backgroundColor;
2022-01-20 21:03:18 +08:00
}, e.notificationBannerBar);
2021-12-15 01:10:44 +08:00
await expect(notificationBarColor).toBe(colorToRGB);
}
2022-01-20 03:50:59 +08:00
async hidePresentation() {
2021-12-15 01:10:44 +08:00
await this.modPage.waitForSelector(e.actions);
2022-01-20 03:50:59 +08:00
const checkPresentationButton = await this.modPage.checkElement(e.restorePresentation);
await expect(checkPresentationButton).toBeTruthy();
await this.modPage.wasRemoved(e.presentationPlaceholder);
2021-12-15 01:10:44 +08:00
}
async forceRestorePresentationOnNewEvents(customParameter) {
await this.initUserPage(true, this.context, { useModMeetingId: true, customParameter });
2022-03-29 21:53:07 +08:00
const { presentationHidden, pollEnabled } = getSettings();
if (!presentationHidden) await this.userPage.waitAndClick(e.minimizePresentation);
2021-12-15 01:10:44 +08:00
const zoomInCase = await util.zoomIn(this.modPage);
await expect(zoomInCase).toBeTruthy();
const zoomOutCase = await util.zoomOut(this.modPage);
await expect(zoomOutCase).toBeTruthy();
2022-03-29 21:53:07 +08:00
if (pollEnabled) await util.poll(this.modPage, this.userPage);
2021-12-15 01:10:44 +08:00
await util.nextSlide(this.modPage);
await util.previousSlide(this.modPage);
2021-12-15 01:10:44 +08:00
await util.annotation(this.modPage);
await this.userPage.checkElement(e.restorePresentation);
}
async forceRestorePresentationOnNewPollResult(customParameter) {
await this.initUserPage(true, this.context, { useModMeetingId: true, customParameter })
2022-03-29 21:53:07 +08:00
const { presentationHidden,pollEnabled } = getSettings();
if (!presentationHidden) await this.userPage.waitAndClick(e.minimizePresentation);
if (pollEnabled) await util.poll(this.modPage, this.userPage);
2021-12-15 01:10:44 +08:00
await this.userPage.waitForSelector(e.smallToastMsg);
await this.userPage.checkElement(e.restorePresentation);
}
2022-01-20 03:50:59 +08:00
async enableVideo() {
await this.modPage.wasRemoved(e.joinVideo);
2021-12-15 01:10:44 +08:00
}
async skipVideoPreview() {
await this.modPage.shareWebcam(false);
}
async skipVideoPreviewOnFirstJoin() {
await this.modPage.shareWebcam(false);
await this.modPage.waitAndClick(e.leaveVideo, VIDEO_LOADING_WAIT_TIME);
await this.modPage.waitForSelector(e.joinVideo);
2022-03-29 21:53:07 +08:00
const { videoPreviewTimeout } = this.modPage.settings;
await this.modPage.shareWebcam(true, videoPreviewTimeout);
2021-12-15 01:10:44 +08:00
}
async mirrorOwnWebcam() {
await this.modPage.waitAndClick(e.joinVideo);
await this.modPage.waitForSelector(e.webcamMirroredVideoPreview);
await this.modPage.waitAndClick(e.startSharingWebcam);
await this.modPage.hasElement(e.webcamMirroredVideoContainer);
}
2022-01-20 03:50:59 +08:00
async multiUserPenOnly() {
2022-01-20 21:03:18 +08:00
await this.modPage.waitAndClick(e.multiUsersWhiteboardOn);
await this.userPage.waitAndClick(e.wbToolbar);
2022-01-20 03:50:59 +08:00
const resp = await this.userPage.page.evaluate((toolsElement) => {
return document.querySelectorAll(toolsElement)[0].parentElement.childElementCount === 1;
}, e.wbToolbar);
2022-01-20 03:50:59 +08:00
await expect(resp).toBeTruthy();
}
async presenterTools() {
await this.modPage.waitForSelector(e.whiteboard, ELEMENT_WAIT_LONGER_TIME);
await this.modPage.waitAndClick(e.wbToolbar);
2022-01-20 03:50:59 +08:00
const resp = await this.modPage.page.evaluate(([toolsElement, toolbarListSelector]) => {
return document.querySelectorAll(toolsElement)[0].parentElement.querySelector(toolbarListSelector).childElementCount === 2;
}, [e.wbToolbar, e.toolbarToolsList]);
2022-01-20 03:50:59 +08:00
await expect(resp).toBeTruthy();
}
async multiUserTools() {
2022-01-20 21:03:18 +08:00
await this.modPage.waitAndClick(e.multiUsersWhiteboardOn);
await this.userPage.waitAndClick(e.wbToolbar);
2022-01-20 03:50:59 +08:00
const resp = await this.userPage.page.evaluate(([toolsElement, toolbarListSelector]) => {
return document.querySelectorAll(toolsElement)[0].parentElement.querySelector(toolbarListSelector).childElementCount === 2;
}, [e.wbToolbar, e.toolbarToolsList]);
2022-01-20 03:50:59 +08:00
await expect(resp).toBeTruthy();
}
async autoShareWebcam() {
await this.modPage.hasElement(e.webcamSettingsModal);
2021-12-15 01:10:44 +08:00
}
2023-02-08 02:12:20 +08:00
2023-02-11 03:19:43 +08:00
async hideActionsBarTest() {
2023-02-08 02:12:20 +08:00
await this.modPage.wasRemoved(e.actions);
await this.modPage.wasRemoved(e.joinAudio);
await this.modPage.wasRemoved(e.joinVideo);
await this.modPage.wasRemoved(e.startScreenSharing);
await this.modPage.wasRemoved(e.minimizePresentation);
await this.modPage.wasRemoved(e.raiseHandBtn);
}
2023-02-11 03:19:43 +08:00
async overrideDefaultLocaleTest() {
2023-02-08 02:12:20 +08:00
await this.modPage.hasText(e.chatButton, 'Bate-papo público');
}
2023-02-11 03:19:43 +08:00
async hideNavBarTest() {
2023-02-08 02:12:20 +08:00
await this.modPage.wasRemoved(e.navbarBackground);
}
2023-02-11 03:19:43 +08:00
async preferredCameraProfileTest() {
2023-02-08 02:12:20 +08:00
await this.modPage.waitAndClick(e.joinVideo);
expect(await this.modPage.getLocator(e.selectCameraQualityId).inputValue()).toBe('low');
await this.modPage.waitAndClick(e.startSharingWebcam);
}
2023-02-22 02:28:53 +08:00
async breakoutRooms() {
await this.modPage.waitAndClick(e.manageUsers);
await this.modPage.wasRemoved(e.createBreakoutRooms);
}
async liveTranscription() {
await this.modPage.waitForSelector(e.audioModal, ELEMENT_WAIT_LONGER_TIME);
2023-04-25 04:52:47 +08:00
await this.modPage.wasRemoved(e.liveTranscription);
2023-02-22 02:28:53 +08:00
}
async captions() {
await this.modPage.waitAndClick(e.manageUsers);
await this.modPage.wasRemoved(e.writeClosedCaptions);
}
async chat() {
await this.modPage.wasRemoved(e.publicChat);
}
async externalVideos() {
await this.modPage.waitAndClick(e.actions);
await this.modPage.wasRemoved(e.shareExternalVideoBtn);
}
2023-02-23 20:05:57 +08:00
async layouts() {
await this.modPage.waitAndClick(e.actions);
await this.modPage.wasRemoved(e.propagateLayout);
await this.modPage.wasRemoved(e.layoutModal);
}
2023-02-22 02:28:53 +08:00
async learningDashboard() {
await this.modPage.waitAndClick(e.manageUsers);
await this.modPage.wasRemoved(e.learningDashboard);
}
async polls() {
await this.modPage.waitAndClick(e.actions);
await this.modPage.wasRemoved(e.polling);
}
async screenshare() {
await this.modPage.wasRemoved(e.startScreenSharing);
}
async sharedNotes() {
await this.modPage.wasRemoved(e.sharedNotes);
}
async virtualBackgrounds() {
await this.modPage.waitAndClick(e.joinVideo);
await this.modPage.wasRemoved(e.virtualBackgrounds);
}
async downloadPresentationWithAnnotations() {
await this.modPage.waitAndClick(e.actions);
await this.modPage.waitAndClick(e.managePresentations);
await this.modPage.wasRemoved(e.exportPresentationToPublicChat);
}
async importPresentationWithAnnotationsFromBreakoutRooms() {
await this.modPage.waitAndClick(e.manageUsers);
await this.modPage.waitAndClick(e.createBreakoutRooms);
await this.modPage.wasRemoved(e.captureBreakoutWhiteboard);
}
async importSharedNotesFromBreakoutRooms() {
await this.modPage.waitAndClick(e.manageUsers);
await this.modPage.waitAndClick(e.createBreakoutRooms);
await this.modPage.wasRemoved(e.captureBreakoutSharedNotes);
}
async presentation() {
await this.modPage.wasRemoved(e.whiteboard);
await this.modPage.wasRemoved(e.minimizePresentation);
await this.modPage.wasRemoved(e.restorePresentation);
}
async customVirtualBackground() {
await this.modPage.waitAndClick (e.joinVideo);
await this.modPage.waitForSelector(e.webcamSettingsModal);
await this.modPage.wasRemoved(e.inputBackgroundButton);
}
2021-12-15 01:10:44 +08:00
}
exports.CustomParameters = CustomParameters;