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

107 lines
4.2 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, 'should display the close modal button for the about modal');
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
async openHelp() {
2023-04-25 21:25:23 +08:00
await this.modPage.waitAndClick(e.optionsButton);
const newPage = await this.modPage.handleNewTab(e.helpButton, this.modPage.context);
await expect(newPage, 'should the help page to display the title Tutorials').toHaveTitle(/Tutorials/);
2023-04-25 21:25:23 +08:00
await newPage.close();
await this.modPage.hasElement(e.whiteboard, 'should the whiteboard be open on the main meeting');
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);
2022-02-04 02:44:48 +08:00
for (const selector in currentValuesBySelector) {
await this.modPage.hasText(selector, currentValuesBySelector[selector], 'should the elements to be translated to the specific language');
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() {
await this.modPage.hasElement(e.whiteboard, 'should the whiteboard be display');
2024-02-14 04:06:20 +08:00
await this.modPage.waitAndClick(e.closePopup);
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
2023-09-04 21:35:16 +08:00
const modPageLocator = this.modPage.getLocator('body');
await this.modPage.setHeightWidthViewPortSize();
2023-09-04 21:35:16 +08:00
const screenshotOptions = {
maxDiffPixels: 1000,
};
2023-04-25 04:52:47 +08:00
await this.modPage.closeAllToastNotifications();
await expect(modPageLocator, 'should the meeting be in dark mode').toHaveScreenshot('moderator-page-dark-mode.png', screenshotOptions);
2023-09-04 21:35:16 +08:00
2023-04-25 04:52:47 +08:00
await openSettings(this.modPage);
await this.modPage.waitAndClickElement(e.darkModeToggleBtn);
await this.modPage.waitAndClick(e.modalConfirmButton);
2024-02-14 04:06:20 +08:00
await this.modPage.waitAndClick(e.chatOptions);
await this.modPage.waitAndClick(e.restoreWelcomeMessages);
2022-11-11 04:25:18 +08:00
}
2023-01-19 00:29:45 +08:00
async fontSizeTest() {
await this.modPage.hasElement(e.whiteboard, 'should the whiteboard be display');
2024-02-14 04:06:20 +08:00
await this.modPage.waitAndClick(e.closePopup);
2023-01-19 00:29:45 +08:00
// 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);
2023-09-04 21:35:16 +08:00
const modPageLocator = this.modPage.getLocator('body');
2024-01-25 01:49:03 +08:00
await this.modPage.setHeightWidthViewPortSize();
2023-09-04 21:35:16 +08:00
const screenshotOptions = {
maxDiffPixels: 1000,
};
2023-04-25 04:52:47 +08:00
await this.modPage.closeAllToastNotifications();
await expect(modPageLocator, 'should the meeting display the font size increased').toHaveScreenshot('moderator-page-font-size.png', screenshotOptions);
2023-01-19 00:29:45 +08:00
}
}
exports.Options = Options;