2021-11-27 04:01:41 +08:00
|
|
|
const { expect } = require('@playwright/test');
|
|
|
|
const Page = require('../core/page');
|
|
|
|
const e = require('../core/elements');
|
2021-12-02 12:12:14 +08:00
|
|
|
const { webcamContentCheck } = require('./util');
|
2021-11-27 04:01:41 +08:00
|
|
|
const { VIDEO_LOADING_WAIT_TIME } = require('../core/constants');
|
|
|
|
|
|
|
|
class Webcam extends Page {
|
|
|
|
constructor(browser, page) {
|
|
|
|
super(browser, page);
|
|
|
|
}
|
|
|
|
|
|
|
|
async share() {
|
|
|
|
const parsedSettings = await this.getSettingsYaml();
|
|
|
|
const videoPreviewTimeout = parseInt(parsedSettings.public.kurento.gUMTimeout);
|
2022-01-29 03:52:22 +08:00
|
|
|
await this.shareWebcam(videoPreviewTimeout);
|
2021-11-27 04:01:41 +08:00
|
|
|
|
|
|
|
await this.hasElement('video');
|
|
|
|
}
|
|
|
|
|
|
|
|
async checksContent() {
|
|
|
|
const parsedSettings = await this.getSettingsYaml();
|
|
|
|
const videoPreviewTimeout = parseInt(parsedSettings.public.kurento.gUMTimeout);
|
|
|
|
|
2022-01-29 03:52:22 +08:00
|
|
|
await this.shareWebcam(videoPreviewTimeout);
|
2021-12-02 12:12:14 +08:00
|
|
|
const respUser = await webcamContentCheck(this);
|
2021-11-27 04:01:41 +08:00
|
|
|
|
|
|
|
await expect(respUser).toBeTruthy();
|
|
|
|
}
|
|
|
|
|
|
|
|
async talkingIndicator() {
|
|
|
|
await this.webcamLayoutStart();
|
2022-02-03 08:05:26 +08:00
|
|
|
await this.waitForSelector(e.webcamContainer, VIDEO_LOADING_WAIT_TIME);
|
2021-11-27 04:01:41 +08:00
|
|
|
await this.waitForSelector(e.leaveVideo, VIDEO_LOADING_WAIT_TIME);
|
|
|
|
await this.waitForSelector(e.isTalking);
|
|
|
|
await this.hasElement(e.webcamItemTalkingUser);
|
|
|
|
}
|
|
|
|
|
|
|
|
async webcamLayoutStart() {
|
|
|
|
await this.joinMicrophone();
|
|
|
|
const parsedSettings = await this.getSettingsYaml();
|
|
|
|
const videoPreviewTimeout = parseInt(parsedSettings.public.kurento.gUMTimeout);
|
2022-01-29 03:52:22 +08:00
|
|
|
await this.shareWebcam(videoPreviewTimeout);
|
2021-11-27 04:01:41 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-02 12:12:14 +08:00
|
|
|
exports.Webcam = Webcam;
|