Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Reference screenshots update #17555

Merged
merged 7 commits into from Apr 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 6 additions & 6 deletions bigbluebutton-tests/playwright/presentation/presentation.js
Expand Up @@ -6,7 +6,7 @@ const { checkSvgIndex, getSlideOuterHtml, uploadSinglePresentation, uploadMultip
const { ELEMENT_WAIT_LONGER_TIME, ELEMENT_WAIT_EXTRA_LONG_TIME, UPLOAD_PDF_WAIT_TIME } = require('../core/constants');
const { sleep } = require('../core/helpers');
const { getSettings } = require('../core/settings');
const { waitAndClearDefaultPresentationNotification } = require('../notifications/util');
const { waitAndClearDefaultPresentationNotification, waitAndClearNotification } = require('../notifications/util');

class Presentation extends MultiUsers {
constructor(browser, context) {
Expand Down Expand Up @@ -133,9 +133,9 @@ class Presentation extends MultiUsers {
await this.modPage.waitAndClick(e.confirmManagePresentation);

await this.modPage.wasRemoved(e.whiteboard);
await this.modPage.hasElementDisabled(e.minimizePresentation);
await this.modPage.wasRemoved(e.minimizePresentation);
await this.userPage.wasRemoved(e.whiteboard);
await this.userPage.hasElementDisabled(e.minimizePresentation);
await this.userPage.wasRemoved(e.minimizePresentation);
}

async uploadAndRemoveAllPresentations() {
Expand All @@ -155,9 +155,9 @@ class Presentation extends MultiUsers {
await this.modPage.waitAndClick(e.confirmManagePresentation);

await this.modPage.wasRemoved(e.whiteboard);
await this.modPage.hasElementDisabled(e.minimizePresentation);
await this.modPage.wasRemoved(e.minimizePresentation);
await this.userPage.wasRemoved(e.whiteboard);
await this.userPage.hasElementDisabled(e.minimizePresentation);
await this.userPage.wasRemoved(e.minimizePresentation);

// Check removed presentations inside the Manage Presentations
await this.modPage.waitAndClick(e.actions);
Expand All @@ -175,7 +175,6 @@ class Presentation extends MultiUsers {
}

async removePreviousPresentationFromPreviousPresenter() {
await waitAndClearDefaultPresentationNotification(this.modPage);
await uploadSinglePresentation(this.modPage, e.uploadPresentationFileName);

const modSlides1 = await getSlideOuterHtml(this.modPage);
Expand Down Expand Up @@ -222,6 +221,7 @@ class Presentation extends MultiUsers {

async presentationSnapshot(testInfo) {
await this.modPage.waitForSelector(e.whiteboard, ELEMENT_WAIT_LONGER_TIME);
await waitAndClearNotification(this.modPage);
await this.modPage.waitAndClick(e.whiteboardOptionsButton);
const presentationSnapshotLocator = this.modPage.getLocator(e.presentationSnapshot);
await this.modPage.handleDownload(presentationSnapshotLocator, testInfo);
Expand Down
Expand Up @@ -8,19 +8,19 @@ test.describe.parallel('Shared Notes', () => {
await sharedNotes.openSharedNotes();
});
test('Type in shared notes', async ({ browser, page, context }) => {
// https://docs.bigbluebutton.org/2.5/release-tests.html#using-shared-notes-panel
// https://docs.bigbluebutton.org/2.6/release-tests.html#using-shared-notes-panel
const sharedNotes = new SharedNotes(browser, context);
await sharedNotes.initModPage(page);
await sharedNotes.typeInSharedNotes();
});
test('Formate text in shared notes', async ({ browser, page, context }) => {
// https://docs.bigbluebutton.org/2.5/release-tests.html#using-shared-notes-formatting-tools
// https://docs.bigbluebutton.org/2.6/release-tests.html#using-shared-notes-formatting-tools
const sharedNotes = new SharedNotes(browser, context);
await sharedNotes.initModPage(page);
await sharedNotes.formatTextInSharedNotes();
});
test('Export shared notes', async ({ browser, page, context }, testInfo) => {
// https://docs.bigbluebutton.org/2.5/release-tests.html#exporting-shared-notes
// https://docs.bigbluebutton.org/2.6/release-tests.html#exporting-shared-notes
const sharedNotes = new SharedNotes(browser, context);
await sharedNotes.initModPage(page);
await sharedNotes.exportSharedNotes(testInfo);
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion bigbluebutton-tests/playwright/sharednotes/util.js
Expand Up @@ -8,7 +8,7 @@ async function startSharedNotes(test) {
}

function getNotesLocator(test) {
return test.page.frameLocator(e.etherpadFrame)
return test.page.frameLocator(e.etherpadFrame).last()
.frameLocator(e.etherpadOuter)
.frameLocator(e.etherpadInner)
.locator(e.etherpadEditable);
Expand Down
41 changes: 20 additions & 21 deletions bigbluebutton-tests/playwright/whiteboard/changeStyles.js
Expand Up @@ -2,7 +2,6 @@ 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) {
Expand All @@ -12,11 +11,10 @@ class ChangeStyles extends MultiUsers {
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 modWbLocator = this.modPage.getLocator(e.whiteboard);
const wbBox = await modWbLocator.boundingBox();
const screenshotOptions = {
maxDiffPixelRatio: 0.05,
clip: clipObj,
};

await this.modPage.waitAndClick(e.wbShapesButton);
Expand All @@ -31,19 +29,19 @@ class ChangeStyles extends MultiUsers {
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(modWbLocator).toHaveScreenshot('moderator-change-color.png', screenshotOptions);

await expect(this.userPage.page).toHaveScreenshot('viewer-change-color.png', screenshotOptions);
const userWbLocator = this.userPage.getLocator(e.whiteboard);
await expect(userWbLocator).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 modWbLocator = this.modPage.getLocator(e.whiteboard);
const wbBox = await modWbLocator.boundingBox();
const screenshotOptions = {
maxDiffPixelRatio: 0.05,
clip: clipObj,
};

await this.modPage.waitAndClick(e.wbShapesButton);
Expand All @@ -58,19 +56,19 @@ class ChangeStyles extends MultiUsers {
await this.modPage.waitAndClick(e.wbFillDrawing);
await this.modPage.press('Escape');

await expect(this.modPage.page).toHaveScreenshot('moderator1-fill-drawing.png', screenshotOptions);
await expect(modWbLocator).toHaveScreenshot('moderator-fill-drawing.png', screenshotOptions);

await expect(this.userPage.page).toHaveScreenshot('viewer-fill-drawing.png', screenshotOptions);
const userWbLocator = this.userPage.getLocator(e.whiteboard);
await expect(userWbLocator).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 modWbLocator = this.modPage.getLocator(e.whiteboard);
const wbBox = await modWbLocator.boundingBox();
const screenshotOptions = {
maxDiffPixelRatio: 0.05,
clip: clipObj,
};

await this.modPage.waitAndClick(e.wbShapesButton);
Expand All @@ -85,19 +83,19 @@ class ChangeStyles extends MultiUsers {
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.modPage.page).toHaveScreenshot('moderator-dash-drawing.png', screenshotOptions);

await expect(this.userPage.page).toHaveScreenshot('viewer-dash-drawing.png', screenshotOptions);
const userWbLocator = this.userPage.getLocator(e.whiteboard);
await expect(userWbLocator).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 modWbLocator = this.modPage.getLocator(e.whiteboard);
const wbBox = await modWbLocator.boundingBox();
const screenshotOptions = {
maxDiffPixelRatio: 0.05,
clip: clipObj,
};

await this.modPage.waitAndClick(e.wbShapesButton);
Expand All @@ -112,9 +110,10 @@ class ChangeStyles extends MultiUsers {
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.modPage.page).toHaveScreenshot('moderator-size-drawing.png', screenshotOptions);

await expect(this.userPage.page).toHaveScreenshot('viewer-size-drawing.png', screenshotOptions);
const userWbLocator = this.userPage.getLocator(e.whiteboard);
await expect(userWbLocator).toHaveScreenshot('viewer-size-drawing.png', screenshotOptions);
}
}

Expand Down
14 changes: 6 additions & 8 deletions bigbluebutton-tests/playwright/whiteboard/deleteDrawing.js
@@ -1,9 +1,7 @@
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) {
Expand All @@ -13,11 +11,10 @@ class DeleteDrawing extends MultiUsers {
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 modWbLocator = this.modPage.getLocator(e.whiteboard);
const wbBox = await modWbLocator.boundingBox();
const screenshotOptions = {
maxDiffPixels: 1000,
clip: clipObj,
maxDiffPixelRatio: 0.05,
};

await this.modPage.waitAndClick(e.wbArrowShape);
Expand All @@ -29,9 +26,10 @@ class DeleteDrawing extends MultiUsers {

await this.modPage.waitAndClick(e.wbDelete);

await expect(this.modPage.page).toHaveScreenshot('moderator1-delete-drawing.png', screenshotOptions);
await expect(modWbLocator).toHaveScreenshot('moderator-delete-drawing.png', screenshotOptions);

await expect(this.userPage.page).toHaveScreenshot('viewer-delete-drawing.png', screenshotOptions);
const userWbLocator = this.userPage.getLocator(e.whiteboard);
await expect(userWbLocator).toHaveScreenshot('viewer-delete-drawing.png', screenshotOptions);
}
}

Expand Down
12 changes: 5 additions & 7 deletions bigbluebutton-tests/playwright/whiteboard/drawArrow.js
Expand Up @@ -2,7 +2,6 @@ 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 DrawArrow extends MultiUsers {
constructor(browser, context) {
Expand All @@ -12,11 +11,10 @@ class DrawArrow extends MultiUsers {
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 modWbLocator = this.modPage.getLocator(e.whiteboard);
const wbBox = await modWbLocator.boundingBox();
const screenshotOptions = {
maxDiffPixels: 1000,
clip: clipObj,
};

await this.modPage.waitAndClick(e.wbArrowShape);
Expand All @@ -26,9 +24,9 @@ class DrawArrow 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-arrow.png', screenshotOptions);

await expect(this.modPage2.page).toHaveScreenshot('moderator2-arrow.png', screenshotOptions);
await expect(modWbLocator).toHaveScreenshot('moderator-arrow.png', screenshotOptions);
const userWbLocator = this.userPage.getLocator(e.whiteboard);
await expect(userWbLocator).toHaveScreenshot('viewer-arrow.png', screenshotOptions);
}
}

Expand Down
11 changes: 5 additions & 6 deletions bigbluebutton-tests/playwright/whiteboard/drawEllipse.js
Expand Up @@ -2,7 +2,6 @@ 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 DrawEllipse extends MultiUsers {
constructor(browser, context) {
Expand All @@ -12,11 +11,10 @@ class DrawEllipse extends MultiUsers {
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 modWbLocator = this.modPage.getLocator(e.whiteboard);
const wbBox = await modWbLocator.boundingBox();
const screenshotOptions = {
maxDiffPixelRatio: 0.05,
clip: clipObj,
};

await this.modPage.waitAndClick(e.wbShapesButton);
Expand All @@ -27,9 +25,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 expect(this.modPage.page).toHaveScreenshot('moderator1-ellipse.png', screenshotOptions);
await expect(modWbLocator).toHaveScreenshot('moderator-ellipse.png', screenshotOptions);

await expect(this.modPage2.page).toHaveScreenshot('moderator2-ellipse.png', screenshotOptions);
const userWbLocator = this.userPage.getLocator(e.whiteboard);
await expect(userWbLocator).toHaveScreenshot('viewer-ellipse.png', screenshotOptions);
}
}

Expand Down
11 changes: 5 additions & 6 deletions bigbluebutton-tests/playwright/whiteboard/drawLine.js
Expand Up @@ -2,7 +2,6 @@ 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 DrawLine extends MultiUsers {
constructor(browser, context) {
Expand All @@ -12,11 +11,10 @@ class DrawLine extends MultiUsers {
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 modWbLocator = this.modPage.getLocator(e.whiteboard);
const wbBox = await modWbLocator.boundingBox();
const screenshotOptions = {
maxDiffPixels: 1000,
clip: clipObj,
};

await this.modPage.waitAndClick(e.wbShapesButton);
Expand All @@ -27,9 +25,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 expect(this.modPage.page).toHaveScreenshot('moderator1-line.png', screenshotOptions);
await expect(modWbLocator).toHaveScreenshot('moderator-line.png', screenshotOptions);

await expect(this.modPage2.page).toHaveScreenshot('moderator2-line.png', screenshotOptions);
const userWbLocator = this.userPage.getLocator(e.whiteboard);
await expect(userWbLocator).toHaveScreenshot('viewer-line.png', screenshotOptions);
}
}

Expand Down
11 changes: 5 additions & 6 deletions bigbluebutton-tests/playwright/whiteboard/drawPencil.js
Expand Up @@ -2,7 +2,6 @@ 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 DrawPencil extends MultiUsers {
constructor(browser, context) {
Expand All @@ -12,11 +11,10 @@ class DrawPencil extends MultiUsers {
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 modWbLocator = this.modPage.getLocator(e.whiteboard);
const wbBox = await modWbLocator.boundingBox();
const screenshotOptions = {
maxDiffPixels: 1000,
clip: clipObj,
};

await this.modPage.waitAndClick(e.wbPencilShape);
Expand All @@ -29,9 +27,10 @@ class DrawPencil extends MultiUsers {
await this.modPage.page.mouse.move(wbBox.x + 0.8 * wbBox.width, wbBox.y + 0.4 * wbBox.height, moveOptions);
await this.modPage.page.mouse.up();

await expect(this.modPage.page).toHaveScreenshot('moderator1-pencil.png', screenshotOptions);
await expect(modWbLocator).toHaveScreenshot('moderator-pencil.png', screenshotOptions);

await expect(this.modPage2.page).toHaveScreenshot('moderator2-pencil.png', screenshotOptions);
const userWbLocator = this.userPage.getLocator(e.whiteboard);
await expect(userWbLocator).toHaveScreenshot('viewer-pencil.png', screenshotOptions);
}
}

Expand Down