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

235 lines
8.8 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');
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);
2023-09-27 03:41:58 +08:00
await this.modPage.wasRemoved(e.hidePublicChat);
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();
expect(pageTitle).toContain(`${c.docTitle} - `);
2021-12-15 01:10:44 +08:00
}
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);
expect(resp).toBeTruthy();
2021-12-15 01:10:44 +08:00
}
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);
expect(resp).toBeTruthy();
2021-12-15 01:10:44 +08:00
}
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 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.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.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);
expect(notificationBarColor).toBe(colorToRGB);
2021-12-15 01:10:44 +08:00
}
2023-05-16 19:43:16 +08:00
async hidePresentationOnJoin() {
2021-12-15 01:10:44 +08:00
await this.modPage.waitForSelector(e.actions);
await this.modPage.hasElement(e.restorePresentation);
await this.userPage.hasElement(e.restorePresentation);
await this.userPage.wasRemoved(e.whiteboard);
2021-12-15 01:10:44 +08:00
}
2023-07-31 22:24:25 +08:00
async forceRestorePresentationOnNewEvents(joinParameter) {
await this.initUserPage(true, this.context, { useModMeetingId: true, joinParameter });
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);
expect(zoomInCase).toBeTruthy();
2021-12-15 01:10:44 +08:00
const zoomOutCase = await util.zoomOut(this.modPage);
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);
}
2023-07-31 22:24:25 +08:00
async forceRestorePresentationOnNewPollResult(joinParameter) {
await this.initUserPage(true, this.context, { useModMeetingId: true, joinParameter })
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.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);
expect(resp).toBeTruthy();
2022-01-20 03:50:59 +08:00
}
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]);
expect(resp).toBeTruthy();
2022-01-20 03:50:59 +08:00
}
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]);
expect(resp).toBeTruthy();
2022-01-20 03:50:59 +08:00
}
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);
2023-07-31 22:24:25 +08:00
await this.modPage.wasRemoved(e.reactionsButton);
2023-02-08 02:12:20 +08:00
}
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);
}
2021-12-15 01:10:44 +08:00
}
exports.CustomParameters = CustomParameters;