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

158 lines
7.6 KiB
JavaScript
Raw Normal View History

2022-09-12 20:33:53 +08:00
const { expect } = require('@playwright/test');
const { openAboutModal, openSettings, getLocaleValues } = require('./util');
2022-08-15 21:37:54 +08:00
const e = require('../core/elements');
2022-11-24 22:52:06 +08:00
const { ELEMENT_WAIT_TIME } = require('../core/constants');
2023-04-24 20:44:25 +08:00
const { MultiUsers } = require('../user/multiusers');
2023-04-24 20:44:25 +08:00
class Options extends MultiUsers {
constructor(browser, context) {
super(browser, context);
}
2022-08-15 21:37:54 +08:00
async openedAboutModal() {
2023-04-24 20:44:25 +08:00
await openAboutModal(this.modPage);
await this.modPage.hasElement(e.closeModal);
2023-04-24 22:29:32 +08:00
await this.modPage.waitAndClick(e.closeModal);
2023-04-25 04:52:47 +08:00
}
2022-09-07 00:52:45 +08:00
2023-04-25 21:25:23 +08:00
async openHelp(context) {
await this.modPage.waitAndClick(e.optionsButton);
const newPage = await this.modPage.handleNewTab(e.helpButton, context);
await expect(newPage).toHaveTitle(/Tutorials/);
await newPage.close();
await this.modPage.hasElement(e.whiteboard);
2022-09-07 00:52:45 +08:00
}
2022-08-15 21:37:54 +08:00
async localesTest() {
2022-02-04 02:44:48 +08:00
const selectedKeysBySelector = {
[e.messageTitle]: 'app.userList.messagesTitle',
[e.notesTitle]: 'app.userList.notesTitle',
[e.userListToggleBtn]: 'app.navBar.userListToggleBtnLabel',
2022-02-04 02:44:48 +08:00
[e.hidePublicChat]: 'app.chat.titlePublic',
[e.sendButton]: 'app.chat.submitLabel',
[e.actions]: 'app.actionsBar.actionsDropdown.actionsLabel',
[e.joinAudio]: 'app.audio.joinAudio',
[e.joinVideo]: 'app.video.joinVideo',
[e.startScreenSharing]: 'app.actionsBar.actionsDropdown.desktopShareLabel',
[e.minimizePresentation]: 'app.actionsBar.actionsDropdown.minimizePresentationLabel',
2023-07-31 22:24:25 +08:00
[e.reactionsButton]: 'app.actionsBar.reactions.reactionsButtonLabel',
2022-02-04 02:44:48 +08:00
[e.connectionStatusBtn]: 'app.connection-status.label',
[e.optionsButton]: 'app.navBar.settingsDropdown.optionsLabel',
}
for (const locale of e.locales) {
2021-12-23 03:06:42 +08:00
console.log(`Testing ${locale} locale`);
2022-02-04 02:44:48 +08:00
const currentValuesBySelector = await getLocaleValues(selectedKeysBySelector, locale);
2023-04-25 04:52:47 +08:00
await openSettings(this.modPage);
await this.modPage.waitForSelector(e.languageSelector);
const langDropdown = await this.modPage.page.$(e.languageSelector);
2021-12-23 03:06:42 +08:00
await langDropdown.selectOption({ value: locale });
2023-04-25 04:52:47 +08:00
await this.modPage.waitAndClick(e.modalConfirmButton);
await this.modPage.waitForSelector(e.toastContainer);
2022-02-04 02:44:48 +08:00
for (const selector in currentValuesBySelector) {
2023-04-25 04:52:47 +08:00
await this.modPage.hasText(selector, currentValuesBySelector[selector]);
2022-02-04 02:44:48 +08:00
}
2021-12-23 03:06:42 +08:00
}
}
2022-11-11 04:25:18 +08:00
async darkMode() {
2023-04-25 04:52:47 +08:00
await openSettings(this.modPage);
2022-11-11 04:25:18 +08:00
2023-04-25 04:52:47 +08:00
await this.modPage.waitAndClickElement(e.darkModeToggleBtn);
await this.modPage.waitAndClick(e.modalConfirmButton);
2022-11-11 04:25:18 +08:00
//Checking user list
2023-04-25 04:52:47 +08:00
await this.modPage.waitAndClick(e.sharedNotes, ELEMENT_WAIT_TIME);
await this.modPage.backgroundColorTest(e.sharedNotesBackground, 'rgb(34, 36, 37)');
await this.modPage.waitAndClick(e.manageUsers);
await this.modPage.waitAndClick(e.guestPolicyLabel);
await this.modPage.backgroundColorTest(e.simpleModal, 'rgb(34, 36, 37)');
await this.modPage.waitAndClick(e.closeModal);
await this.modPage.waitAndClick(e.chatButton);
await this.modPage.backgroundColorTest(e.chatButton, 'rgb(48, 51, 52)');
await this.modPage.textColorTest(e.chatButton, 'rgb(208, 205, 201)');
await this.modPage.textColorTest(e.hidePublicChat, 'rgb(170, 164, 155)');
await this.modPage.textColorTest(`${e.chatOptions} >> span`, 'rgb(170, 164, 155)');
await this.modPage.textColorTest(`${e.manageUsers} >> span`, 'rgb(170, 164, 155)');
await this.modPage.waitAndClick(e.manageUsers);
await this.modPage.waitAndClick(e.lockViewersButton);
await this.modPage.backgroundColorTest(e.simpleModal, 'rgb(34, 36, 37)');
await this.modPage.waitAndClick(e.applyLockSettings);
2022-11-11 04:25:18 +08:00
//Checking public chat
2023-04-25 04:52:47 +08:00
await this.modPage.backgroundColorTest(e.publicChat, 'rgb(34, 36, 37)');
await this.modPage.backgroundColorTest(e.chatWelcomeMessageText, 'rgb(37, 39, 40)');
await this.modPage.backgroundColorTest(`${e.sendButton} >> span`, 'rgb(24, 94, 168)');
await this.modPage.backgroundColorTest(e.chatBox, 'rgb(34, 36, 37)');
await this.modPage.textColorTest(e.chatBox, 'rgb(170, 164, 155)');
2022-11-11 04:25:18 +08:00
// Checking actions bar background and buttons color
2023-04-25 04:52:47 +08:00
await this.modPage.backgroundColorTest(e.actionsBarBackground, 'rgb(30, 32, 33)')
await this.modPage.textColorTest(`${e.joinAudio} >> span`, 'rgb(222, 220, 217)');
await this.modPage.backgroundColorTest(`${e.joinAudio} >> span`, 'rgba(0, 0, 0, 0)');
await this.modPage.textColorTest(`${e.joinVideo} >> span`, 'rgb(222, 220, 217)');
await this.modPage.backgroundColorTest(`${e.joinVideo} >> span`, 'rgba(0, 0, 0, 0)');
await this.modPage.textColorTest(`${e.startScreenSharing} >> span`, 'rgb(222, 220, 217)');
await this.modPage.backgroundColorTest(`${e.startScreenSharing} >> span`, 'rgba(0, 0, 0, 0)');
2023-07-31 22:24:25 +08:00
await this.modPage.textColorTest(`${e.reactionsButton} >> span`, 'rgb(222, 220, 217)');
await this.modPage.backgroundColorTest(`${e.reactionsButton} >> span`, 'rgba(0, 0, 0, 0)');
2023-04-25 04:52:47 +08:00
await this.modPage.backgroundColorTest(`${e.actions} >> span`, 'rgb(24, 94, 168)');
await this.modPage.backgroundColorTest(`${e.minimizePresentation} >> span`, 'rgb(24, 94, 168)');
2022-11-12 01:03:04 +08:00
2022-11-11 04:25:18 +08:00
// Checking buttons background and navbar background
2023-04-25 04:52:47 +08:00
await this.modPage.backgroundColorTest(e.navbarBackground, 'rgb(30, 32, 33)');
await this.modPage.textColorTest(`${e.userListToggleBtn} >> span`, 'rgb(222, 220, 217)');
await this.modPage.textColorTest(`${e.optionsButton} >> span`, 'rgb(222, 220, 217)');
2022-11-12 01:03:04 +08:00
2022-11-15 21:27:24 +08:00
// Checking presentation area
2023-04-25 04:52:47 +08:00
await this.modPage.backgroundColorTest(e.whiteboardOptionsButton, 'rgb(34, 36, 37)');
await this.modPage.textColorTest(e.whiteboardOptionsButton, 'rgb(208, 205, 201)');
await this.modPage.waitAndClick(e.optionsButton);
await this.modPage.waitAndClick(e.settings);
await this.modPage.backgroundColorTest(e.fullscreenModal, 'rgb(34, 36, 37)');
await this.modPage.waitAndClick(e.modalConfirmButton);
await this.modPage.backgroundColorTest(e.presentationToolbarWrapper, 'rgb(39, 42, 42)');
await openSettings(this.modPage);
await this.modPage.waitAndClickElement(e.darkModeToggleBtn);
await this.modPage.waitAndClick(e.modalConfirmButton);
2022-11-11 04:25:18 +08:00
}
2023-01-19 00:29:45 +08:00
async fontSizeTest() {
// Increasing font size
2023-04-25 04:52:47 +08:00
await openSettings(this.modPage);
await this.modPage.waitAndClick(e.increaseFontSize);
await this.modPage.waitAndClick(e.modalConfirmButton);
await this.modPage.fontSizeCheck(e.chatButton, '16px');//text + icon
await this.modPage.fontSizeCheck(e.chatWelcomeMessageText, '16px');
await this.modPage.fontSizeCheck(e.chatMessages, '16px');
await this.modPage.fontSizeCheck(e.sharedNotes, '14px');
await this.modPage.fontSizeCheck(e.usersList, '16px');
await this.modPage.fontSizeCheck(e.currentUser, '16px');
await this.modPage.fontSizeCheck(e.actionsBarBackground, '16px');
await this.modPage.fontSizeCheck(e.navbarBackground, '24px');
2023-01-19 00:29:45 +08:00
// Decreasing font size
2023-04-25 04:52:47 +08:00
await openSettings(this.modPage);
await this.modPage.waitAndClick(e.decreaseFontSize);
await this.modPage.waitAndClick(e.decreaseFontSize);
await this.modPage.waitAndClick(e.modalConfirmButton);
await this.modPage.fontSizeCheck(e.chatButton, '12px');
await this.modPage.fontSizeCheck(e.chatWelcomeMessageText, '12px');
await this.modPage.fontSizeCheck(e.chatMessages, '12px')
await this.modPage.fontSizeCheck(e.sharedNotes, '10.5px');
await this.modPage.fontSizeCheck(e.usersList, '12px');
await this.modPage.fontSizeCheck(e.currentUser, '12px');
await this.modPage.fontSizeCheck(e.actionsBarBackground, '12px');
await this.modPage.fontSizeCheck(e.navbarBackground, '18px');
2023-01-19 00:29:45 +08:00
}
}
exports.Options = Options;