bigbluebutton-Github/bigbluebutton-html5/tests/puppeteer/screenshare/util.js

37 lines
1.5 KiB
JavaScript
Raw Normal View History

const { ELEMENT_WAIT_TIME, VIDEO_LOADING_WAIT_TIME } = require('../core/constants');
2020-03-12 21:50:54 +08:00
const e = require('../core/elements');
async function startScreenshare(test) {
await test.waitForSelector(e.screenShare, ELEMENT_WAIT_TIME);
2020-03-12 21:50:54 +08:00
await test.click(e.screenShare, true);
}
async function getTestElement(element) {
(await document.querySelectorAll(element)[0]) !== null;
}
async function waitForScreenshareContainer(test) {
await test.waitForSelector(e.screenshareConnecting, ELEMENT_WAIT_TIME);
await test.waitForSelector(e.screenShareVideo, VIDEO_LOADING_WAIT_TIME);
}
2020-03-12 21:50:54 +08:00
async function getScreenShareContainer(test) {
await test.waitForSelector(e.screenShareVideo, VIDEO_LOADING_WAIT_TIME);
const screenShareContainer = await test.page.evaluate(getTestElement, e.screenShareVideo);
const response = screenShareContainer !== null;
return response;
}
async function getScreenShareBreakoutContainer(test) {
await test.waitForSelector(e.screenshareConnecting, { timeout: VIDEO_LOADING_WAIT_TIME });
await test.waitForSelector(e.screenShareVideo, { timeout: VIDEO_LOADING_WAIT_TIME });
const screenShareContainer = await test.evaluate(getTestElement, e.screenShareVideo);
2020-03-12 21:50:54 +08:00
const response = screenShareContainer !== null;
return response;
}
exports.getScreenShareBreakoutContainer = getScreenShareBreakoutContainer;
2020-03-12 21:50:54 +08:00
exports.getScreenShareContainer = getScreenShareContainer;
exports.getTestElement = getTestElement;
exports.startScreenshare = startScreenshare;
exports.waitForScreenshareContainer = waitForScreenshareContainer;