2021-11-30 21:42:57 +08:00
|
|
|
const e = require('../core/elements');
|
2024-04-16 03:28:53 +08:00
|
|
|
const { VIDEO_LOADING_WAIT_TIME, ELEMENT_WAIT_TIME } = require('../core/constants');
|
|
|
|
const Page = require('../core/page');
|
2021-11-30 21:42:57 +08:00
|
|
|
|
|
|
|
async function startScreenshare(test) {
|
|
|
|
await test.waitAndClick(e.startScreenSharing);
|
2022-08-19 21:04:00 +08:00
|
|
|
await test.waitForSelector(e.screenshareConnecting, VIDEO_LOADING_WAIT_TIME);
|
2021-11-30 21:42:57 +08:00
|
|
|
await test.hasElement(e.screenShareVideo, VIDEO_LOADING_WAIT_TIME);
|
|
|
|
}
|
|
|
|
|
2024-04-16 03:28:53 +08:00
|
|
|
async function getFrame(test, frameSelector) {
|
|
|
|
await test.waitForSelector(frameSelector);
|
|
|
|
const iframeElement = await test.getLocator('iframe').elementHandle();
|
|
|
|
const frame = await iframeElement.contentFrame();
|
|
|
|
await frame.waitForURL(/youtube/, { timeout: ELEMENT_WAIT_TIME });
|
|
|
|
const ytFrame = new Page(test.browser, frame);
|
|
|
|
return ytFrame;
|
|
|
|
}
|
|
|
|
|
2021-12-04 01:01:36 +08:00
|
|
|
exports.startScreenshare = startScreenshare;
|
2024-04-16 03:28:53 +08:00
|
|
|
exports.getFrame = getFrame;
|