2020-02-22 02:06:05 +08:00
|
|
|
const Create = require('./create');
|
2021-02-26 23:52:17 +08:00
|
|
|
const utilScreenShare = require('../screenshare/util');
|
2021-09-22 11:51:29 +08:00
|
|
|
const e = require('../core/elements');
|
2021-09-23 04:20:02 +08:00
|
|
|
const { VIDEO_LOADING_WAIT_TIME } = require('../core/constants'); // core constants (Timeouts vars imported)
|
2020-02-22 02:06:05 +08:00
|
|
|
|
|
|
|
class Join extends Create {
|
|
|
|
constructor() {
|
2021-09-23 03:22:47 +08:00
|
|
|
super();
|
2020-02-22 02:06:05 +08:00
|
|
|
}
|
|
|
|
|
2020-06-30 09:25:04 +08:00
|
|
|
// Join Existing Breakoutrooms
|
|
|
|
async join(testName) {
|
2021-09-23 05:03:47 +08:00
|
|
|
await this.joinWithMod2(testName);
|
2020-02-22 02:06:05 +08:00
|
|
|
}
|
|
|
|
|
2020-06-30 09:25:04 +08:00
|
|
|
// Check if User Joined in Breakoutrooms
|
|
|
|
async testJoined(testName) {
|
2021-09-23 05:03:47 +08:00
|
|
|
await this.modPage2.logger('Now executing: ', testName);
|
2021-08-14 01:35:00 +08:00
|
|
|
try {
|
|
|
|
if (testName === 'joinBreakoutroomsWithAudio') {
|
2021-09-23 05:03:47 +08:00
|
|
|
await this.modPage2.logger('logged in to breakout with audio');
|
2020-07-18 03:12:43 +08:00
|
|
|
|
2021-09-23 05:03:47 +08:00
|
|
|
const breakoutUserPage1 = await this.userPage1.getLastTargetPage();
|
|
|
|
await breakoutUserPage1.bringToFront();
|
2020-08-05 02:53:34 +08:00
|
|
|
|
|
|
|
// Talking indicator bar
|
2021-09-23 05:03:47 +08:00
|
|
|
await breakoutUserPage1.waitForSelector(e.talkingIndicator);
|
|
|
|
await breakoutUserPage1.screenshot(testName, '05-breakout-page02-user-joined-with-audio-before-check');
|
2020-08-05 02:53:34 +08:00
|
|
|
|
2021-09-23 05:03:47 +08:00
|
|
|
await this.modPage2.logger('before pages check');
|
2020-07-18 03:12:43 +08:00
|
|
|
|
2021-09-23 05:03:47 +08:00
|
|
|
const resp = await breakoutUserPage1.hasElement(e.isTalking);
|
|
|
|
await breakoutUserPage1.screenshot(testName, '06-breakout-page02-user-joined-with-audio-after-check');
|
2020-07-18 03:12:43 +08:00
|
|
|
|
2021-09-23 05:03:47 +08:00
|
|
|
await this.modPage2.logger('after pages check');
|
2021-08-14 01:35:00 +08:00
|
|
|
return resp === true;
|
|
|
|
} else if (testName === 'joinBreakoutroomsWithVideo') {
|
2021-09-23 05:03:47 +08:00
|
|
|
await this.modPage2.logger('logged in to breakout with video');
|
2020-07-18 03:12:43 +08:00
|
|
|
|
2021-09-23 05:03:47 +08:00
|
|
|
const breakoutUserPage1 = await this.userPage1.getLastTargetPage();
|
|
|
|
await breakoutUserPage1.bringToFront();
|
|
|
|
await breakoutUserPage1.screenshot(testName, '05-breakout-page02-user-joined-with-webcam-success');
|
|
|
|
await this.modPage2.logger('before pages check');
|
2020-07-18 03:12:43 +08:00
|
|
|
|
2021-09-23 05:03:47 +08:00
|
|
|
const resp = await breakoutUserPage1.hasElement(e.videoContainer, true, VIDEO_LOADING_WAIT_TIME);
|
2020-07-18 03:12:43 +08:00
|
|
|
|
2021-09-23 05:03:47 +08:00
|
|
|
await breakoutUserPage1.screenshot(testName, '06-breakout-page02-user-joined-webcam-before-check');
|
|
|
|
await this.modPage2.logger('after pages check');
|
2021-09-23 04:20:02 +08:00
|
|
|
|
2021-08-14 01:35:00 +08:00
|
|
|
return resp === true;
|
|
|
|
} else if (testName === 'joinBreakoutroomsAndShareScreen') {
|
2021-09-23 05:03:47 +08:00
|
|
|
await this.modPage2.logger('logged in to breakout with screenshare');
|
|
|
|
const breakoutUserPage1 = await this.userPage1.getLastTargetPage();
|
|
|
|
await breakoutUserPage1.bringToFront();
|
2021-02-26 23:52:17 +08:00
|
|
|
|
2021-09-23 05:03:47 +08:00
|
|
|
await breakoutUserPage1.screenshot(testName, '05-breakout-page02-user-joined-screenshare-before-check');
|
|
|
|
await this.modPage2.logger('before pages check');
|
|
|
|
const resp = await utilScreenShare.getScreenShareBreakoutContainer(breakoutUserPage1);
|
2021-08-14 01:35:00 +08:00
|
|
|
|
2021-09-23 05:03:47 +08:00
|
|
|
await breakoutUserPage1.screenshot(testName, '06-breakout-page02-user-joined-screenshare-after-check');
|
|
|
|
this.userPage1.logger('after pages check');
|
2021-09-23 04:20:02 +08:00
|
|
|
|
2021-08-14 01:35:00 +08:00
|
|
|
return resp === true;
|
|
|
|
} else {
|
2021-09-23 05:03:47 +08:00
|
|
|
await this.userPage1.page.bringToFront();
|
|
|
|
await this.userPage1.waitForSelector(e.breakoutRoomsItem);
|
|
|
|
await this.userPage1.waitAndClick(e.chatButton);
|
|
|
|
await this.userPage1.waitAndClick(e.breakoutRoomsItem);
|
|
|
|
await this.userPage1.waitForSelector(e.alreadyConnected);
|
2021-09-03 02:31:24 +08:00
|
|
|
|
2021-09-22 21:11:56 +08:00
|
|
|
return true;
|
2021-08-14 01:35:00 +08:00
|
|
|
}
|
2021-08-26 22:13:18 +08:00
|
|
|
} catch (err) {
|
2021-09-23 05:03:47 +08:00
|
|
|
await this.modPage2.logger(err);
|
2021-08-14 01:35:00 +08:00
|
|
|
return false;
|
2020-06-30 09:25:04 +08:00
|
|
|
}
|
2020-02-22 02:06:05 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = exports = Join;
|