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

61 lines
2.3 KiB
JavaScript
Raw Normal View History

2021-12-01 13:36:20 +08:00
const { MultiUsers } = require('../user/multiusers');
const e = require('../core/elements');
2022-01-20 03:50:59 +08:00
const util = require('./util');
const { openSettings } = require('../settings/util');
const { ELEMENT_WAIT_LONGER_TIME } = require('../core/constants');
2022-03-29 21:53:07 +08:00
const { default: test } = require('@playwright/test');
2021-12-01 13:36:20 +08:00
class Notifications extends MultiUsers {
constructor(browser, context) {
super(browser, context);
}
async saveSettingsNotification() {
2022-01-20 03:50:59 +08:00
await openSettings(this.modPage);
2021-12-01 13:36:20 +08:00
await util.saveSettings(this.modPage);
await util.checkNotificationText(this.modPage, e.savedSettingsToast);
}
async audioNotification() {
await this.modPage.waitAndClick(e.joinAudio);
await this.modPage.joinMicrophone();
await util.checkNotificationText(this.modPage, e.joinAudioToast);
await util.checkNotificationIcon(this.modPage, e.unmuteIcon);
await util.waitAndClearNotification(this.modPage);
await this.modPage.waitAndClick(e.leaveAudio);
await util.waitAndClearNotification(this.modPage);
await this.modPage.waitAndClick(e.joinAudio);
await this.modPage.waitAndClick(e.listenOnlyButton);
2022-01-20 21:03:18 +08:00
await this.modPage.wasRemoved(e.connecting);
await util.checkNotificationText(this.modPage, e.joinAudioToast);
await util.checkNotificationIcon(this.modPage, e.listenOnlyIcon);
2021-12-01 13:36:20 +08:00
}
async getUserJoinPopupResponse() {
await this.userJoinNotification(this.modPage);
await this.initUserPage();
await this.modPage.waitForSelector(e.smallToastMsg, ELEMENT_WAIT_LONGER_TIME);
2022-01-20 03:50:59 +08:00
await util.checkNotificationText(this.modPage, e.attendeeJoinedToast);
2021-12-01 13:36:20 +08:00
}
async raiseAndLowerHandNotification() {
2022-03-29 21:53:07 +08:00
const { raiseHandButton } = getSettings();
test.fail(!raiseHandButton, 'Raise/lower hand button is disabled');
await this.modPage.waitAndClick(e.raiseHandBtn);
await this.modPage.waitForSelector(e.smallToastMsg);
await util.checkNotificationText(this.modPage, e.raisingHandToast);
await util.waitAndClearNotification(this.modPage);
await this.modPage.waitAndClick(e.lowerHandBtn);
await util.checkNotificationText(this.modPage, e.loweringHandToast);
}
async userJoinNotification(page) {
await openSettings(page);
await util.enableUserJoinPopup(page);
await util.saveSettings(page);
2021-12-01 13:36:20 +08:00
}
}
2021-12-04 01:01:36 +08:00
exports.Notifications = Notifications;