wip: polling changing to serial mode

This commit is contained in:
Gabriel Porfirio 2023-04-28 09:30:29 -03:00
parent f4eceef8e3
commit 7fe9d74a63
3 changed files with 103 additions and 77 deletions

View File

@ -16,6 +16,8 @@ class Polling extends MultiUsers {
async createPoll() {
await util.startPoll(this.modPage);
await this.modPage.hasElement(e.pollMenuButton);
await this.modPage.waitAndClick(e.closePollingBtn);
}
async pollAnonymous() {
@ -24,6 +26,8 @@ class Polling extends MultiUsers {
await this.modPage.waitForSelector(e.publishPollingLabel);
await this.userPage.waitAndClick(e.pollAnswerOptionBtn);
await this.userPage.wasRemoved(e.receivedAnswer);
await this.modPage.waitAndClick(e.closePollingBtn);
}
async quickPoll() {
@ -35,6 +39,8 @@ class Polling extends MultiUsers {
await this.modPage.waitForSelector(e.pollMenuButton);
await this.userPage.hasElement(e.pollingContainer);
await this.modPage.waitAndClick(e.closePollingBtn);
}
async pollUserResponse() {
@ -56,6 +62,8 @@ class Polling extends MultiUsers {
await this.modPage.hasElement(e.wbDrawnRectangle);
await this.userPage.hasElement(e.wbDrawnRectangle);
await this.modPage.waitAndClick(e.closePollingBtn);
}
async stopPoll() {
@ -64,6 +72,55 @@ class Polling extends MultiUsers {
await this.userPage.waitForSelector(e.pollingContainer);
await this.modPage.waitAndClick(e.cancelPollBtn);
await this.userPage.wasRemoved(e.pollingContainer);
await this.modPage.waitAndClick(e.closePollingBtn);
}
async manageResponseChoices() {
await this.modPage.waitForSelector(e.whiteboard, ELEMENT_WAIT_LONGER_TIME);
await this.startNewPoll();
const initialRespCount = await this.modPage.getSelectorCount(e.pollOptionItem);
// Add
await this.modPage.waitAndClick(e.addPollItem);
await this.typeOnLastChoiceInput();
await this.modPage.waitAndClick(e.startPoll);
await expect(initialRespCount + 1).toEqual(await this.getAnswerOptionCount());
await this.checkLastOptionText();
// Delete
await this.startNewPoll();
await this.modPage.waitAndClick(e.deletePollOption);
await this.modPage.waitAndClick(e.startPoll);
await expect(initialRespCount - 1).toEqual(await this.getAnswerOptionCount());
// Edit
await this.startNewPoll();
await this.typeOnLastChoiceInput();
await this.modPage.waitAndClick(e.startPoll);
await expect(initialRespCount).toEqual(await this.getAnswerOptionCount());
await this.checkLastOptionText();
await this.modPage.waitAndClick(e.closePollingBtn);
await this.modPage.waitAndClick(e.actions);
await this.modPage.waitAndClick(e.managePresentations);
await this.modPage.waitAndClick(e.removePresentation);
await this.modPage.waitAndClick(e.confirmManagePresentation);
}
async notAbleStartNewPollWithoutPresentation() {
await this.modPage.waitAndClick(e.actions);
await this.modPage.waitAndClick(e.managePresentations);
await this.modPage.waitAndClick(e.removePresentation);
await this.modPage.waitAndClick(e.confirmManagePresentation);
await this.modPage.waitAndClick(e.actions);
await this.modPage.waitAndClick(e.polling);
await this.modPage.hasElement(e.noPresentation);
}
async pollResultsOnChat() {
@ -95,34 +152,7 @@ class Polling extends MultiUsers {
await this.modPage.hasElement(e.wbDrawnRectangle);
}
async manageResponseChoices() {
await this.modPage.waitForSelector(e.whiteboard, ELEMENT_WAIT_LONGER_TIME);
await this.startNewPoll();
const initialRespCount = await this.modPage.getSelectorCount(e.pollOptionItem);
// Add
await this.modPage.waitAndClick(e.addPollItem);
await this.typeOnLastChoiceInput();
await this.modPage.waitAndClick(e.startPoll);
await expect(initialRespCount + 1).toEqual(await this.getAnswerOptionCount());
await this.checkLastOptionText();
// Delete
await this.startNewPoll();
await this.modPage.waitAndClick(e.deletePollOption);
await this.modPage.waitAndClick(e.startPoll);
await expect(initialRespCount - 1).toEqual(await this.getAnswerOptionCount());
// Edit
await this.startNewPoll();
await this.typeOnLastChoiceInput();
await this.modPage.waitAndClick(e.startPoll);
await expect(initialRespCount).toEqual(await this.getAnswerOptionCount());
await this.checkLastOptionText();
}
async startNewPoll() {
const hasPollStarted = await this.modPage.checkElement(e.pollMenuButton);
@ -149,16 +179,7 @@ class Polling extends MultiUsers {
await expect(lastOptionText).toHaveText(this.newInputText);
}
async notAbleStartNewPollWithoutPresentation() {
await this.modPage.waitAndClick(e.actions);
await this.modPage.waitAndClick(e.managePresentations);
await this.modPage.waitAndClick(e.removePresentation);
await this.modPage.waitAndClick(e.confirmManagePresentation);
await this.modPage.waitAndClick(e.actions);
await this.modPage.waitAndClick(e.polling);
await this.modPage.hasElement(e.noPresentation);
}
async customInput() {
await this.modPage.waitAndClick(e.actions);

View File

@ -1,46 +1,49 @@
const { test } = require('@playwright/test');
const { Polling } = require('./poll');
test.describe.serial('Polling', () => {
const polling = new Polling();
test.beforeAll(async ({ browser }) => {
const context = await browser.newContext();
const page = await context.newPage();
await polling.initModPage(page, true);
await polling.initUserPage(true, context);
});
// Manage
test('Create poll @ci', async () => {
await polling.createPoll();
});
test('Create anonymous poll @ci', async () => {
await polling.pollAnonymous();
});
test('Create quick poll - from the slide', async () => {
await polling.quickPoll();
});
test('Create poll with user response @ci', async () => {
await polling.pollUserResponse();
});
test('Stop a poll manually @ci', async () => {
await polling.stopPoll();
});
test('Manage response choices', async () => {
await polling.manageResponseChoices();
});
test('Not able to start new poll without presentation', async () => {
await polling.notAbleStartNewPollWithoutPresentation();
});
});
/*
test.describe.parallel('Polling', () => {
test.describe.parallel('Manage', () => {
test('Create Poll @ci', async ({ browser, context, page }) => {
const polling = new Polling(browser, context);
await polling.initPages(page, true);
await polling.createPoll();
});
// https://docs.bigbluebutton.org/2.6/release-tests.html#start-an-anonymous-poll-automated
test('Create anonymous poll @ci', async ({ browser, context, page }) => {
const polling = new Polling(browser, context);
await polling.initPages(page);
await polling.pollAnonymous();
});
// https://docs.bigbluebutton.org/2.6/release-tests.html#quick-poll-option-automated
test('Create quick poll - from the slide', async ({ browser, context, page }) => {
const polling = new Polling(browser, context);
await polling.initPages(page);
await polling.quickPoll();
});
test('Create poll with user response @ci', async ({ browser, context, page }) => {
const polling = new Polling(browser, context);
await polling.initPages(page);
await polling.pollUserResponse();
});
test('Stop a poll manually @ci', async ({ browser, context, page }) => {
const polling = new Polling(browser, context);
await polling.initPages(page);
await polling.stopPoll();
});
test('Manage response choices @ci', async ({ browser, context, page }) => {
const polling = new Polling(browser, context);
await polling.initPages(page);
await polling.manageResponseChoices();
});
test('Not able to start new poll without presentation', async ({ browser, context, page }) => {
const polling = new Polling(browser, context);
await polling.initPages(page);
@ -86,3 +89,4 @@ test.describe.parallel('Polling', () => {
});
});
});
*/

View File

@ -1,5 +1,6 @@
const { test } = require('@playwright/test');
const { ELEMENT_WAIT_LONGER_TIME } = require('../core/constants.js');
const e = require('../core/elements.js');
const { getSettings } = require('../core/settings.js');
@ -16,7 +17,7 @@ async function openPoll(testPage) {
async function startPoll(test, shouldPublishPoll = false, isAnonymous = false) {
await openPoll(test);
if (isAnonymous) await test.waitAndClickElement(e.anonymousPoll);
if (isAnonymous) await test.getLocator(e.anonymousPoll).setChecked();
await test.waitAndClick(e.startPoll);
if (shouldPublishPoll) await test.waitAndClick(e.publishPollingLabel);
}