2022-09-12 20:33:53 +08:00
|
|
|
const { expect } = require('@playwright/test');
|
2022-08-15 20:37:52 +08:00
|
|
|
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');
|
2022-08-15 20:37:52 +08:00
|
|
|
|
2021-11-16 00:42:29 +08:00
|
|
|
|
2023-04-24 20:44:25 +08:00
|
|
|
class Options extends MultiUsers {
|
|
|
|
constructor(browser, context) {
|
|
|
|
super(browser, context);
|
2021-11-16 00:42:29 +08:00
|
|
|
}
|
|
|
|
|
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',
|
2022-03-01 03:46:13 +08:00
|
|
|
[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
|
|
|
}
|
2021-11-16 00:42:29 +08:00
|
|
|
}
|
2022-11-11 04:25:18 +08:00
|
|
|
|
|
|
|
async darkMode() {
|
2024-02-14 04:06:20 +08:00
|
|
|
await this.modPage.waitForSelector(e.whiteboard);
|
|
|
|
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');
|
2024-03-08 20:30:48 +08:00
|
|
|
await this.modPage.setViewPortSize();
|
2023-09-04 21:35:16 +08:00
|
|
|
const screenshotOptions = {
|
|
|
|
maxDiffPixels: 1000,
|
|
|
|
};
|
2023-04-25 04:52:47 +08:00
|
|
|
|
2023-09-06 04:12:32 +08:00
|
|
|
await this.modPage.closeAllToastNotifications();
|
2023-09-04 21:35:16 +08:00
|
|
|
await expect(modPageLocator).toHaveScreenshot('moderator-page-dark-mode.png', screenshotOptions);
|
|
|
|
|
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() {
|
2024-02-14 04:06:20 +08:00
|
|
|
await this.modPage.waitForSelector(e.whiteboard);
|
|
|
|
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
|
|
|
|
2024-03-08 20:30:48 +08:00
|
|
|
await this.modPage.setViewPortSize();
|
2023-09-04 21:35:16 +08:00
|
|
|
const screenshotOptions = {
|
|
|
|
maxDiffPixels: 1000,
|
|
|
|
};
|
2023-04-25 04:52:47 +08:00
|
|
|
|
2023-09-06 04:12:32 +08:00
|
|
|
await this.modPage.closeAllToastNotifications();
|
|
|
|
|
2023-09-04 21:35:16 +08:00
|
|
|
await expect(modPageLocator).toHaveScreenshot('moderator-page-font-size.png', screenshotOptions);
|
2023-01-19 00:29:45 +08:00
|
|
|
}
|
2021-11-16 00:42:29 +08:00
|
|
|
}
|
|
|
|
|
2023-04-04 04:21:24 +08:00
|
|
|
exports.Options = Options;
|