bigbluebutton-Github/bigbluebutton-tests/playwright/presentation/util.js

33 lines
1.2 KiB
JavaScript
Raw Normal View History

2021-11-27 03:04:28 +08:00
const { expect } = require('@playwright/test');
2021-11-26 02:23:58 +08:00
const path = require('path');
const e = require('../core/elements');
const { ELEMENT_WAIT_LONGER_TIME } = require('../core/constants');
2021-11-27 03:04:28 +08:00
async function checkSvgIndex(test, element) {
2021-12-02 13:30:38 +08:00
const check = await test.page.evaluate(([el]) => {
return document.querySelector('svg g g g').outerHTML.indexOf(el) !== -1;
2021-11-27 03:04:28 +08:00
}, [element]);
await expect(check).toBeTruthy();
}
function getSvgOuterHtml() {
return document.querySelector('svg g g g').outerHTML;
}
2021-11-26 02:23:58 +08:00
async function uploadPresentation(test, fileName, uploadTimeout = ELEMENT_WAIT_LONGER_TIME) {
await test.waitAndClick(e.actions);
2022-01-20 21:03:18 +08:00
await test.waitAndClick(e.managePresentations);
2021-11-26 02:23:58 +08:00
await test.waitForSelector(e.fileUpload);
await test.page.setInputFiles(e.fileUpload, path.join(__dirname, `../core/media/${fileName}`));
2022-01-20 21:03:18 +08:00
await test.hasText('body', e.statingUploadPresentationToast);
2021-11-26 02:23:58 +08:00
2022-01-20 21:03:18 +08:00
await test.waitAndClick(e.confirmManagePresentation);
2022-06-08 02:52:22 +08:00
await test.hasText(e.presentationStatusInfo, e.convertingPresentationFileToast, uploadTimeout);
await test.hasText(e.smallToastMsg, e.presentationUploadedToast, uploadTimeout);
2021-11-26 02:23:58 +08:00
}
2021-11-27 03:04:28 +08:00
exports.checkSvgIndex = checkSvgIndex;
exports.getSvgOuterHtml = getSvgOuterHtml;
2021-12-04 01:01:36 +08:00
exports.uploadPresentation = uploadPresentation;