adding 5 tests for the whiteboard

This commit is contained in:
Gabriel Porfirio 2023-04-12 10:29:25 -03:00
parent 62e9b3a4d6
commit b9d8bef762
52 changed files with 345 additions and 1 deletions

View File

@ -444,6 +444,14 @@ exports.zoomOutButton = 'button[data-test="zoomOutBtn"]';
exports.wbPan = 'button[data-test="panButton"]';
exports.wbEraser = 'button[id="TD-PrimaryTools-Eraser"]';
exports.wbArrowShape = 'button[id="TD-PrimaryTools-ArrowTopRight"]';
exports.wbDelete = 'span[id="TD-Delete"]';
exports.wbUndo = 'button[id="TD-TopPanel-Undo"]';
exports.wbRedo = 'button[id="TD-TopPanel-Redo"]';
exports.wbStyles = 'button[id="TD-Styles"]';
exports.wbColorRed = 'button[id="TD-Styles-Color-Swatch-red"]';
exports.wbFillDrawing = 'button[id="TD-Styles-Fill"]';
exports.wbDashDotted = 'div[id="TD-Styles-Dash-dotted"]';
exports.wbSizeLarge = 'div[id="TD-Styles-Dash-large"]';
// About modal
exports.showAboutModalButton = 'li[data-test="aboutModal"]';

View File

@ -0,0 +1,121 @@
const { expect } = require('@playwright/test');
const e = require('../core/elements');
const { ELEMENT_WAIT_LONGER_TIME } = require('../core/constants');
const { MultiUsers } = require('../user/multiusers');
const { constructClipObj } = require('../core/util');
class ChangeStyles extends MultiUsers {
constructor(browser, context) {
super(browser, context);
}
async changingColor() {
await this.modPage.waitForSelector(e.whiteboard, ELEMENT_WAIT_LONGER_TIME);
const wbBox = await this.modPage.getElementBoundingBox(e.whiteboard);
const clipObj = constructClipObj(wbBox);
const screenshotOptions = {
maxDiffPixelRatio: 0.05,
clip: clipObj,
};
await this.modPage.waitAndClick(e.wbShapesButton);
await this.modPage.waitAndClick(e.wbEllipseShape);
await this.modPage.page.mouse.move(wbBox.x + 0.3 * wbBox.width, wbBox.y + 0.3 * wbBox.height);
await this.modPage.page.mouse.down();
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 this.modPage.waitAndClick(e.wbStyles);
await this.modPage.waitAndClick(e.wbColorRed);
await this.modPage.waitAndClick(e.wbStyles);
await expect(this.modPage.page).toHaveScreenshot('moderator1-change-color.png', screenshotOptions);
await expect(this.userPage.page).toHaveScreenshot('viewer-change-color.png', screenshotOptions);
}
async fillDrawing() {
await this.modPage.waitForSelector(e.whiteboard, ELEMENT_WAIT_LONGER_TIME);
const wbBox = await this.modPage.getElementBoundingBox(e.whiteboard);
const clipObj = constructClipObj(wbBox);
const screenshotOptions = {
maxDiffPixelRatio: 0.05,
clip: clipObj,
};
await this.modPage.waitAndClick(e.wbShapesButton);
await this.modPage.waitAndClick(e.wbEllipseShape);
await this.modPage.page.mouse.move(wbBox.x + 0.3 * wbBox.width, wbBox.y + 0.3 * wbBox.height);
await this.modPage.page.mouse.down();
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 this.modPage.waitAndClick(e.wbStyles);
await this.modPage.waitAndClick(e.wbFillDrawing);
await this.modPage.press('Escape');
await expect(this.modPage.page).toHaveScreenshot('moderator1-fill-drawing.png', screenshotOptions);
await expect(this.userPage.page).toHaveScreenshot('viewer-fill-drawing.png', screenshotOptions);
}
async dashDrawing() {
await this.modPage.waitForSelector(e.whiteboard, ELEMENT_WAIT_LONGER_TIME);
const wbBox = await this.modPage.getElementBoundingBox(e.whiteboard);
const clipObj = constructClipObj(wbBox);
const screenshotOptions = {
maxDiffPixelRatio: 0.05,
clip: clipObj,
};
await this.modPage.waitAndClick(e.wbShapesButton);
await this.modPage.waitAndClick(e.wbEllipseShape);
await this.modPage.page.mouse.move(wbBox.x + 0.3 * wbBox.width, wbBox.y + 0.3 * wbBox.height);
await this.modPage.page.mouse.down();
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 this.modPage.waitAndClick(e.wbStyles);
await this.modPage.waitAndClick(e.wbDashDotted);
await this.modPage.waitAndClick(e.wbStyles);
await expect(this.modPage.page).toHaveScreenshot('moderator1-dash-drawing.png', screenshotOptions);
await expect(this.userPage.page).toHaveScreenshot('viewer-dash-drawing.png', screenshotOptions);
}
async sizeDrawing() {
await this.modPage.waitForSelector(e.whiteboard, ELEMENT_WAIT_LONGER_TIME);
const wbBox = await this.modPage.getElementBoundingBox(e.whiteboard);
const clipObj = constructClipObj(wbBox);
const screenshotOptions = {
maxDiffPixelRatio: 0.05,
clip: clipObj,
};
await this.modPage.waitAndClick(e.wbShapesButton);
await this.modPage.waitAndClick(e.wbEllipseShape);
await this.modPage.page.mouse.move(wbBox.x + 0.3 * wbBox.width, wbBox.y + 0.3 * wbBox.height);
await this.modPage.page.mouse.down();
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 this.modPage.waitAndClick(e.wbStyles);
await this.modPage.waitAndClick(e.wbSizeLarge);
await this.modPage.waitAndClick(e.wbStyles);
await expect(this.modPage.page).toHaveScreenshot('moderator1-size-drawing.png', screenshotOptions);
await expect(this.userPage.page).toHaveScreenshot('viewer-size-drawing.png', screenshotOptions);
}
}
exports.ChangeStyles = ChangeStyles;

