Hiding the presentation notifications in drawing tests

This commit is contained in:
Maxim Khlobystov 2022-11-15 04:34:13 +00:00
parent 71c985646a
commit 44155d8679
14 changed files with 15 additions and 32 deletions

View File

@ -61,11 +61,6 @@ async function waitAndClearDefaultPresentationNotification(testPage) {
}
}
async function clearNotificationIfPresent(testPage) {
const hasNotificationAppeared = await testPage.page.evaluate(checkElement, e.smallToastMsg);
if (hasNotificationAppeared) await testPage.waitAndClick(e.smallToastMsg, ELEMENT_WAIT_LONGER_TIME);
}
exports.privateChatMessageToast = privateChatMessageToast;
exports.publicChatMessageToast = publicChatMessageToast;
exports.enableUserJoinPopup = enableUserJoinPopup;
@ -73,6 +68,5 @@ exports.checkNotificationText = checkNotificationText;
exports.checkNotificationIcon = checkNotificationIcon;
exports.enableChatPopup = enableChatPopup;
exports.saveSettings = saveSettings;
exports.clearNotificationIfPresent = clearNotificationIfPresent;
exports.waitAndClearNotification = waitAndClearNotification;
exports.waitAndClearDefaultPresentationNotification = waitAndClearDefaultPresentationNotification;

View File

