2020-07-14 03:03:41 +08:00
|
|
|
const moment = require('moment');
|
|
|
|
const path = require('path');
|
2020-07-14 03:03:41 +08:00
|
|
|
const Page = require('../core/page');
|
|
|
|
const params = require('../params');
|
2020-02-22 02:06:05 +08:00
|
|
|
const util = require('./util');
|
2020-07-14 03:03:41 +08:00
|
|
|
const be = require('./elements'); // breakout elements
|
|
|
|
const we = require('../webcam/elements'); // webcam elements
|
|
|
|
const ae = require('../audio/elements'); // audio elements
|
2021-02-17 04:57:10 +08:00
|
|
|
const ue = require('../user/elements'); // user elements
|
|
|
|
const ce = require('../customparameters/elements'); // customparameters elements
|
2020-07-18 03:12:43 +08:00
|
|
|
const e = require('../core/elements'); // page base elements
|
2021-02-17 04:57:10 +08:00
|
|
|
// core constants (Timeouts vars imported)
|
|
|
|
const { ELEMENT_WAIT_TIME, ELEMENT_WAIT_LONGER_TIME } = require('../core/constants');
|
|
|
|
|
2020-07-14 03:03:41 +08:00
|
|
|
const today = moment().format('DD-MM-YYYY');
|
2020-02-22 02:06:05 +08:00
|
|
|
|
|
|
|
class Create {
|
|
|
|
constructor() {
|
|
|
|
this.page1 = new Page();
|
|
|
|
this.page2 = new Page();
|
|
|
|
this.page3 = new Page();
|
|
|
|
}
|
|
|
|
|
|
|
|
// Join BigBlueButton meeting
|
2021-02-26 23:52:17 +08:00
|
|
|
async init(meetingId, testName) {
|
|
|
|
await this.page1.init(Page.getArgs(), meetingId, { ...params, fullName: 'Moderator1' }, undefined, testName);
|
|
|
|
await this.page2.init(Page.getArgs(), this.page1.meetingId, { ...params, fullName: 'Viewer1', moderatorPW: '' }, undefined, testName);
|
2020-02-22 02:39:28 +08:00
|
|
|
}
|
|
|
|
|
2020-06-30 09:25:04 +08:00
|
|
|
// Create Breakoutrooms
|
|
|
|
async create(testName) {
|
2020-08-05 02:53:34 +08:00
|
|
|
await this.page1.closeAudioModal();
|
|
|
|
await this.page2.closeAudioModal();
|
|
|
|
if (process.env.GENERATE_EVIDENCES === 'true') {
|
|
|
|
await this.page1.screenshot(`${testName}`, `01-page01-initialized-${testName}`);
|
|
|
|
await this.page2.screenshot(`${testName}`, `01-page02-initialized-${testName}`);
|
|
|
|
}
|
2020-06-30 09:25:04 +08:00
|
|
|
await this.page1.page.evaluate(util.clickTestElement, be.manageUsers);
|
|
|
|
await this.page1.page.evaluate(util.clickTestElement, be.createBreakoutRooms);
|
2020-08-05 02:53:34 +08:00
|
|
|
if (process.env.GENERATE_EVIDENCES === 'true') {
|
|
|
|
await this.page1.screenshot(`${testName}`, `02-page01-creating-breakoutrooms-${testName}`);
|
|
|
|
}
|
2021-02-17 04:57:10 +08:00
|
|
|
await this.page1.waitForSelector(be.randomlyAssign, ELEMENT_WAIT_TIME);
|
2020-06-30 09:25:04 +08:00
|
|
|
await this.page1.page.evaluate(util.clickTestElement, be.randomlyAssign);
|
2020-08-05 02:53:34 +08:00
|
|
|
if (process.env.GENERATE_EVIDENCES === 'true') {
|
|
|
|
await this.page1.screenshot(`${testName}`, `03-page01-randomly-assign-user-${testName}`);
|
|
|
|
}
|
2021-02-17 04:57:10 +08:00
|
|
|
await this.page1.waitForSelector(be.modalConfirmButton, ELEMENT_WAIT_TIME);
|
2020-06-30 09:25:04 +08:00
|
|
|
await this.page1.page.evaluate(util.clickTestElement, be.modalConfirmButton);
|
2020-08-05 02:53:34 +08:00
|
|
|
if (process.env.GENERATE_EVIDENCES === 'true') {
|
|
|
|
await this.page1.screenshot(`${testName}`, `04-page01-confirm-breakoutrooms-creation-${testName}`);
|
|
|
|
}
|
2021-02-17 04:57:10 +08:00
|
|
|
await this.page2.waitForSelector(be.modalConfirmButton, ELEMENT_WAIT_TIME);
|
2020-06-30 09:25:04 +08:00
|
|
|
await this.page2.page.evaluate(util.clickTestElement, be.modalConfirmButton);
|
2020-08-05 02:53:34 +08:00
|
|
|
if (process.env.GENERATE_EVIDENCES === 'true') {
|
|
|
|
await this.page2.screenshot(`${testName}`, `02-page02-accept-invite-breakoutrooms-${testName}`);
|
|
|
|
}
|
|
|
|
await this.page2.page.bringToFront();
|
2021-02-17 04:57:10 +08:00
|
|
|
await this.page2.waitForSelector(be.breakoutRoomsItem, ELEMENT_WAIT_TIME);
|
|
|
|
await this.page2.waitForSelector(be.chatButton, ELEMENT_WAIT_TIME);
|
|
|
|
await this.page2.click(be.chatButton, true);
|
|
|
|
await this.page2.click(be.breakoutRoomsItem, true);
|
|
|
|
await this.page2.waitForSelector(be.alreadyConnected, ELEMENT_WAIT_TIME);
|
2020-07-14 03:03:41 +08:00
|
|
|
const page2 = await this.page2.browser.pages();
|
2020-08-05 02:53:34 +08:00
|
|
|
await page2[2].bringToFront();
|
|
|
|
if (process.env.GENERATE_EVIDENCES === 'true') {
|
|
|
|
await page2[2].screenshot({ path: path.join(__dirname, `../${process.env.TEST_FOLDER}/test-${today}-${testName}/screenshots/03-breakout-page02-before-closing-audio-modal.png`) });
|
|
|
|
}
|
2021-02-17 04:57:10 +08:00
|
|
|
await page2[2].waitForSelector(e.closeAudio, { timeout: ELEMENT_WAIT_TIME });
|
|
|
|
await page2[2].click(e.closeAudio);
|
2020-08-05 02:53:34 +08:00
|
|
|
if (process.env.GENERATE_EVIDENCES === 'true') {
|
|
|
|
await page2[2].screenshot({ path: path.join(__dirname, `../${process.env.TEST_FOLDER}/test-${today}-${testName}/screenshots/04-breakout-page02-after-closing-audio-modal.png`) });
|
|
|
|
}
|
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) {
|
2020-06-30 09:25:04 +08:00
|
|
|
const resp = await this.page1.page.evaluate(() => document.querySelectorAll('div[data-test="breakoutRoomsItem"]').length !== 0);
|
|
|
|
if (resp === true) {
|
2020-08-05 02:53:34 +08:00
|
|
|
if (process.env.GENERATE_EVIDENCES === 'true') {
|
|
|
|
await this.page1.screenshot(`${testName}`, `05-page01-success-${testName}`);
|
|
|
|
}
|
2020-06-30 09:25:04 +08:00
|
|
|
return true;
|
2020-07-14 03:03:41 +08:00
|
|
|
}
|
2020-08-05 02:53:34 +08:00
|
|
|
if (process.env.GENERATE_EVIDENCES === 'true') {
|
|
|
|
await this.page1.screenshot(`${testName}`, `05-page01-fail-${testName}`);
|
|
|
|
}
|
2020-06-30 09:25:04 +08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Initialize a Moderator session
|
2020-07-14 03:03:41 +08:00
|
|
|
async joinWithUser3(testName) {
|
2020-07-14 03:03:41 +08:00
|
|
|
if (testName === 'joinBreakoutroomsWithAudio') {
|
2021-02-26 23:52:17 +08:00
|
|
|
await this.page3.init(Page.getArgsWithAudio(), this.page1.meetingId, { ...params, fullName: 'Moderator3' }, undefined, testName);
|
2020-07-14 03:03:41 +08:00
|
|
|
await this.page3.closeAudioModal();
|
2021-02-17 04:57:10 +08:00
|
|
|
await this.page3.waitForSelector(be.breakoutRoomsButton, ELEMENT_WAIT_TIME);
|
2020-07-14 03:03:41 +08:00
|
|
|
await this.page3.click(be.breakoutRoomsButton, true);
|
2020-08-14 10:41:14 +08:00
|
|
|
|
2021-02-17 04:57:10 +08:00
|
|
|
await this.page3.waitForSelector(be.breakoutRoomsItem, ELEMENT_WAIT_TIME);
|
|
|
|
await this.page3.waitForSelector(be.chatButton, ELEMENT_WAIT_TIME);
|
|
|
|
await this.page3.click(be.chatButton, true);
|
|
|
|
await this.page3.click(be.breakoutRoomsItem, true);
|
2020-08-14 10:41:14 +08:00
|
|
|
|
|
|
|
|
2021-02-17 04:57:10 +08:00
|
|
|
await this.page3.waitForSelector(be.joinRoom1, ELEMENT_WAIT_TIME);
|
2020-07-14 03:03:41 +08:00
|
|
|
await this.page3.click(be.joinRoom1, true);
|
2021-02-17 04:57:10 +08:00
|
|
|
await this.page3.waitForSelector(be.alreadyConnected, ELEMENT_WAIT_LONGER_TIME);
|
2020-07-14 03:03:41 +08:00
|
|
|
|
2020-07-14 03:03:41 +08:00
|
|
|
const page3 = await this.page3.browser.pages();
|
|
|
|
|
2020-08-05 02:53:34 +08:00
|
|
|
if (process.env.GENERATE_EVIDENCES === 'true') {
|
|
|
|
await page3[2].screenshot({ path: path.join(__dirname, `../${process.env.TEST_FOLDER}/test-${today}-${testName}/screenshots/00-breakout-page03-user-joined-no-mic-before-check-${testName}.png`) });
|
|
|
|
}
|
|
|
|
await page3[2].bringToFront();
|
2021-02-17 04:57:10 +08:00
|
|
|
await page3[2].waitForSelector(ae.microphone, { timeout: ELEMENT_WAIT_TIME });
|
2020-07-14 03:03:41 +08:00
|
|
|
await page3[2].click(ae.microphone);
|
2021-02-17 04:57:10 +08:00
|
|
|
await page3[2].waitForSelector(ae.connectingStatus, { timeout: ELEMENT_WAIT_TIME });
|
|
|
|
const parsedSettings = await this.page1.getSettingsYaml();
|
|
|
|
const listenOnlyCallTimeout = parseInt(parsedSettings.public.media.listenOnlyCallTimeout);
|
|
|
|
await page3[2].waitForSelector(ae.audioAudible, { timeout: listenOnlyCallTimeout });
|
2020-07-14 03:03:41 +08:00
|
|
|
await page3[2].click(ae.audioAudible);
|
2021-02-17 04:57:10 +08:00
|
|
|
await page3[2].waitForSelector(e.whiteboard, { timeout: ELEMENT_WAIT_TIME });
|
2020-07-14 03:03:41 +08:00
|
|
|
|
2020-08-05 02:53:34 +08:00
|
|
|
if (process.env.GENERATE_EVIDENCES === 'true') {
|
|
|
|
await page3[2].screenshot({ path: path.join(__dirname, `../${process.env.TEST_FOLDER}/test-${today}-${testName}/screenshots/00-breakout-page03-user-joined-with-mic-before-check-${testName}.png`) });
|
|
|
|
}
|
2020-07-14 03:03:41 +08:00
|
|
|
} else if (testName === 'joinBreakoutroomsWithVideo') {
|
2021-02-26 23:52:17 +08:00
|
|
|
await this.page3.init(Page.getArgsWithVideo(), this.page1.meetingId, { ...params, fullName: 'Moderator3' }, undefined, testName);
|
2020-07-14 03:03:41 +08:00
|
|
|
await this.page3.closeAudioModal();
|
2021-02-17 04:57:10 +08:00
|
|
|
await this.page3.waitForSelector(be.breakoutRoomsButton, ELEMENT_WAIT_TIME);
|
2020-07-14 03:03:41 +08:00
|
|
|
await this.page3.click(be.breakoutRoomsButton, true);
|
2021-02-17 04:57:10 +08:00
|
|
|
await this.page3.waitForSelector(be.joinRoom1, ELEMENT_WAIT_TIME);
|
2020-07-14 03:03:41 +08:00
|
|
|
await this.page3.click(be.joinRoom1, true);
|
2021-02-17 04:57:10 +08:00
|
|
|
await this.page3.waitForSelector(be.alreadyConnected, ELEMENT_WAIT_TIME);
|
2020-07-18 03:12:43 +08:00
|
|
|
|
2020-07-14 03:03:41 +08:00
|
|
|
const page3 = await this.page3.browser.pages();
|
2020-07-14 03:03:41 +08:00
|
|
|
|
2020-08-05 02:53:34 +08:00
|
|
|
if (process.env.GENERATE_EVIDENCES === 'true') {
|
|
|
|
await page3[2].screenshot({ path: path.join(__dirname, `../${process.env.TEST_FOLDER}/test-${today}-${testName}/screenshots/00-breakout-page03-user-joined-no-webcam-before-check-${testName}.png`) });
|
|
|
|
}
|
|
|
|
await page3[2].bringToFront();
|
2021-02-17 04:57:10 +08:00
|
|
|
await page3[2].waitForSelector(e.audioDialog, { timeout: ELEMENT_WAIT_TIME });
|
|
|
|
await page3[2].waitForSelector(e.closeAudio, { timeout: ELEMENT_WAIT_TIME });
|
2020-07-14 03:03:41 +08:00
|
|
|
await page3[2].click(e.closeAudio);
|
2021-02-17 04:57:10 +08:00
|
|
|
await page3[2].waitForSelector(we.joinVideo, { timeout: ELEMENT_WAIT_TIME });
|
2020-07-14 03:03:41 +08:00
|
|
|
await page3[2].click(we.joinVideo);
|
2021-02-17 04:57:10 +08:00
|
|
|
const parsedSettings = await this.page3.getSettingsYaml();
|
|
|
|
const videoPreviewTimeout = parseInt(parsedSettings.public.kurento.gUMTimeout);
|
|
|
|
await page3[2].waitForSelector(we.videoPreview, { timeout: videoPreviewTimeout });
|
2020-07-14 03:03:41 +08:00
|
|
|
await page3[2].click(we.videoPreview);
|
2021-02-17 04:57:10 +08:00
|
|
|
await page3[2].waitForSelector(we.startSharingWebcam, { timeout: ELEMENT_WAIT_TIME });
|
2020-07-14 03:03:41 +08:00
|
|
|
await page3[2].click(we.startSharingWebcam);
|
2020-08-05 02:53:34 +08:00
|
|
|
if (process.env.GENERATE_EVIDENCES === 'true') {
|
|
|
|
await page3[2].screenshot({ path: path.join(__dirname, `../${process.env.TEST_FOLDER}/test-${today}-${testName}/screenshots/00-breakout-page03-user-joined-with-webcam-before-check-${testName}.png`) });
|
|
|
|
}
|
2020-07-14 03:03:41 +08:00
|
|
|
} else if (testName === 'joinBreakoutroomsAndShareScreen') {
|
2021-02-26 23:52:17 +08:00
|
|
|
await this.page3.init(Page.getArgs(), this.page1.meetingId, { ...params, fullName: 'Moderator3' }, undefined, testName);
|
2020-07-14 03:03:41 +08:00
|
|
|
await this.page3.closeAudioModal();
|
2021-02-17 04:57:10 +08:00
|
|
|
await this.page3.waitForSelector(be.breakoutRoomsButton, ELEMENT_WAIT_TIME);
|
2020-07-14 03:03:41 +08:00
|
|
|
await this.page3.click(be.breakoutRoomsButton, true);
|
2021-02-17 04:57:10 +08:00
|
|
|
await this.page3.waitForSelector(be.joinRoom1, ELEMENT_WAIT_TIME);
|
2020-07-14 03:03:41 +08:00
|
|
|
await this.page3.click(be.joinRoom1, true);
|
2021-02-17 04:57:10 +08:00
|
|
|
await this.page3.waitForSelector(be.alreadyConnected, ELEMENT_WAIT_TIME);
|
2020-07-14 03:03:41 +08:00
|
|
|
const page3 = await this.page3.browser.pages();
|
2020-07-18 03:12:43 +08:00
|
|
|
|
2020-08-05 02:53:34 +08:00
|
|
|
if (process.env.GENERATE_EVIDENCES === 'true') {
|
|
|
|
await page3[2].screenshot({ path: path.join(__dirname, `../${process.env.TEST_FOLDER}/test-${today}-${testName}/screenshots/00-breakout-page03-user-joined-with-screenshare-before-check-${testName}.png`) });
|
|
|
|
}
|
|
|
|
await page3[2].bringToFront();
|
2021-02-17 04:57:10 +08:00
|
|
|
await page3[2].waitForSelector(e.audioDialog, { timeout: ELEMENT_WAIT_TIME });
|
|
|
|
await page3[2].waitForSelector(e.closeAudio, { timeout: ELEMENT_WAIT_TIME });
|
2020-07-14 03:03:41 +08:00
|
|
|
await page3[2].click(e.closeAudio);
|
2020-07-14 03:03:41 +08:00
|
|
|
|
2020-07-14 03:03:41 +08:00
|
|
|
// Take Presenter
|
2021-02-17 04:57:10 +08:00
|
|
|
await page3[2].waitForSelector(ue.firstUser, { timeout: ELEMENT_WAIT_TIME });
|
|
|
|
await page3[2].click(ue.firstUser);
|
|
|
|
await page3[2].waitForSelector(ue.setPresenter, { timeout: ELEMENT_WAIT_TIME });
|
|
|
|
await page3[2].click(ue.setPresenter);
|
2020-07-14 03:03:41 +08:00
|
|
|
|
2020-07-14 03:03:41 +08:00
|
|
|
// Start Share Screen
|
2021-02-17 04:57:10 +08:00
|
|
|
await page3[2].waitForSelector(ce.screenShareButton, { timeout: ELEMENT_WAIT_TIME });
|
|
|
|
await page3[2].click(ce.screenShareButton);
|
2020-07-14 03:03:41 +08:00
|
|
|
await page3[2].on('dialog', async (dialog) => {
|
2020-07-14 03:03:41 +08:00
|
|
|
await dialog.accept();
|
|
|
|
});
|
2020-08-05 02:53:34 +08:00
|
|
|
if (process.env.GENERATE_EVIDENCES === 'true') {
|
|
|
|
await page3[2].screenshot({ path: path.join(__dirname, `../${process.env.TEST_FOLDER}/test-${today}-${testName}/screenshots/00-breakout-page03-user-joined-with-screenshare-after-check-${testName}.png`) });
|
|
|
|
}
|
2020-07-14 03:03:41 +08:00
|
|
|
} else {
|
2021-02-26 23:52:17 +08:00
|
|
|
await this.page3.init(Page.getArgs(), this.page1.meetingId, { ...params, fullName: 'Moderator3' }, undefined, testName);
|
2020-07-14 03:03:41 +08:00
|
|
|
await this.page3.closeAudioModal();
|
2020-07-14 03:03:41 +08:00
|
|
|
}
|
2020-06-30 09:25:04 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
// Close pages
|
|
|
|
async close() {
|
|
|
|
await this.page1.close();
|
|
|
|
await this.page2.close();
|
2020-02-22 02:06:05 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = exports = Create;
|