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

41 lines
1.3 KiB
JavaScript
Raw Normal View History

2020-03-12 21:50:54 +08:00
const Page = require('../core/page');
const util = require('./util');
const e = require('../core/elements');
const { ELEMENT_WAIT_TIME, VIDEO_LOADING_WAIT_TIME } = require('../core/constants');
const { sleep } = require('../core/helper');
2020-03-12 21:50:54 +08:00
class ShareScreen extends Page {
constructor() {
super('share-screen');
}
async test() {
try {
await util.startScreenshare(this);
await this.page.waitForSelector(e.screenshareConnecting, ELEMENT_WAIT_TIME);
await this.page.waitForSelector(e.screenShareVideo, VIDEO_LOADING_WAIT_TIME);
await sleep(5000);
const response = await util.getScreenShareContainer(this);
return response;
2021-08-26 22:13:18 +08:00
} catch (err) {
await this.logger(err);
return false;
}
}
async testMobileDevice(args, testName, deviceX) {
try {
await this.init(args, undefined, undefined, undefined, testName, undefined, deviceX);
await this.startRecording(testName);
await this.closeAudioModal();
const screenshareBtn = await this.page.evaluate(() => document.querySelectorAll('button[aria-label="Share your screen"]').length === 0) === true;
return screenshareBtn;
2021-08-26 22:13:18 +08:00
} catch (err) {
await this.logger(err);
return false;
}
2020-03-12 21:50:54 +08:00
}
}
module.exports = exports = ShareScreen;