2021-12-02 12:12:14 +08:00
|
|
|
const { Create } = require('./create');
|
2021-11-30 21:42:57 +08:00
|
|
|
const utilScreenShare = require('../screenshare/util');
|
|
|
|
const e = require('../core/elements');
|
|
|
|
const { ELEMENT_WAIT_LONGER_TIME } = require('../core/constants');
|
2022-06-08 02:52:22 +08:00
|
|
|
const { getSettings } = require('../core/settings');
|
2021-11-30 21:42:57 +08:00
|
|
|
|
|
|
|
class Join extends Create {
|
|
|
|
constructor(browser, context) {
|
|
|
|
super(browser, context);
|
|
|
|
}
|
|
|
|
|
|
|
|
async joinRoom(shouldJoinAudio = false) {
|
2021-12-02 12:12:14 +08:00
|
|
|
await this.userPage.bringToFront();
|
2021-11-30 21:42:57 +08:00
|
|
|
if (shouldJoinAudio) {
|
2021-12-02 12:12:14 +08:00
|
|
|
await this.userPage.waitAndClick(e.joinAudio);
|
|
|
|
await this.userPage.joinMicrophone();
|
2021-11-30 21:42:57 +08:00
|
|
|
}
|
|
|
|
|
2021-12-02 12:12:14 +08:00
|
|
|
await this.userPage.waitAndClick(e.breakoutRoomsItem);
|
|
|
|
await this.userPage.waitAndClick(e.joinRoom1);
|
|
|
|
await this.userPage.waitForSelector(e.alreadyConnected, ELEMENT_WAIT_LONGER_TIME);
|
2021-11-30 21:42:57 +08:00
|
|
|
|
2021-12-02 12:12:14 +08:00
|
|
|
const breakoutUserPage = await this.userPage.getLastTargetPage(this.context);
|
|
|
|
await breakoutUserPage.bringToFront();
|
2021-11-30 21:42:57 +08:00
|
|
|
|
2022-07-02 04:55:32 +08:00
|
|
|
if (shouldJoinAudio) {
|
|
|
|
await this.userPage.waitForSelector(e.joinAudio);
|
|
|
|
} else {
|
|
|
|
await breakoutUserPage.closeAudioModal();
|
|
|
|
}
|
2022-04-21 19:19:08 +08:00
|
|
|
await breakoutUserPage.waitForSelector(e.presentationTitle);
|
2021-12-02 12:12:14 +08:00
|
|
|
return breakoutUserPage;
|
2021-11-30 21:42:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
async joinAndShareWebcam() {
|
|
|
|
const breakoutPage = await this.joinRoom();
|
|
|
|
|
2022-06-08 02:52:22 +08:00
|
|
|
const { videoPreviewTimeout } = getSettings();
|
2022-03-29 21:53:07 +08:00
|
|
|
await breakoutPage.shareWebcam(true, videoPreviewTimeout);
|
2021-11-30 21:42:57 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
async joinAndShareScreen() {
|
|
|
|
const breakoutPage = await this.joinRoom();
|
|
|
|
|
|
|
|
await utilScreenShare.startScreenshare(breakoutPage);
|
|
|
|
}
|
|
|
|
|
|
|
|
async joinWithAudio() {
|
2021-12-02 12:12:14 +08:00
|
|
|
const breakoutUserPage = await this.joinRoom(true);
|
2021-11-30 21:42:57 +08:00
|
|
|
|
2021-12-02 12:12:14 +08:00
|
|
|
await breakoutUserPage.waitForSelector(e.talkingIndicator);
|
|
|
|
await breakoutUserPage.hasElement(e.isTalking);
|
2021-11-30 21:42:57 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-02 12:12:14 +08:00
|
|
|
exports.Join = Join;
|