test: fix inconsistencies in presentation upload

This commit is contained in:
Anton B 2023-07-19 17:45:30 -03:00
parent 005f911189
commit 52d05adaf9
2 changed files with 6 additions and 6 deletions

View File

@ -69,7 +69,7 @@ class Presentation extends MultiUsers {
await uploadSinglePresentation(this.modPage, e.pdfFileName, UPLOAD_PDF_WAIT_TIME);
// wait until the notifications disappear
await this.modPage.hasElement(e.presentationStatusInfo, ELEMENT_WAIT_LONGER_TIME);
await this.modPage.waitAndClick(e.smallToastMsg);
await this.modPage.wasRemoved(e.smallToastMsg, ELEMENT_WAIT_LONGER_TIME);
await this.userPage.wasRemoved(e.presentationStatusInfo);
await this.userPage.wasRemoved(e.smallToastMsg);
@ -151,8 +151,8 @@ class Presentation extends MultiUsers {
await this.modPage.waitAndClick(e.presentationOptionsDownloadBtn);
await this.modPage.waitAndClick(e.sendPresentationInCurrentStateBtn);
await this.modPage.hasElement(e.downloadPresentationToast);
await this.modPage.hasElement(e.smallToastMsg, ELEMENT_WAIT_LONGER_TIME);
await this.userPage.hasElement(e.downloadPresentation, ELEMENT_WAIT_EXTRA_LONG_TIME);
await this.modPage.hasElement(e.smallToastMsg, ELEMENT_WAIT_EXTRA_LONG_TIME);
await this.userPage.hasElement(e.downloadPresentation);
const downloadPresentationLocator = this.userPage.getLocator(e.downloadPresentation);
await this.userPage.handleDownload(downloadPresentationLocator, testInfo);
}
@ -171,7 +171,6 @@ class Presentation extends MultiUsers {
}
async uploadAndRemoveAllPresentations() {
await waitAndClearDefaultPresentationNotification(this.modPage);
await uploadSinglePresentation(this.modPage, e.uploadPresentationFileName);
const modSlides1 = await getSlideOuterHtml(this.modPage);

View File

@ -1,7 +1,7 @@
const { expect } = require('@playwright/test');
const path = require('path');
const e = require('../core/elements');
const { ELEMENT_WAIT_LONGER_TIME, UPLOAD_PDF_WAIT_TIME } = require('../core/constants');
const { UPLOAD_PDF_WAIT_TIME, ELEMENT_WAIT_EXTRA_LONG_TIME, ELEMENT_WAIT_LONGER_TIME } = require('../core/constants');
async function checkSvgIndex(test, element) {
const check = await test.page.evaluate(([el, slideImg]) => {
@ -32,6 +32,7 @@ async function uploadSinglePresentation(test, fileName, uploadTimeout = UPLOAD_P
await test.hasText('body', e.statingUploadPresentationToast);
await test.waitAndClick(e.confirmManagePresentation);
await test.hasElement(e.presentationStatusInfo, ELEMENT_WAIT_LONGER_TIME);
await test.page.waitForFunction(([selector, firstSlideSrc]) => {
const currentSrc = document.querySelector(selector).src;
return currentSrc != firstSlideSrc;
@ -40,7 +41,7 @@ async function uploadSinglePresentation(test, fileName, uploadTimeout = UPLOAD_P
});
}
async function uploadMultiplePresentations(test, fileNames, uploadTimeout = ELEMENT_WAIT_LONGER_TIME) {
async function uploadMultiplePresentations(test, fileNames, uploadTimeout = ELEMENT_WAIT_EXTRA_LONG_TIME) {
await test.waitAndClick(e.actions);
await test.waitAndClick(e.managePresentations);
await test.waitForSelector(e.fileUpload);