check for default presentation toast and only clear it if it's present
This commit is contained in:
parent
e00556b00b
commit
d67c839cce
@ -98,6 +98,7 @@ exports.etherpadEditable = 'body[id="innerdocbody"]';
|
||||
|
||||
// Notifications
|
||||
exports.smallToastMsg = 'div[data-test="toastSmallMsg"]';
|
||||
exports.currentPresentationToast = 'div[data-test="toastSmallMsg"] > div';
|
||||
exports.notificationsTab = 'span[id="notificationTab"]';
|
||||
exports.chatPopupAlertsBtn = 'input[data-test="chatPopupAlertsBtn"]';
|
||||
exports.hasUnreadMessages = 'button[data-test="hasUnreadMessages"]';
|
||||
|
@ -35,7 +35,7 @@ class Page {
|
||||
const joinUrl = helpers.getJoinURL(this.meetingId, this.initParameters, isModerator, customParameter);
|
||||
const response = await this.page.goto(joinUrl);
|
||||
await expect(response.ok()).toBeTruthy();
|
||||
const hasErrorLabel = await this.page.evaluate(checkElement, [e.errorMessageLabel]);
|
||||
const hasErrorLabel = await this.checkElement(e.errorMessageLabel);
|
||||
await expect(hasErrorLabel, 'Getting error when joining. Check if the BBB_URL and BBB_SECRET are set correctly').toBeFalsy();
|
||||
this.settings = await generateSettingsData(this.page);
|
||||
const { autoJoinAudioModal } = this.settings;
|
||||
|
@ -2,6 +2,15 @@ const { expect } = require("@playwright/test");
|
||||
|
||||
// Common
|
||||
function checkElement([element, index = 0]) {
|
||||
/* Because this function is passed to a page.evaluate, it can only
|
||||
* take a single argument; that's why we pass it an array. It's so
|
||||
* easy to pass it a string by mistake that we check to make sure
|
||||
* the second argument is an integer and not a character from a
|
||||
* destructured string.
|
||||
*/
|
||||
if (typeof index != "number") {
|
||||
throw Error("Assert failed: index not a number");
|
||||
}
|
||||
return document.querySelectorAll(element)[index] !== undefined;
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,6 @@ const { expect } = require('@playwright/test');
|
||||
const { ELEMENT_WAIT_LONGER_TIME } = require('../core/constants');
|
||||
const e = require('../core/elements');
|
||||
const { sleep } = require('../core/helpers');
|
||||
const { checkElement } = require('../core/util');
|
||||
|
||||
async function enableChatPopup(test) {
|
||||
await test.waitAndClick(e.notificationsTab);
|
||||
@ -55,9 +54,9 @@ async function waitAndClearNotification(testPage) {
|
||||
}
|
||||
|
||||
async function waitAndClearDefaultPresentationNotification(testPage) {
|
||||
const hasPresentationUploaded = await testPage.page.evaluate(checkElement, e.whiteboard);
|
||||
if (!hasPresentationUploaded) {
|
||||
await testPage.waitForSelector(e.whiteboard, ELEMENT_WAIT_LONGER_TIME);
|
||||
await testPage.waitForSelector(e.whiteboard,ELEMENT_WAIT_LONGER_TIME);
|
||||
const hasCurrentPresentationToast = await testPage.checkElement(e.currentPresentationToast);
|
||||
if (hasCurrentPresentationToast) {
|
||||
await waitAndClearNotification(testPage);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user