View File

@ -0,0 +1,38 @@
const { expect } = require('@playwright/test');
const Page = require('../core/page');
const e = require('../core/elements');
const { ELEMENT_WAIT_LONGER_TIME } = require('../core/constants');
const { MultiUsers } = require('../user/multiusers');
const { constructClipObj } = require('../core/util');
class DeleteDrawing extends MultiUsers {
constructor(browser, page) {
super(browser, page);
}
async test() {
await this.modPage.waitForSelector(e.whiteboard, ELEMENT_WAIT_LONGER_TIME);
const wbBox = await this.modPage.getElementBoundingBox(e.whiteboard);
const clipObj = constructClipObj(wbBox);
const screenshotOptions = {
maxDiffPixels: 1000,
clip: clipObj,
};
await this.modPage.waitAndClick(e.wbArrowShape);
await this.modPage.page.mouse.move(wbBox.x + 0.3 * wbBox.width, wbBox.y + 0.3 * wbBox.height);
await this.modPage.page.mouse.down();
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 this.modPage.waitAndClick(e.wbDelete);
await expect(this.modPage.page).toHaveScreenshot('moderator1-delete-drawing.png', screenshotOptions);
await expect(this.userPage.page).toHaveScreenshot('viewer-delete-drawing.png', screenshotOptions);
}
}
exports.DeleteDrawing = DeleteDrawing;

View File

