2022-08-15 21:37:54 +08:00
|
|
|
const Page = require('../core/page');
|
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-08-15 20:37:52 +08:00
|
|
|
|
2021-11-16 00:42:29 +08:00
|
|
|
|
2022-08-15 21:37:54 +08:00
|
|
|
class Options extends Page {
|
2021-11-16 00:42:29 +08:00
|
|
|
constructor(browser, page) {
|
|
|
|
super(browser, page);
|
|
|
|
}
|
|
|
|
|
2022-08-15 21:37:54 +08:00
|
|
|
async openedAboutModal() {
|
|
|
|
await openAboutModal(this);
|
|
|
|
await this.hasElement(e.closeModal);
|
|
|
|
}
|
|
|
|
|
|
|
|
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',
|
|
|
|
[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);
|
2022-02-03 08:05:26 +08:00
|
|
|
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 });
|
2022-02-03 08:05:26 +08:00
|
|
|
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
|
|
|
}
|
2021-11-16 00:42:29 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-08-15 21:37:54 +08:00
|
|
|
exports.Options = Options;
|