Merge pull request #19965 from gabriellpr/polls-avoid-not-test

test: Avoid presentation notifications on polling tests
This commit is contained in:
Ramón Souza 2024-04-10 13:48:43 -03:00 committed by GitHub
commit 11af2b4aed
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 26 additions and 8 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);
@ -308,10 +309,10 @@ class Polling extends MultiUsers {
}
async pollResultsInDifferentPresentation() {
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.hasElement(e.quickPoll);
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;