bigbluebutton-Github/bigbluebutton-tests/puppeteer/webcam/share.js
2021-08-20 17:33:57 -03:00

43 lines
1.5 KiB
JavaScript

const Page = require('../core/page');
const util = require('./util');
const wle = require('./elements');
const { checkElementLengthDifferentTo } = require('../core/util');
const { VIDEO_LOADING_WAIT_TIME } = require('../core/constants'); // core constants (Timeouts vars imported)
class Share extends Page {
constructor() {
super('webcam-share-test');
}
async test() {
const parsedSettings = await this.getSettingsYaml();
const videoPreviewTimeout = parseInt(parsedSettings.public.kurento.gUMTimeout);
const response = await util.enableWebcam(this, videoPreviewTimeout);
return response;
}
async webcamLayoutStart() {
await this.joinMicrophone();
const parsedSettings = await this.getSettingsYaml();
const videoPreviewTimeout = parseInt(parsedSettings.public.kurento.gUMTimeout);
await util.enableWebcam(this, videoPreviewTimeout);
}
async webcamLayoutTest(testName) {
await this.waitForSelector(wle.webcamVideo, VIDEO_LOADING_WAIT_TIME);
await this.waitForSelector(wle.stopSharingWebcam, VIDEO_LOADING_WAIT_TIME);
const foundTestElement = await this.page.evaluate(checkElementLengthDifferentTo, wle.webcamItemTalkingUser, 0);
if (foundTestElement === true) {
await this.screenshot(`${testName}`, `success-${testName}`);
this.logger(testName, ' passed');
return true;
} else if (foundTestElement === false) {
await this.screenshot(`${testName}`, `fail-${testName}`);
this.logger(testName, ' failed');
return false;
}
}
}
module.exports = exports = Share;