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

118 lines
5.1 KiB
JavaScript
Raw Normal View History

2022-09-12 20:33:53 +08:00
const { expect } = require('@playwright/test');
2022-08-15 21:37:54 +08:00
const Page = require('../core/page');
const { openAboutModal, openSettings, getLocaleValues } = require('./util');
2022-08-15 21:37:54 +08:00
const e = require('../core/elements');
2022-08-15 21:37:54 +08:00
class Options extends Page {
constructor(browser, page) {
super(browser, page);
}
2022-08-15 21:37:54 +08:00
async openedAboutModal() {
await openAboutModal(this);
await this.hasElement(e.closeModal);
}
2022-09-07 00:52:45 +08:00
async openHelp(context) {
await this.waitAndClick(e.optionsButton);
const newPage = await this.handleNewTab(e.helpButton, context);
await expect(newPage).toHaveTitle(/BigBlueButton Tutorials/);
await this.hasElement(e.presentationTitle);
}
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',
[e.raiseHandBtn]: 'app.actionsBar.emojiMenu.raiseHandLabel',
[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);
2022-01-20 03:50:59 +08:00
await openSettings(this);
await this.waitForSelector(e.languageSelector);
const langDropdown = await this.page.$(e.languageSelector);
2021-12-23 03:06:42 +08:00
await langDropdown.selectOption({ value: locale });
await this.waitAndClick(e.modalConfirmButton);
2022-02-04 02:44:48 +08:00
await this.waitForSelector(e.toastContainer);
for (const selector in currentValuesBySelector) {
await this.hasText(selector, currentValuesBySelector[selector]);
}
2021-12-23 03:06:42 +08:00
}
}
2022-11-11 04:25:18 +08:00
async darkMode() {
await openSettings(this);
await this.waitAndClickElement(e.darkModeToggleBtn);
await this.waitAndClick(e.modalConfirmButton);
//Checking user list
await this.getBackgroundColor(e.sharedNotesBackground, 'rgb(39, 42, 42)');
await this.getTextColor(e.sharedNotesBackground, 'rgb(208, 205, 201)');
await this.waitAndClick(e.manageUsers);
await this.waitAndClick(e.guestPolicyLabel);
await this.getBackgroundColor(e.guestPolicyBackground, 'rgb(34, 36, 37)');
await this.waitAndClick(e.closeModal);
2022-11-12 01:03:04 +08:00
await this.getBackgroundColor(e.chatButton, 'rgb(39, 42, 42)');
await this.getTextColor(e.chatButton, 'rgb(208, 205, 201)');
await this.getTextColor(e.hidePublicChat, 'rgb(170, 164, 155)');
await this.getTextColor(e.chatOptionsColor, 'rgb(170, 164, 155)');
2022-11-11 04:25:18 +08:00
2022-11-12 01:03:04 +08:00
await this.getTextColor(e.manageUsersColor, 'rgb(170, 164, 155)');
2022-11-11 04:25:18 +08:00
await this.waitAndClick(e.manageUsers);
await this.waitAndClick(e.lockViewersButton);
await this.getBackgroundColor(e.lockViewersBackground, 'rgb(34, 36, 37)');
await this.waitAndClick(e.applyLockSettings);
//Checking public chat
await this.getBackgroundColor(e.publicChat, 'rgb(34, 36, 37)');
await this.getBackgroundColor(e.chatWelcomeMessageText, 'rgb(37, 39, 40)');
await this.getBackgroundColor(e.sendButtonBackground, 'rgb(24, 94, 168)');
2022-11-12 01:03:04 +08:00
await this.getBackgroundColor(e.chatBox, 'rgb(34, 36, 37)');
await this.getTextColor(e.chatBox, 'rgb(170, 164, 155)');
2022-11-11 04:25:18 +08:00
// Checking actions background and buttons color
await this.getBackgroundColor(e.actionsBarBackground, 'rgb(30, 32, 33)')
await this.getTextColor(e.joinAudioBackgroundDisabled, 'rgb(222, 220, 217)');
2022-11-12 01:03:04 +08:00
await this.getBackgroundColor(e.joinAudioBackgroundDisabled, 'rgba(0, 0, 0, 0)');
2022-11-11 04:25:18 +08:00
await this.getTextColor(e.joinVideoBackgroundDisabled, 'rgb(222, 220, 217)');
2022-11-12 01:03:04 +08:00
await this.getBackgroundColor(e.joinVideoBackgroundDisabled, 'rgba(0, 0, 0, 0)');
2022-11-11 04:25:18 +08:00
await this.getTextColor(e.startScreenShareBackground, 'rgb(222, 220, 217)');
2022-11-12 01:03:04 +08:00
await this.getBackgroundColor(e.startScreenShareBackground, 'rgba(0, 0, 0, 0)');
2022-11-11 04:25:18 +08:00
await this.getTextColor(e.raiseHandBtnBackground, 'rgb(222, 220, 217)');
2022-11-12 01:03:04 +08:00
await this.getBackgroundColor(e.raiseHandBtnBackground, 'rgba(0, 0, 0, 0)');
2022-11-11 04:25:18 +08:00
await this.getBackgroundColor(e.actionsBackground, 'rgb(24, 94, 168)');
await this.getBackgroundColor(e.minimizePresentationBackground, '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
await this.getBackgroundColor(e.navbarBackground, 'rgb(30, 32, 33)');
await this.getTextColor(e.userListToggleBackground, 'rgb(222, 220, 217)');
await this.getTextColor(e.optionsButtonBackground, 'rgb(222, 220, 217)');
2022-11-12 01:03:04 +08:00
2022-11-11 04:25:18 +08:00
await this.waitAndClick(e.optionsButton);
await this.waitAndClick(e.settings);
await this.getBackgroundColor(e.modalSettings, 'rgb(34, 36, 37)');
await this.waitAndClick(e.modalConfirmButton);
2022-11-12 01:03:04 +08:00
await this.getBackgroundColor(e.presentationToolbarWrapper, 'rgb(39, 42, 42)');
2022-11-11 04:25:18 +08:00
}
}
2022-08-15 21:37:54 +08:00
exports.Options = Options;