bigbluebutton-Github/bigbluebutton-tests/puppeteer/breakout/join.js

93 lines
3.3 KiB
JavaScript
Raw Normal View History

2020-02-22 02:06:05 +08:00
const Create = require('./create');
const utilScreenShare = require('../screenshare/util');
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
}
// Join Existing Breakoutrooms
async join(testName) {
await this.joinWithUser3(testName);
2020-02-22 02:06:05 +08:00
}
// Check if User Joined in Breakoutrooms
async testJoined(testName) {
await this.page3.logger('Now executing: ', testName);
try {
if (testName === 'joinBreakoutroomsWithAudio') {
await this.page3.logger('logged in to breakout with audio');
2021-09-23 04:20:02 +08:00
const breakoutPage2 = await this.page2.getLastTargetPage();
await breakoutPage2.bringToFront();
// Talking indicator bar
2021-09-23 04:20:02 +08:00
await breakoutPage2.waitForSelector(e.talkingIndicator);
await breakoutPage2.screenshot(testName, '05-breakout-page02-user-joined-with-audio-before-check');
await this.page3.logger('before pages check');
2021-09-23 04:20:02 +08:00
const resp = await breakoutPage2.hasElement(e.isTalking);
await breakoutPage2.screenshot(testName, '06-breakout-page02-user-joined-with-audio-after-check');
await this.page3.logger('after pages check');
return resp === true;
} else if (testName === 'joinBreakoutroomsWithVideo') {
await this.page3.logger('logged in to breakout with video');
2021-09-23 04:20:02 +08:00
const breakoutPage2 = await this.page2.getLastTargetPage();
await breakoutPage2.bringToFront();
await breakoutPage2.screenshot(testName, '05-breakout-page02-user-joined-with-webcam-success');
await this.page3.logger('before pages check');
2021-09-23 04:20:02 +08:00
// aqui
const resp = await breakoutPage2.hasElement(e.videoContainer, true, VIDEO_LOADING_WAIT_TIME);
2021-09-23 04:20:02 +08:00
await breakoutPage2.screenshot(testName, '06-breakout-page02-user-joined-webcam-before-check');
await this.page3.logger('after pages check');
2021-09-23 04:20:02 +08:00
return resp === true;
} else if (testName === 'joinBreakoutroomsAndShareScreen') {
await this.page3.logger('logged in to breakout with screenshare');
2021-09-23 04:20:02 +08:00
const breakoutPage2 = await this.page2.getLastTargetPage();
await breakoutPage2.bringToFront();
2021-09-23 04:20:02 +08:00
await breakoutPage2.screenshot(testName, '05-breakout-page02-user-joined-screenshare-before-check');
await this.page3.logger('before pages check');
2021-09-23 04:20:02 +08:00
const resp = await utilScreenShare.getScreenShareBreakoutContainer(breakoutPage2);
2021-09-23 04:20:02 +08:00
await breakoutPage2.screenshot(testName, '06-breakout-page02-user-joined-screenshare-after-check');
this.page2.logger('after pages check');
2021-09-23 04:20:02 +08:00
return resp === true;
} else {
2021-09-23 04:20:02 +08:00
await this.page2.page.bringToFront();
await this.page2.waitForSelector(e.breakoutRoomsItem);
await this.page2.waitAndClick(e.chatButton);
await this.page2.waitAndClick(e.breakoutRoomsItem);
await this.page2.waitForSelector(e.alreadyConnected);
return true;
}
2021-08-26 22:13:18 +08:00
} catch (err) {
await this.page3.logger(err);
return false;
}
2020-02-22 02:06:05 +08:00
}
// Close pages
2020-02-22 02:06:05 +08:00
async close() {
try {
await this.page1.close();
await this.page2.close();
await this.page3.close();
2021-08-26 22:13:18 +08:00
} catch (err) {
await this.page3.logger(err);
}
2020-02-22 02:06:05 +08:00
}
}
module.exports = exports = Join;