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

57 lines
1.7 KiB
JavaScript
Raw Normal View History

2020-03-05 03:00:45 +08:00
const Page = require('../core/page');
const e = require('../core/elements');
2021-08-21 04:33:57 +08:00
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);
await this.shareWebcam(true, videoPreviewTimeout);
return true;
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 this.shareWebcam(true, 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);
2021-10-07 22:29:18 +08:00
const foundTestElement = await this.hasElement(e.webcamItemTalkingUser);
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;