2020-07-14 03:03:41 +08:00
|
|
|
const Page = require('../core/page');
|
2021-09-22 11:51:29 +08:00
|
|
|
const e = require('../core/elements');
|
2021-09-23 04:20:02 +08:00
|
|
|
const { ELEMENT_WAIT_LONGER_TIME } = require('../core/constants');
|
2020-02-22 02:06:05 +08:00
|
|
|
|
|
|
|
class Create {
|
|
|
|
constructor() {
|
2021-09-23 05:03:47 +08:00
|
|
|
this.modPage1 = new Page();
|
|
|
|
this.modPage2 = new Page();
|
|
|
|
this.userPage1 = new Page();
|
2020-02-22 02:06:05 +08:00
|
|
|
}
|
|
|
|
|
2021-04-15 00:16:41 +08:00
|
|
|
// Join BigBlueButton meeting with a Moderator and a Viewer
|
2021-09-30 20:36:08 +08:00
|
|
|
async init(testName) {
|
|
|
|
await this.modPage1.init(true, true, testName, 'Moderator1');
|
|
|
|
await this.userPage1.init(false, true, testName, 'Viewer1', this.modPage1.meetingId);
|
2020-02-22 02:39:28 +08:00
|
|
|
}
|
|
|
|
|
2021-04-15 00:16:41 +08:00
|
|
|
// Join BigBlueButton meeting with a Viewer only
|
|
|
|
async initViewer(testName) {
|
2021-09-30 20:36:08 +08:00
|
|
|
await this.userPage1.init(false, true, testName, 'Viewer2', this.modPage1.meetingId);
|
2021-04-15 00:16:41 +08:00
|
|
|
}
|
|
|
|
|
2020-06-30 09:25:04 +08:00
|
|
|
// Create Breakoutrooms
|
|
|
|
async create(testName) {
|
2021-08-14 01:35:00 +08:00
|
|
|
try {
|
2021-09-23 05:03:47 +08:00
|
|
|
await this.modPage1.screenshot(testName, '01-page01-initialized');
|
|
|
|
await this.userPage1.screenshot(testName, '01-page02-initialized');
|
2021-08-14 04:33:27 +08:00
|
|
|
|
2021-09-23 05:03:47 +08:00
|
|
|
await this.modPage1.waitAndClick(e.manageUsers);
|
|
|
|
await this.modPage1.waitAndClick(e.createBreakoutRooms);
|
|
|
|
await this.modPage1.screenshot(testName, '02-page01-creating-breakoutrooms');
|
2021-08-14 04:33:27 +08:00
|
|
|
|
2021-09-23 05:03:47 +08:00
|
|
|
await this.modPage1.waitAndClick(e.randomlyAssign);
|
|
|
|
await this.modPage1.screenshot(testName, '03-page01-randomly-assign-user');
|
2021-08-14 04:33:27 +08:00
|
|
|
|
2021-09-23 05:03:47 +08:00
|
|
|
await this.modPage1.waitAndClick(e.modalConfirmButton, ELEMENT_WAIT_LONGER_TIME);
|
|
|
|
await this.modPage1.screenshot(testName, '04-page01-confirm-breakoutrooms-creation');
|
2021-08-14 04:33:27 +08:00
|
|
|
|
2021-09-23 04:20:02 +08:00
|
|
|
// Join breakout room
|
2021-09-23 05:03:47 +08:00
|
|
|
await this.userPage1.waitAndClick(e.modalConfirmButton, ELEMENT_WAIT_LONGER_TIME);
|
|
|
|
await this.userPage1.screenshot(testName, '02-page02-accept-invite-breakoutrooms');
|
2021-08-14 04:33:27 +08:00
|
|
|
|
2021-09-23 05:03:47 +08:00
|
|
|
await this.userPage1.bringToFront();
|
|
|
|
await this.userPage1.waitAndClick(e.chatButton);
|
|
|
|
await this.userPage1.waitAndClick(e.breakoutRoomsItem);
|
|
|
|
await this.userPage1.waitForSelector(e.alreadyConnected, ELEMENT_WAIT_LONGER_TIME);
|
2021-09-23 04:20:02 +08:00
|
|
|
|
2021-09-23 05:03:47 +08:00
|
|
|
const breakoutUserPage1 = await this.userPage1.getLastTargetPage();
|
|
|
|
await breakoutUserPage1.bringToFront();
|
2021-09-23 04:20:02 +08:00
|
|
|
|
2021-09-23 05:03:47 +08:00
|
|
|
await breakoutUserPage1.screenshot(testName, '03-breakout-page02-before-closing-audio-modal');
|
|
|
|
await breakoutUserPage1.closeAudioModal();
|
2021-09-23 04:20:02 +08:00
|
|
|
|
2021-09-23 05:03:47 +08:00
|
|
|
await breakoutUserPage1.screenshot(testName, '04-breakout-page02-after-closing-audio-modal');
|
2021-08-26 22:13:18 +08:00
|
|
|
} catch (err) {
|
2021-09-23 05:03:47 +08:00
|
|
|
await this.modPage1.logger(err);
|
2021-08-31 11:07:17 +08:00
|
|
|
return false;
|
2020-08-05 02:53:34 +08:00
|
|
|
}
|
2020-02-22 02:06:05 +08:00
|
|
|
}
|
|
|
|
|
2020-06-30 09:25:04 +08:00
|
|
|
// Check if Breakoutrooms have been created
|
2020-07-14 03:03:41 +08:00
|
|
|
async testCreatedBreakout(testName) {
|
2021-08-14 01:35:00 +08:00
|
|
|
try {
|
2021-10-07 22:29:18 +08:00
|
|
|
const resp = await this.modPage1.hasElement(e.breakoutRoomsItem);
|
2021-08-14 01:35:00 +08:00
|
|
|
if (resp === true) {
|
2021-09-23 05:03:47 +08:00
|
|
|
await this.modPage1.screenshot(`${testName}`, `05-page01-success-${testName}`);
|
2021-08-14 04:33:27 +08:00
|
|
|
|
2021-08-14 01:35:00 +08:00
|
|
|
return true;
|
2020-08-05 02:53:34 +08:00
|
|
|
}
|
2021-09-23 05:03:47 +08:00
|
|
|
await this.modPage1.screenshot(`${testName}`, `05-page01-fail-${testName}`);
|
2021-08-14 04:33:27 +08:00
|
|
|
|
2021-08-14 01:35:00 +08:00
|
|
|
return false;
|
2021-08-26 22:13:18 +08:00
|
|
|
} catch (err) {
|
2021-09-23 05:03:47 +08:00
|
|
|
await this.modPage1.logger(err);
|
2021-08-14 01:35:00 +08:00
|
|
|
return false;
|
2020-08-05 02:53:34 +08:00
|
|
|
}
|
2020-06-30 09:25:04 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Initialize a Moderator session
|
2021-09-23 05:03:47 +08:00
|
|
|
async joinWithMod2(testName) {
|
2021-08-14 01:35:00 +08:00
|
|
|
try {
|
|
|
|
if (testName === 'joinBreakoutroomsWithAudio') {
|
2021-09-30 20:36:08 +08:00
|
|
|
await this.modPage2.init(true, true, testName, 'Moderator2', this.modPage1.meetingId);
|
2021-09-23 05:03:47 +08:00
|
|
|
await this.modPage2.waitAndClick(e.breakoutRoomsButton);
|
2020-08-14 10:41:14 +08:00
|
|
|
|
2021-09-23 05:03:47 +08:00
|
|
|
await this.modPage2.waitForSelector(e.breakoutRoomsItem);
|
|
|
|
await this.modPage2.waitAndClick(e.chatButton);
|
|
|
|
await this.modPage2.waitAndClick(e.breakoutRoomsItem);
|
2020-08-14 10:41:14 +08:00
|
|
|
|
2021-10-12 00:26:27 +08:00
|
|
|
await this.modPage2.waitAndClick(e.askJoinRoom1);
|
2021-09-23 05:03:47 +08:00
|
|
|
await this.modPage2.waitForSelector(e.alreadyConnected, ELEMENT_WAIT_LONGER_TIME);
|
2020-07-14 03:03:41 +08:00
|
|
|
|
2021-09-23 05:03:47 +08:00
|
|
|
const breakoutModPage2 = await this.modPage2.getLastTargetPage();
|
|
|
|
await breakoutModPage2.screenshot(testName, `00-breakout-page03-user-joined-no-mic-before-check`);
|
2020-07-14 03:03:41 +08:00
|
|
|
|
2021-09-23 05:03:47 +08:00
|
|
|
await breakoutModPage2.bringToFront();
|
|
|
|
await breakoutModPage2.waitAndClick(e.microphoneButton);
|
|
|
|
await breakoutModPage2.waitForSelector(e.connectingStatus);
|
|
|
|
const parsedSettings = await this.modPage1.getSettingsYaml();
|
2021-08-14 01:35:00 +08:00
|
|
|
const listenOnlyCallTimeout = parseInt(parsedSettings.public.media.listenOnlyCallTimeout);
|
2021-09-23 05:03:47 +08:00
|
|
|
await breakoutModPage2.waitAndClick(e.echoYesButton, listenOnlyCallTimeout);
|
|
|
|
await breakoutModPage2.waitForSelector(e.whiteboard);
|
2020-07-14 03:03:41 +08:00
|
|
|
|
2021-09-23 05:03:47 +08:00
|
|
|
await breakoutModPage2.screenshot(testName, '00-breakout-page03-user-joined-with-mic-before-check');
|
2021-08-14 01:35:00 +08:00
|
|
|
} else if (testName === 'joinBreakoutroomsWithVideo') {
|
2021-09-30 20:36:08 +08:00
|
|
|
await this.modPage2.init(true, true, testName, 'Moderator2', this.modPage1.meetingId);
|
2021-09-23 05:03:47 +08:00
|
|
|
await this.modPage2.waitAndClick(e.breakoutRoomsButton);
|
2021-10-12 00:26:27 +08:00
|
|
|
await this.modPage2.waitAndClick(e.askJoinRoom1);
|
2021-09-23 05:03:47 +08:00
|
|
|
await this.modPage2.waitForSelector(e.alreadyConnected);
|
|
|
|
|
|
|
|
const breakoutModPage2 = await this.modPage2.getLastTargetPage();
|
|
|
|
await breakoutModPage2.screenshot(testName, '00-breakout-page03-user-joined-no-webcam-before-check');
|
|
|
|
|
|
|
|
await breakoutModPage2.bringToFront();
|
|
|
|
await breakoutModPage2.closeAudioModal();
|
|
|
|
const parsedSettings = await this.modPage2.getSettingsYaml();
|
2021-08-14 01:35:00 +08:00
|
|
|
const videoPreviewTimeout = parseInt(parsedSettings.public.kurento.gUMTimeout);
|
2021-10-05 04:42:58 +08:00
|
|
|
await breakoutModPage2.shareWebcam(true, videoPreviewTimeout);
|
2021-09-23 04:20:02 +08:00
|
|
|
|
2021-09-23 05:03:47 +08:00
|
|
|
await breakoutModPage2.screenshot(testName, '00-breakout-page03-user-joined-with-webcam-before-check');
|
2021-08-14 01:35:00 +08:00
|
|
|
} else if (testName === 'joinBreakoutroomsAndShareScreen') {
|
2021-09-30 20:36:08 +08:00
|
|
|
await this.modPage2.init(true, true, testName, 'Moderator2', this.modPage1.meetingId);
|
2021-09-23 05:03:47 +08:00
|
|
|
await this.modPage2.waitAndClick(e.breakoutRoomsButton);
|
2021-10-12 00:26:27 +08:00
|
|
|
await this.modPage2.waitAndClick(e.askJoinRoom1);
|
2021-09-23 05:03:47 +08:00
|
|
|
await this.modPage2.waitForSelector(e.alreadyConnected);
|
|
|
|
const breakoutModPage2 = await this.modPage2.getLastTargetPage();
|
|
|
|
|
|
|
|
await breakoutModPage2.screenshot(testName, '00-breakout-page03-user-joined-with-screenshare-before-check');
|
|
|
|
await breakoutModPage2.bringToFront();
|
|
|
|
await breakoutModPage2.closeAudioModal();
|
2020-07-14 03:03:41 +08:00
|
|
|
|
2021-08-14 01:35:00 +08:00
|
|
|
// Take Presenter
|
2021-09-23 05:03:47 +08:00
|
|
|
await breakoutModPage2.waitAndClick(e.firstUser);
|
|
|
|
await breakoutModPage2.waitAndClick(e.setPresenter);
|
2020-07-14 03:03:41 +08:00
|
|
|
|
2021-08-14 01:35:00 +08:00
|
|
|
// Start Share Screen
|
2021-09-23 05:03:47 +08:00
|
|
|
await breakoutModPage2.waitAndClick(e.startScreenSharing);
|
|
|
|
await breakoutModPage2.page.on('dialog', async (dialog) => {
|
2021-08-14 01:35:00 +08:00
|
|
|
await dialog.accept();
|
|
|
|
});
|
2021-09-23 05:03:47 +08:00
|
|
|
await breakoutModPage2.screenshot(testName, '00-breakout-page03-user-joined-with-screenshare-after-check');
|
2021-08-14 01:35:00 +08:00
|
|
|
} else {
|
2021-09-30 20:36:08 +08:00
|
|
|
await this.modPage2.init(true, true, testName, 'Moderator2', this.modPage1.meetingId);
|
2020-08-05 02:53:34 +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);
|
2020-07-14 03:03:41 +08:00
|
|
|
}
|
2020-06-30 09:25:04 +08:00
|
|
|
}
|
2020-02-22 02:06:05 +08:00
|
|
|
}
|
|
|
|
|
2021-09-30 20:36:08 +08:00
|
|
|
module.exports = exports = Create;
|