2021-02-17 04:57:10 +08:00
|
|
|
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) {
|
2021-02-17 04:57:10 +08:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2021-03-31 21:10:57 +08:00
|
|
|
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) {
|
2021-02-17 04:57:10 +08:00
|
|
|
await test.waitForSelector(e.screenShareVideo, VIDEO_LOADING_WAIT_TIME);
|
2021-02-26 23:52:17 +08:00
|
|
|
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 });
|
2020-07-14 03:03:41 +08:00
|
|
|
const screenShareContainer = await test.evaluate(getTestElement, e.screenShareVideo);
|
2020-03-12 21:50:54 +08:00
|
|
|
const response = screenShareContainer !== null;
|
|
|
|
return response;
|
|
|
|
}
|
|
|
|
|
2021-02-26 23:52:17 +08:00
|
|
|
exports.getScreenShareBreakoutContainer = getScreenShareBreakoutContainer;
|
2020-03-12 21:50:54 +08:00
|
|
|
exports.getScreenShareContainer = getScreenShareContainer;
|
|
|
|
exports.getTestElement = getTestElement;
|
|
|
|
exports.startScreenshare = startScreenshare;
|
2021-03-31 21:10:57 +08:00
|
|
|
exports.waitForScreenshareContainer = waitForScreenshareContainer;
|