@ -3,7 +3,6 @@ const Page = require('../core/page');
const e = require('../core/elements');
const { ELEMENT_WAIT_LONGER_TIME } = require('../core/constants');
const { MultiUsers } = require('../user/multiusers');
const { clearNotificationIfPresent } = require('../notifications/util');
class DrawEllipse extends MultiUsers {
constructor(browser, context) {
@ -22,12 +21,10 @@ class DrawEllipse extends MultiUsers {
await this.modPage.page.mouse.move(wbBox.x + 0.7 * wbBox.width, wbBox.y + 0.7 * wbBox.height);
await this.modPage.page.mouse.up();
await clearNotificationIfPresent(this.modPage);
await expect(this.modPage.page).toHaveScreenshot('moderator1-ellipse.png');
await expect(this.modPage.page).toHaveScreenshot('moderator1-ellipse.png', { maxDiffPixels: 2000 });
await this.modPage2.waitForSelector(e.whiteboard, ELEMENT_WAIT_LONGER_TIME);
await clearNotificationIfPresent(this.modPage2);
await expect(this.modPage2.page).toHaveScreenshot('moderator2-ellipse.png');
await expect(this.modPage2.page).toHaveScreenshot('moderator2-ellipse.png', { maxDiffPixels: 2000 });
}
}

View File

@ -3,7 +3,6 @@ const Page = require('../core/page');
const e = require('../core/elements');
const { ELEMENT_WAIT_LONGER_TIME } = require('../core/constants');
const { MultiUsers } = require('../user/multiusers');
const { clearNotificationIfPresent } = require('../notifications/util');
class DrawLine extends MultiUsers {
constructor(browser, context) {
@ -22,12 +21,10 @@ class DrawLine extends MultiUsers {
await this.modPage.page.mouse.move(wbBox.x + 0.7 * wbBox.width, wbBox.y + 0.7 * wbBox.height);
await this.modPage.page.mouse.up();
await clearNotificationIfPresent(this.modPage);
await expect(this.modPage.page).toHaveScreenshot('moderator1-line.png');
await expect(this.modPage.page).toHaveScreenshot('moderator1-line.png', { maxDiffPixels: 2000 });
await this.modPage2.waitForSelector(e.whiteboard, ELEMENT_WAIT_LONGER_TIME);
await clearNotificationIfPresent(this.modPage2);
await expect(this.modPage2.page).toHaveScreenshot('moderator2-line.png');
await expect(this.modPage2.page).toHaveScreenshot('moderator2-line.png', { maxDiffPixels: 2000 });
}
}

View File

@ -3,7 +3,6 @@ const Page = require('../core/page');
const e = require('../core/elements');
const { ELEMENT_WAIT_LONGER_TIME } = require('../core/constants');
const { MultiUsers } = require('../user/multiusers');
const { clearNotificationIfPresent } = require('../notifications/util');
class DrawRectangle extends MultiUsers {
constructor(browser, context) {
@ -23,11 +22,9 @@ class DrawRectangle extends MultiUsers {
await this.modPage.page.mouse.up();
await this.modPage.waitForSelector(e.wbDrawnRectangle);
await clearNotificationIfPresent(this.modPage);
await expect(this.modPage.page).toHaveScreenshot('moderator1-rectangle.png', { maxDiffPixels: 2000 });
await this.modPage2.waitForSelector(e.whiteboard, ELEMENT_WAIT_LONGER_TIME);
await clearNotificationIfPresent(this.modPage2);
await expect(this.modPage2.page).toHaveScreenshot('moderator2-rectangle.png', { maxDiffPixels: 2000 });
}
}

View File

@ -3,7 +3,6 @@ const Page = require('../core/page');
const e = require('../core/elements');
const { ELEMENT_WAIT_LONGER_TIME } = require('../core/constants');
const { MultiUsers } = require('../user/multiusers');
const { clearNotificationIfPresent } = require('../notifications/util');
class DrawTriangle extends MultiUsers {
constructor(browser, context) {
@ -22,11 +21,9 @@ class DrawTriangle extends MultiUsers {
await this.modPage.page.mouse.move(wbBox.x + 0.7 * wbBox.width, wbBox.y + 0.7 * wbBox.height);
await this.modPage.page.mouse.up();
await clearNotificationIfPresent(this.modPage);
await expect(this.modPage.page).toHaveScreenshot('moderator1-triangle.png', { maxDiffPixels: 2000 });
await this.modPage2.waitForSelector(e.whiteboard, ELEMENT_WAIT_LONGER_TIME);
await clearNotificationIfPresent(this.modPage2);
await expect(this.modPage2.page).toHaveScreenshot('moderator2-triangle.png', { maxDiffPixels: 2000 });
}
}

View File

@ -6,15 +6,16 @@ const { DrawTriangle } = require('./drawTriangle');
const { DrawLine } = require('./drawLine');
const { MultiUsers } = require('../user/multiusers');
const { CUSTOM_MEETING_ID } = require('../core/constants');
const { encodeCustomParams } = require('../customparameters/util');
test.describe.parallel('Whiteboard @ci', () => {
test('Draw rectangle', async ({ browser, page }) => {
test.skip('Draw rectangle', async ({ browser, page }) => {
const draw = new Draw(browser, page);
await draw.init(true, true);
await draw.test();
})
test('Give Additional Whiteboard Access', async ({ browser, context, page }) => {
test.skip('Give Additional Whiteboard Access', async ({ browser, context, page }) => {
const multiusers = new MultiUsers(browser, context);
await multiusers.initPages(page);
await multiusers.whiteboardAccess();
@ -29,29 +30,29 @@ test.describe.parallel('Drawing - visual regression', () => {
test('Draw rectangle', async ({ browser, context, page }) => {
const drawRectangle = new DrawRectangle(browser, context);
await drawRectangle.initModPage(page, true, { customMeetingId : 'draw_rectangle_meeting' });
await drawRectangle.initModPage2();
await drawRectangle.initModPage(page, true, { customMeetingId : 'draw_rectangle_meeting', customParameter: encodeCustomParams(`userdata-bbb_custom_style=.presentationUploaderToast{display: none;}.currentPresentationToast{display:none;}`) });
await drawRectangle.initModPage2(true, context, { customParameter: encodeCustomParams(`userdata-bbb_custom_style=.presentationUploaderToast{display: none;}.currentPresentationToast{display:none;}`) });
await drawRectangle.test();
});
test('Draw ellipse', async ({ browser, context, page }) => {
const drawEllipse = new DrawEllipse(browser, context);
await drawEllipse.initModPage(page, true, { customMeetingId : 'draw_ellipse_meeting' });
await drawEllipse.initModPage2();
await drawEllipse.initModPage(page, true, { customMeetingId : 'draw_ellipse_meeting', customParameter: encodeCustomParams(`userdata-bbb_custom_style=.presentationUploaderToast{display: none;}.currentPresentationToast{display:none;}`) });
await drawEllipse.initModPage2(true, context, { customParameter: encodeCustomParams(`userdata-bbb_custom_style=.presentationUploaderToast{display: none;}.currentPresentationToast{display:none;}`) });
await drawEllipse.test();
});
test('Draw triangle', async ({ browser, context, page }) => {
const drawTriangle = new DrawTriangle(browser, context);
await drawTriangle.initModPage(page, true, { customMeetingId : 'draw_triangle_meeting' });
await drawTriangle.initModPage2();
await drawTriangle.initModPage(page, true, { customMeetingId : 'draw_triangle_meeting', customParameter: encodeCustomParams(`userdata-bbb_custom_style=.presentationUploaderToast{display: none;}.currentPresentationToast{display:none;}`) });
await drawTriangle.initModPage2(true, context, { customParameter: encodeCustomParams(`userdata-bbb_custom_style=.presentationUploaderToast{display: none;}.currentPresentationToast{display:none;}`) });
await drawTriangle.test();
});
test('Draw line', async ({ browser, context, page }) => {
const drawLine= new DrawLine(browser, context);
await drawLine.initModPage(page, true, { customMeetingId : 'draw_line_meeting' });
await drawLine.initModPage2();
await drawLine.initModPage(page, true, { customMeetingId : 'draw_line_meeting', customParameter: encodeCustomParams(`userdata-bbb_custom_style=.presentationUploaderToast{display: none;}.currentPresentationToast{display:none;}`) });
await drawLine.initModPage2(true, context, { customParameter: encodeCustomParams(`userdata-bbb_custom_style=.presentationUploaderToast{display: none;}.currentPresentationToast{display:none;}`) });
await drawLine.test();
});
});

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 KiB

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 104 KiB

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 103 KiB

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 109 KiB

After

Width:  |  Height:  |  Size: 107 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 KiB

After

Width:  |  Height:  |  Size: 94 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 KiB

After

Width:  |  Height:  |  Size: 89 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 90 KiB

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 KiB

After

Width:  |  Height:  |  Size: 92 KiB