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

51 lines
1.8 KiB
JavaScript
Raw Normal View History

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);
}
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-08-15 21:37:54 +08:00
exports.Options = Options;