2022-06-08 02:52:22 +08:00
|
|
|
const { test } = require('@playwright/test');
|
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');
|
2022-08-27 08:53:06 +08:00
|
|
|
const { openSettings } = require('../options/util');
|
2022-01-20 03:50:59 +08:00
|
|
|
const { ELEMENT_WAIT_LONGER_TIME } = require('../core/constants');
|
2022-06-08 02:52:22 +08:00
|
|
|
const { getSettings } = require('../core/settings');
|
2023-07-25 05:07:51 +08:00
|
|
|
const { sleep } = require('../core/helpers');
|
2021-12-01 13:36:20 +08:00
|
|
|
|
|
|
|
class Notifications extends MultiUsers {
|
|
|
|
constructor(browser, context) {
|
|
|
|
super(browser, context);
|
|
|
|
}
|
|
|
|
|
|
|
|
async saveSettingsNotification() {
|
2022-06-08 02:52:22 +08:00
|
|
|
await util.waitAndClearDefaultPresentationNotification(this.modPage);
|
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);
|
|
|
|
}
|
|
|
|
|
2022-01-20 03:57:13 +08:00
|
|
|
async audioNotification() {
|
2022-06-08 02:52:22 +08:00
|
|
|
await util.waitAndClearDefaultPresentationNotification(this.modPage);
|
2022-01-20 03:57:13 +08:00
|
|
|
await this.modPage.waitAndClick(e.joinAudio);
|
|
|
|
await this.modPage.joinMicrophone();
|
|
|
|
await util.checkNotificationText(this.modPage, e.joinAudioToast);
|
2022-01-20 04:00:40 +08:00
|
|
|
await util.checkNotificationIcon(this.modPage, e.unmuteIcon);
|
|
|
|
await util.waitAndClearNotification(this.modPage);
|
2022-07-02 04:55:32 +08:00
|
|
|
await this.modPage.waitAndClick(e.audioDropdownMenu);
|
2022-01-20 04:00:40 +08:00
|
|
|
await this.modPage.waitAndClick(e.leaveAudio);
|
|
|
|
await util.waitAndClearNotification(this.modPage);
|
|
|
|
await this.modPage.waitAndClick(e.joinAudio);
|
|
|
|
await this.modPage.waitAndClick(e.listenOnlyButton);
|
2022-07-02 04:55:32 +08:00
|
|
|
await this.modPage.wasRemoved(e.establishingAudioLabel);
|
2022-01-20 04:00:40 +08:00
|
|
|
await util.checkNotificationText(this.modPage, e.joinAudioToast);
|
|
|
|
await util.checkNotificationIcon(this.modPage, e.listenOnlyIcon);
|
2021-12-01 13:36:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
async getUserJoinPopupResponse() {
|
2022-06-08 02:52:22 +08:00
|
|
|
await util.waitAndClearDefaultPresentationNotification(this.modPage);
|
2021-12-01 13:36:20 +08:00
|
|
|
await this.userJoinNotification(this.modPage);
|
2022-06-08 02:52:22 +08:00
|
|
|
await util.waitAndClearNotification(this.modPage);
|
2021-12-01 13:36:20 +08:00
|
|
|
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
|
|
|
}
|
|
|
|
|
2022-01-20 03:57:13 +08:00
|
|
|
async raiseAndLowerHandNotification() {
|
2023-07-25 05:07:51 +08:00
|
|
|
const { reactionsButton } = getSettings();
|
|
|
|
if (!reactionsButton) {
|
|
|
|
await this.modPage.waitForSelector(e.whiteboard);
|
|
|
|
await this.modPage.hasElement(e.joinAudio);
|
|
|
|
await this.modPage.wasRemoved(e.reactionsButton);
|
|
|
|
return
|
|
|
|
}
|
2022-03-29 21:53:07 +08:00
|
|
|
|
2022-06-08 02:52:22 +08:00
|
|
|
await util.waitAndClearDefaultPresentationNotification(this.modPage);
|
2023-07-25 05:07:51 +08:00
|
|
|
await this.modPage.waitAndClick(e.reactionsButton);
|
2022-01-20 03:57:13 +08:00
|
|
|
await this.modPage.waitAndClick(e.raiseHandBtn);
|
2023-07-25 05:07:51 +08:00
|
|
|
await sleep(1000);
|
2023-08-23 04:25:50 +08:00
|
|
|
await this.modPage.waitAndClick(e.reactionsButton);
|
2022-01-20 03:57:13 +08:00
|
|
|
await this.modPage.waitAndClick(e.lowerHandBtn);
|
2023-07-25 05:07:51 +08:00
|
|
|
await this.modPage.wasRemoved(e.raiseHandRejection);
|
|
|
|
await util.checkNotificationText(this.modPage, e.raisingHandToast);
|
|
|
|
await this.modPage.hasText(`${e.smallToastMsg}>>nth=0`, e.raisingHandToast);
|
|
|
|
await this.modPage.hasText(`${e.smallToastMsg}>>nth=1`, e.loweringHandToast);
|
2022-01-20 03:57:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
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;
|