Separate meetings for drawing tests + new way of clearing the default presentation notification

This commit is contained in:
Maxim Khlobystov 2022-09-21 17:51:23 +00:00
parent 975c499cbe
commit 4f6cc4afb2
14 changed files with 26 additions and 8 deletions

View File

@ -62,6 +62,11 @@ 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;
@ -69,5 +74,6 @@ exports.checkNotificationText = checkNotificationText;
exports.checkNotificationIcon = checkNotificationIcon;
exports.enableChatPopup = enableChatPopup;
exports.saveSettings = saveSettings;
exports.clearNotificationIfPresent = clearNotificationIfPresent;
exports.waitAndClearNotification = waitAndClearNotification;
exports.waitAndClearDefaultPresentationNotification = waitAndClearDefaultPresentationNotification;

View File

@ -3,6 +3,7 @@ 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) {
@ -21,9 +22,11 @@ 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 this.modPage2.waitForSelector(e.whiteboard, ELEMENT_WAIT_LONGER_TIME);
await clearNotificationIfPresent(this.modPage2);
await expect(this.modPage2.page).toHaveScreenshot('moderator2-ellipse.png');
}
}

View File

@ -3,6 +3,7 @@ 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) {
@ -21,9 +22,11 @@ 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 this.modPage2.waitForSelector(e.whiteboard, ELEMENT_WAIT_LONGER_TIME);
await clearNotificationIfPresent(this.modPage2);
await expect(this.modPage2.page).toHaveScreenshot('moderator2-line.png');
}
}

View File

@ -3,6 +3,7 @@ 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) {
@ -22,10 +23,12 @@ class DrawRectangle extends MultiUsers {
await this.modPage.page.mouse.up();
await this.modPage.waitForSelector(e.wbDrawnRectangle);
await expect(this.modPage.page).toHaveScreenshot('moderator1-rectangle.png');
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 expect(this.modPage2.page).toHaveScreenshot('moderator2-rectangle.png');
await clearNotificationIfPresent(this.modPage2);
await expect(this.modPage2.page).toHaveScreenshot('moderator2-rectangle.png', { maxDiffPixels: 2000 });
}
}

View File

@ -3,6 +3,7 @@ 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) {
@ -21,10 +22,12 @@ 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 expect(this.modPage.page).toHaveScreenshot('moderator1-triangle.png');
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 expect(this.modPage2.page).toHaveScreenshot('moderator2-triangle.png');
await clearNotificationIfPresent(this.modPage2);
await expect(this.modPage2.page).toHaveScreenshot('moderator2-triangle.png', { maxDiffPixels: 2000 });
}
}

View File

@ -29,28 +29,28 @@ 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 : CUSTOM_MEETING_ID });
await drawRectangle.initModPage(page, true, { customMeetingId : 'draw_rectangle_meeting' });
await drawRectangle.initModPage2();
await drawRectangle.test();
});
test('Draw ellipse', async ({ browser, context, page }) => {
const drawEllipse = new DrawEllipse(browser, context);
await drawEllipse.initModPage(page, true, { customMeetingId : CUSTOM_MEETING_ID });
await drawEllipse.initModPage(page, true, { customMeetingId : 'draw_ellipse_meeting' });
await drawEllipse.initModPage2();
await drawEllipse.test();
});
test('Draw triangle', async ({ browser, context, page }) => {
const drawTriangle = new DrawTriangle(browser, context);
await drawTriangle.initModPage(page, true, { customMeetingId : CUSTOM_MEETING_ID });
await drawTriangle.initModPage(page, true, { customMeetingId : 'draw_triangle_meeting' });
await drawTriangle.initModPage2();
await drawTriangle.test();
});
test('Draw line', async ({ browser, context, page }) => {
const drawLine= new DrawLine(browser, context);
await drawLine.initModPage(page, true, { customMeetingId : CUSTOM_MEETING_ID });
await drawLine.initModPage(page, true, { customMeetingId : 'draw_line_meeting' });
await drawLine.initModPage2();
await drawLine.test();
});

Binary file not shown.

Before

Width:  |  Height:  |  Size: 111 KiB

After

Width:  |  Height:  |  Size: 113 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 105 KiB

After

Width:  |  Height:  |  Size: 106 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 KiB

After

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 111 KiB

After

Width:  |  Height:  |  Size: 111 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 97 KiB

After

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 91 KiB

After

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 KiB

After

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 95 KiB

After

Width:  |  Height:  |  Size: 96 KiB