@ -15,7 +15,7 @@ class DrawEllipse extends MultiUsers {
const wbBox = await this.modPage.getElementBoundingBox(e.whiteboard);
const clipObj = constructClipObj(wbBox);
const screenshotOptions = {
maxDiffPixels: 1000,
maxDiffPixelRatio: 0.05,
clip: clipObj,
};

View File

@ -0,0 +1,39 @@
const { expect } = require('@playwright/test');
const e = require('../core/elements');
const { ELEMENT_WAIT_LONGER_TIME } = require('../core/constants');
const { MultiUsers } = require('../user/multiusers');
const { constructClipObj } = require('../core/util');
class RealTimeText extends MultiUsers {
constructor(browser, context) {
super(browser, context);
}
async realTimeTextTyping() {
await this.modPage.waitForSelector(e.whiteboard, ELEMENT_WAIT_LONGER_TIME);
const wbBox = await this.modPage.getElementBoundingBox(e.whiteboard);
const clipObj = constructClipObj(wbBox);
const screenshotOptions = {
maxDiffPixelRatio: 0.05,
clip: clipObj,
};
await this.modPage.waitAndClick(e.wbTextShape);
await this.modPage.page.mouse.click(wbBox.x + 0.3 * wbBox.width, wbBox.y + 0.3 * wbBox.height);
await this.modPage.press('A');
await expect(this.modPage.page).toHaveScreenshot('moderator1-realtime-text.png', screenshotOptions);
await expect(this.userPage.page).toHaveScreenshot('viewer-realtime-text.png', screenshotOptions);
await this.modPage.press('A');
await this.modPage.page.mouse.click(wbBox.x + 0.6 * wbBox.width, wbBox.y + 0.6 * wbBox.height);
await expect(this.modPage.page).toHaveScreenshot('moderator1-realtime-text-2.png', screenshotOptions);
await expect(this.userPage.page).toHaveScreenshot('viewer-realtime-text-2.png', screenshotOptions);
}
}
exports.RealTimeText = RealTimeText;

View File

@ -0,0 +1,39 @@
const { expect } = require('@playwright/test');
const Page = require('../core/page');
const e = require('../core/elements');
const { ELEMENT_WAIT_LONGER_TIME } = require('../core/constants');
const { MultiUsers } = require('../user/multiusers');
const { constructClipObj } = require('../core/util');
class RedoDrawing extends MultiUsers {
constructor(browser, page) {
super(browser, page);
}
async test() {
await this.modPage.waitForSelector(e.whiteboard, ELEMENT_WAIT_LONGER_TIME);
const wbBox = await this.modPage.getElementBoundingBox(e.whiteboard);
const clipObj = constructClipObj(wbBox);
const screenshotOptions = {
maxDiffPixels: 1000,
clip: clipObj,
};
await this.modPage.waitAndClick(e.wbArrowShape);
await this.modPage.page.mouse.move(wbBox.x + 0.3 * wbBox.width, wbBox.y + 0.3 * wbBox.height);
await this.modPage.page.mouse.down();
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 this.modPage.waitAndClick(e.wbUndo);
await this.modPage.waitAndClick(e.wbRedo);
await expect(this.modPage.page).toHaveScreenshot('moderator1-redo-drawing.png', screenshotOptions);
await expect(this.userPage.page).toHaveScreenshot('viewer-redo-drawing.png', screenshotOptions);
}
}
exports.RedoDrawing = RedoDrawing;

View File

@ -0,0 +1,38 @@
const { expect } = require('@playwright/test');
const Page = require('../core/page');
const e = require('../core/elements');
const { ELEMENT_WAIT_LONGER_TIME } = require('../core/constants');
const { MultiUsers } = require('../user/multiusers');
const { constructClipObj } = require('../core/util');
class UndoDrawing extends MultiUsers {
constructor(browser, page) {
super(browser, page);
}
async test() {
await this.modPage.waitForSelector(e.whiteboard, ELEMENT_WAIT_LONGER_TIME);
const wbBox = await this.modPage.getElementBoundingBox(e.whiteboard);
const clipObj = constructClipObj(wbBox);
const screenshotOptions = {
maxDiffPixels: 1000,
clip: clipObj,
};
await this.modPage.waitAndClick(e.wbArrowShape);
await this.modPage.page.mouse.move(wbBox.x + 0.3 * wbBox.width, wbBox.y + 0.3 * wbBox.height);
await this.modPage.page.mouse.down();
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 this.modPage.waitAndClick(e.wbUndo);
await expect(this.modPage.page).toHaveScreenshot('moderator-undo-drawing.png', screenshotOptions);
await expect(this.userPage.page).toHaveScreenshot('viewer-undo-drawing.png', screenshotOptions);
}
}
exports.UndoDrawing = UndoDrawing;

View File

@ -14,6 +14,11 @@ const { DrawArrow } = require('./drawArrow');
const { MultiUsers } = require('../user/multiusers');
const { encodeCustomParams } = require('../customparameters/util');
const { PARAMETER_HIDE_PRESENTATION_TOAST } = require('../core/constants');
const { DeleteDrawing } = require('./deleteDrawing');
const { UndoDrawing } = require('./undoDraw');
const { RedoDrawing } = require('./redoDraw');
const { ChangeStyles } = require('./changeStyles');
const { RealTimeText } = require('./realTimeText');
const hidePresentationToast = encodeCustomParams(PARAMETER_HIDE_PRESENTATION_TOAST);
@ -113,4 +118,60 @@ test.describe.parallel('Whiteboard tools - visual regression', () => {
await drawArrow.initModPage2(true, context, { customParameter: hidePresentationToast });
await drawArrow.test();
});
test('Delete drawing', async ({ browser, context, page }) => {
const deleteDrawing = new DeleteDrawing(browser, context);
await deleteDrawing.initModPage(page, true, { customMeetingId: 'draw_line_meeting', customParameter: hidePresentationToast });
await deleteDrawing.initUserPage(true, context, { customParameter: hidePresentationToast });
await deleteDrawing.test();
});
test('Undo drawing', async ({ browser, context, page }) => {
const undoDrawing = new UndoDrawing(browser, context);
await undoDrawing.initModPage(page, true, { customMeetingId: 'draw_line_meeting', customParameter: hidePresentationToast });
await undoDrawing.initUserPage(true, context, { customParameter: hidePresentationToast });
await undoDrawing.test();
});
test('Redo drawing', async ({ browser, context, page }) => {
const redoDrawing = new RedoDrawing(browser, context);
await redoDrawing.initModPage(page, true, { customMeetingId: 'draw_line_meeting', customParameter: hidePresentationToast });
await redoDrawing.initUserPage(true, context, { customParameter: hidePresentationToast });
await redoDrawing.test();
});
test('Change color', async ({ browser, context, page }) => {
const changeColor = new ChangeStyles(browser, context);
await changeColor.initModPage(page, true, { customMeetingId: 'draw_line_meeting', customParameter: hidePresentationToast });
await changeColor.initUserPage(true, context, { customParameter: hidePresentationToast });
await changeColor.changingColor();
});
test('Fill drawing', async ({ browser, context, page }) => {
const fillDrawing = new ChangeStyles(browser, context);
await fillDrawing.initModPage(page, true, { customMeetingId: 'draw_line_meeting', customParameter: hidePresentationToast });
await fillDrawing.initUserPage(true, context, { customParameter: hidePresentationToast });
await fillDrawing.fillDrawing();
});
test('Dash drawing', async ({ browser, context, page }) => {
const dashDrawing = new ChangeStyles(browser, context);
await dashDrawing.initModPage(page, true, { customMeetingId: 'draw_line_meeting', customParameter: hidePresentationToast });
await dashDrawing.initUserPage(true, context, { customParameter: hidePresentationToast });
await dashDrawing.dashDrawing();
});
test('Size drawing', async ({ browser, context, page }) => {
const sizeDrawing = new ChangeStyles(browser, context);
await sizeDrawing.initModPage(page, true, { customMeetingId: 'draw_line_meeting', customParameter: hidePresentationToast });
await sizeDrawing.initUserPage(true, context, { customParameter: hidePresentationToast });
await sizeDrawing.sizeDrawing();
});
test('Real time text typing', async ({ browser, context, page }) => {
const realTimeText = new RealTimeText(browser, context);
await realTimeText.initModPage(page, true, { customMeetingId: 'draw_line_meeting', customParameter: hidePresentationToast });
await realTimeText.initUserPage(true, context, { customParameter: hidePresentationToast });
await realTimeText.realTimeTextTyping();
});
});

Binary file not shown.

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 51 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 54 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 41 KiB