avoid presentation notification on polling tests

This commit is contained in:
Gabriel Porfirio 2024-04-05 13:35:32 -03:00
parent 88b31db097
commit d079e8a942
3 changed files with 25 additions and 7 deletions

View File

@ -2,7 +2,7 @@ const { expect, test } = require('@playwright/test');
const { MultiUsers } = require('../user/multiusers');
const e = require('../core/elements');
const util = require('./util.js');
const { ELEMENT_WAIT_LONGER_TIME, ELEMENT_WAIT_TIME } = require('../core/constants');
const { ELEMENT_WAIT_LONGER_TIME, ELEMENT_WAIT_TIME, ELEMENT_WAIT_EXTRA_LONG_TIME } = require('../core/constants');
const { getSettings } = require('../core/settings');
const { waitAndClearDefaultPresentationNotification } = require('../notifications/util');
const { uploadSinglePresentation, skipSlide } = require('../presentation/util');
@ -36,7 +36,7 @@ class Polling extends MultiUsers {
}
async quickPoll() {
await uploadSinglePresentation(this.modPage, e.questionSlideFileName);
await util.uploadSPresentationForTestingPolls(this.modPage, e.questionSlideFileName);
// The slide needs to be uploaded and converted, so wait a bit longer for this step
await this.modPage.waitAndClick(e.quickPoll, ELEMENT_WAIT_LONGER_TIME);
@ -129,7 +129,8 @@ class Polling extends MultiUsers {
}
async customInput() {
await uploadSinglePresentation(this.modPage, e.uploadPresentationFileName);
await util.uploadSPresentationForTestingPolls(this.modPage, e.uploadPresentationFileName);
await this.modPage.waitForSelector(e.whiteboard, 20000);
await this.modPage.waitAndClick(e.actions);
await this.modPage.waitAndClick(e.polling);
@ -183,11 +184,11 @@ class Polling extends MultiUsers {
async smartSlidesQuestions() {
await this.modPage.hasElement(e.whiteboard, ELEMENT_WAIT_LONGER_TIME);
await uploadSinglePresentation(this.modPage, e.smartSlides1, ELEMENT_WAIT_LONGER_TIME);
await util.uploadSPresentationForTestingPolls(this.modPage, e.smartSlides1);
await this.userPage.hasElement(e.userListItem);
// Type Response
await this.modPage.waitAndClick(e.quickPoll);
await this.modPage.waitAndClick(e.quickPoll, ELEMENT_WAIT_LONGER_TIME);
await this.userPage.hasElement(e.responsePollQuestion);
await this.userPage.type(e.pollAnswerOptionInput, 'test');
await this.userPage.waitAndClick(e.pollSubmitAnswer);
@ -311,7 +312,7 @@ class Polling extends MultiUsers {
await waitAndClearDefaultPresentationNotification(this.modPage);
await util.startPoll(this.modPage);
await this.userPage.waitAndClick(e.pollAnswerOptionBtn);
await uploadSinglePresentation(this.modPage, e.questionSlideFileName);
await util.uploadSPresentationForTestingPolls(this.modPage, e.questionSlideFileName);
await this.modPage.waitAndClick(e.publishPollingLabel);
// Check poll results
await this.modPage.hasElement(e.wbDrawnRectangle);

View File

@ -2,13 +2,17 @@ const { test } = require('../fixtures');
const { fullyParallel } = require('../playwright.config');
const { Polling } = require('./poll');
const { initializePages } = require('../core/helpers');
const { encodeCustomParams } = require('../parameters/util');
const { PARAMETER_HIDE_PRESENTATION_TOAST } = require('../core/constants');
const hidePresentationToast = encodeCustomParams(PARAMETER_HIDE_PRESENTATION_TOAST);
test.describe('Polling', async () => {
const polling = new Polling();
test.describe.configure({ mode: fullyParallel ? 'parallel' : 'serial' });
test[fullyParallel ? 'beforeEach' : 'beforeAll'](async ({ browser }) => {
await initializePages(polling, browser, { isMultiUser: true });
await initializePages(polling, browser, { isMultiUser: true, joinParameter: hidePresentationToast });
});
// Manage

View File

@ -1,6 +1,7 @@
const { test } = require('@playwright/test');
const e = require('../core/elements.js');
const { getSettings } = require('../core/settings.js');
const path = require('path');
async function openPoll(testPage) {
const { pollEnabled } = getSettings();
@ -19,5 +20,17 @@ async function startPoll(test, isAnonymous = false) {
await test.waitAndClick(e.startPoll);
}
async function uploadSPresentationForTestingPolls(test, fileName) {
await test.waitAndClick(e.actions);
await test.waitAndClick(e.managePresentations);
await test.waitForSelector(e.presentationFileUpload);
await test.page.setInputFiles(e.presentationFileUpload, path.join(__dirname, `../core/media/${fileName}`));
await test.hasText('body', e.statingUploadPresentationToast);
await test.waitAndClick(e.confirmManagePresentation);
}
exports.openPoll = openPoll;
exports.startPoll = startPoll;
exports.uploadSPresentationForTestingPolls = uploadSPresentationForTestingPolls;