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: fix polling results tests #19709

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ test.describe.parallel('Notifications', () => {
});

test.describe.parallel('Presenter @ci', () => {
test('Poll results notification @flaky', async ({ browser, context, page }) => {
test('Poll results notification', async ({ browser, context, page }) => {
const presenterNotifications = new PresenterNotifications(browser, context);
await presenterNotifications.initModPage(page);
await presenterNotifications.initPages(page, true);
await presenterNotifications.publishPollResults();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ class PresenterNotifications extends MultiUsers {

async publishPollResults() {
await util.waitAndClearDefaultPresentationNotification(this.modPage);
await utilPolling.startPoll(this.modPage, true);
await utilPolling.startPoll(this.modPage);
antonbsa marked this conversation as resolved.
Show resolved Hide resolved
await this.userPage.waitAndClick(e.pollAnswerOptionBtn);
await this.modPage.hasElementEnabled(e.publishPollingLabel);
await this.modPage.waitAndClick(e.publishPollingLabel);
await this.modPage.waitForSelector(e.smallToastMsg);
await util.checkNotificationText(this.modPage, e.pollPublishedToast);
}
Expand Down
21 changes: 17 additions & 4 deletions bigbluebutton-tests/playwright/polling/poll.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Polling extends MultiUsers {

async pollAnonymous() {
await this.modPage.waitForSelector(e.whiteboard, ELEMENT_WAIT_LONGER_TIME);
await util.startPoll(this.modPage, false, true);
await util.startPoll(this.modPage, true);
await this.modPage.waitForSelector(e.publishPollingLabel);
await this.userPage.waitAndClick(e.pollAnswerOptionBtn);
await this.userPage.wasRemoved(e.receivedAnswer);
Expand Down Expand Up @@ -254,7 +254,11 @@ class Polling extends MultiUsers {
const { pollChatMessage } = getSettings();

await this.modPage.waitForSelector(e.whiteboard, ELEMENT_WAIT_LONGER_TIME);
await util.startPoll(this.modPage, true);
await util.startPoll(this.modPage);
await this.modPage.hasElementDisabled(e.publishPollingLabel);
await this.userPage.waitAndClick(e.pollAnswerOptionBtn);
await this.modPage.hasElement(e.publishPollingLabel);
await this.modPage.waitAndClick(e.publishPollingLabel);

const lastChatPollMessageTextModerator = await this.modPage.getLocator(e.chatPollMessageText).last();
if(!pollChatMessage) {
Expand All @@ -267,14 +271,20 @@ class Polling extends MultiUsers {

async pollResultsOnWhiteboard() {
await this.modPage.waitForSelector(e.whiteboard, ELEMENT_WAIT_LONGER_TIME);
await util.startPoll(this.modPage, true);
await util.startPoll(this.modPage);

await this.modPage.hasElementDisabled(e.publishPollingLabel);
await this.userPage.waitAndClick(e.pollAnswerOptionBtn);
await this.modPage.hasElement(e.publishPollingLabel);
await this.modPage.waitAndClick(e.publishPollingLabel);

const wbDrawnRectangleLocator = await this.modPage.getLocator(e.wbDrawnRectangle).last();
await expect(wbDrawnRectangleLocator).toBeVisible({ timeout: ELEMENT_WAIT_TIME});

const modWbLocator = this.modPage.getLocator(e.whiteboard);
const wbBox = await modWbLocator.boundingBox();

await wbDrawnRectangleLocator.click();
await wbDrawnRectangleLocator.dblclick();
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();
Expand All @@ -286,6 +296,9 @@ class Polling extends MultiUsers {
await this.modPage.waitAndClick(e.userListItem);
await this.modPage.waitAndClick(e.makePresenter);

await this.userPage.waitAndClick(e.zoomInButton);
await this.userPage.waitAndClick(e.resetZoomButton);

const wbDrawnRectangleUserLocator = await this.userPage.getLocator(e.wbDrawnRectangle).last();
await wbDrawnRectangleUserLocator.dblclick();
await this.userPage.page.keyboard.type('testUser');
Expand Down
4 changes: 2 additions & 2 deletions bigbluebutton-tests/playwright/polling/polling.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ test.describe('Polling', async () => {
});

// Results
test('Poll results in chat message @ci @flaky', async () => {
test('Poll results in chat message @ci', async () => {
await polling.pollResultsOnChat();
});

test('Poll results on whiteboard @ci @flaky', async () => {
test('Poll results on whiteboard @ci', async () => {
await polling.pollResultsOnWhiteboard();
});

Expand Down
3 changes: 1 addition & 2 deletions bigbluebutton-tests/playwright/polling/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@ async function openPoll(testPage) {
await testPage.waitForSelector(e.pollOptionItem);
}

async function startPoll(test, shouldPublishPoll = false, isAnonymous = false) {
async function startPoll(test, isAnonymous = false) {
await openPoll(test);
if (isAnonymous) await test.getLocator(e.anonymousPoll).setChecked();
await test.waitAndClick(e.startPoll);
if (shouldPublishPoll) await test.waitAndClick(e.publishPollingLabel);
}

exports.openPoll = openPoll;
Expand Down