bigbluebutton-Github/bigbluebutton-tests/puppeteer/webcam/share.js

58 lines
1.8 KiB
JavaScript
Raw Normal View History

2020-03-05 03:00:45 +08:00
const Page = require('../core/page');
const util = require('./util');
const e = require('../core/elements');
2021-08-21 04:33:57 +08:00
const { checkElementLengthDifferentTo } = require('../core/util');
const { VIDEO_LOADING_WAIT_TIME } = require('../core/constants'); // core constants (Timeouts vars imported)
2020-03-05 03:00:45 +08:00
2020-06-25 03:51:20 +08:00
class Share extends Page {
2020-03-05 03:00:45 +08:00
constructor() {
2021-09-23 03:22:47 +08:00
super();
2020-03-27 02:52:15 +08:00
}
async test() {
try {
const parsedSettings = await this.getSettingsYaml();
const videoPreviewTimeout = parseInt(parsedSettings.public.kurento.gUMTimeout);
const response = await util.enableWebcam(this, videoPreviewTimeout);
return response;
2021-08-26 22:13:18 +08:00
} catch (err) {
await this.logger(err);
return false;
}
2020-10-19 01:33:06 +08:00
}
async webcamLayoutStart() {
try {
await this.joinMicrophone();
const parsedSettings = await this.getSettingsYaml();
const videoPreviewTimeout = parseInt(parsedSettings.public.kurento.gUMTimeout);
await util.enableWebcam(this, videoPreviewTimeout);
2021-08-26 22:13:18 +08:00
} catch (err) {
await this.logger(err);
}
2020-10-19 01:33:06 +08:00
}
async webcamLayoutTest(testName) {
try {
await this.waitForSelector(e.webcamVideo, VIDEO_LOADING_WAIT_TIME);
await this.waitForSelector(e.leaveVideo, VIDEO_LOADING_WAIT_TIME);
await this.waitForSelector(e.isTalking);
const foundTestElement = await this.page.evaluate(checkElementLengthDifferentTo, e.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;
}
2021-08-26 22:13:18 +08:00
} catch (err) {
await this.logger(err);
return false;
}
2020-03-27 02:52:15 +08:00
}
2020-03-05 03:00:45 +08:00
}
module.exports = exports = Share;