bigbluebutton-Github/bigbluebutton-tests/playwright/notifications/notifications.js
Gabriel Luiz Porfirio 2e9134a02f
test: fix upload presentation tests (#20317)
* presentation upload test fix

* removing .only

* remove flaky flag

* updating presentation screenshots

* update screenshots

* Update bigbluebutton-tests/playwright/presentation/presentation.js

Co-authored-by: Anton Barboza de Sá <antonbsa.bck@gmail.com>

* adding the tests to run on ci

* updated presentation screenshots

* added the setHeightWidthViewPOrt funcion

* skip check screenshot on ci

* Update bigbluebutton-tests/playwright/presentation/presentation.js

Co-authored-by: Anton Barboza de Sá <antonbsa.bck@gmail.com>

* compare image url to check if presentation has changed

* update screenshots

* change function used when close notifications

---------

Co-authored-by: Anton Barboza de Sá <antonbsa.bck@gmail.com>
2024-07-30 15:10:11 -03:00

77 lines
3.1 KiB
JavaScript

const { test } = require('@playwright/test');
const { MultiUsers } = require('../user/multiusers');
const e = require('../core/elements');
const util = require('./util');
const { openSettings } = require('../options/util');
const { ELEMENT_WAIT_LONGER_TIME } = require('../core/constants');
const { getSettings } = require('../core/settings');
const { sleep } = require('../core/helpers');
class Notifications extends MultiUsers {
constructor(browser, context) {
super(browser, context);
}
async saveSettingsNotification() {
await util.waitAndClearDefaultPresentationNotification(this.modPage);
await openSettings(this.modPage);
await util.saveSettings(this.modPage);
await util.checkNotificationText(this.modPage, e.savedSettingsToast);
}
async audioNotification() {
await util.waitAndClearDefaultPresentationNotification(this.modPage);
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 this.modPage.closeAllToastNotifications();
await this.modPage.waitAndClick(e.audioDropdownMenu);
await this.modPage.waitAndClick(e.leaveAudio);
await util.waitAndClearNotification(this.modPage);
await this.modPage.waitAndClick(e.joinAudio);
await this.modPage.waitAndClick(e.listenOnlyButton);
await this.modPage.wasRemoved(e.establishingAudioLabel);
await util.checkNotificationText(this.modPage, e.joinAudioToast);
await util.checkNotificationIcon(this.modPage, e.listenOnlyIcon);
}
async getUserJoinPopupResponse() {
await util.waitAndClearDefaultPresentationNotification(this.modPage);
await this.userJoinNotification(this.modPage);
await util.waitAndClearNotification(this.modPage);
await this.initUserPage();
await this.modPage.waitForSelector(e.smallToastMsg, ELEMENT_WAIT_LONGER_TIME);
await util.checkNotificationText(this.modPage, e.attendeeJoinedToast);
}
async raiseAndLowerHandNotification() {
const { reactionsButton } = getSettings();
if (!reactionsButton) {
await this.modPage.waitForSelector(e.whiteboard);
await this.modPage.hasElement(e.joinAudio);
await this.modPage.wasRemoved(e.reactionsButton);
return
}
await util.waitAndClearDefaultPresentationNotification(this.modPage);
await this.modPage.waitAndClick(e.reactionsButton);
await this.modPage.waitAndClick(e.raiseHandBtn);
await sleep(1000);
await this.modPage.waitAndClick(e.reactionsButton);
await this.modPage.waitAndClick(e.lowerHandBtn);
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);
}
async userJoinNotification(page) {
await openSettings(page);
await util.enableUserJoinPopup(page);
await util.saveSettings(page);
}
}
exports.Notifications = Notifications;