Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/develop' into merge-2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Joao Siebel committed Jun 22, 2020
2 parents 3e95ed0 + 511d9ad commit 9981b02
Show file tree
Hide file tree
Showing 21 changed files with 1,295 additions and 75 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ public void nonUniqueMeetingIdError() {
errors.add(new String[] {"NotUniqueMeetingID", "A meeting already exists with that meeting ID. Please use a different meeting ID."});
}

public void nonUniqueVoiceBridgeError() {
errors.add(new String[] {"nonUniqueVoiceBridge", "The selected voice bridge is already in use."});
}

public void invalidMeetingIdError() {
errors.add(new String[] {"invalidMeetingId", "The meeting ID that you supplied did not match any existing meetings"});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ public Meeting getNotEndedMeetingWithTelVoice(String telVoice) {
return null;
for (Map.Entry<String, Meeting> entry : meetings.entrySet()) {
Meeting m = entry.getValue();
if (m.getTelVoice() == telVoice) {
if (telVoice.equals(m.getTelVoice())) {
if (!m.isForciblyEnded())
return m;
}
Expand All @@ -457,7 +457,7 @@ public Meeting getNotEndedMeetingWithWebVoice(String webVoice) {
return null;
for (Map.Entry<String, Meeting> entry : meetings.entrySet()) {
Meeting m = entry.getValue();
if (m.getWebVoice() == webVoice) {
if (webVoice.equals(m.getWebVoice())) {
if (!m.isForciblyEnded())
return m;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,9 @@ class MeetingEnded extends React.PureComponent {

return (
<div className={styles.parent}>
<div className={styles.modal}>
<div className={styles.modal} data-test="meetingEndedModal">
<div className={styles.content}>
<h1 className={styles.title} data-test="meetingEndedModalTitle">
<h1 className={styles.title}>
{
intl.formatMessage(intlMessage[code] || intlMessage[430])
}
Expand All @@ -192,7 +192,7 @@ class MeetingEnded extends React.PureComponent {
: intl.formatMessage(intlMessage.messageEnded)}
</div>
{this.shouldShowFeedback ? (
<div>
<div data-test="rating">
<Rating
total="5"
onRate={this.setSelectedStar}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ class SettingsDropdown extends PureComponent {
const logoutOption = (
<DropdownListItem
key="list-item-logout"
data-test="logout"
icon="logout"
label={intl.formatMessage(intlMessages.leaveSessionLabel)}
description={intl.formatMessage(intlMessages.leaveSessionDesc)}
Expand Down
19 changes: 11 additions & 8 deletions bigbluebutton-html5/tests/puppeteer/.env-template
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,25 @@ BBB_SERVER_URL=""
BBB_SHARED_SECRET=""

# browserless credentials
BROWSERLESS_ENABLED=false # true/false
BROWSERLESS_URL= # ip:port
BROWSERLESS_TOKEN= # token
BROWSERLESS_ENABLED=false # true/false
BROWSERLESS_URL= # ip:port
BROWSERLESS_TOKEN= # token

# collecting metrics
BBB_COLLECT_METRICS=true # (true/false): true to collect metrics
METRICS_FOLDER=/tmp/bbb-metrics # the metrics output folder
BBB_COLLECT_METRICS=true # (true/false): true to collect metrics
TEST_FOLDER=data # the metrics output folder
GENERATE_EVIDENCES=true # (true/false): true to generate evidences
DEBUG=true # (true/false): true to enable console debugging

# webcams test
LOOP_INTERVAL=1000 # time to loop in the webcams test in milliseconds
LOOP_INTERVAL=1000 # time to loop in the webcams test in milliseconds
CAMERA_SHARE_FAILED_WAIT_TIME=15000 # this is set by default in the BBB server

# audio test
IS_AUDIO_TEST=false # (true/false): true if the test will require enabling audio
IS_AUDIO_TEST=false # (true/false): true if the test will require enabling audio

USER_LIST_VLIST_BOTS_TALKING=1
USER_LIST_VLIST_BOTS_LISTENING=100

TEST_DURATION_TIME=3600000 # Basic test duration time
TEST_DURATION_TIME=3600000 # Basic test duration time
GENERATE_EVIDENCES=true # (true/false): true means it will generate sceenshots during the test
3 changes: 2 additions & 1 deletion bigbluebutton-html5/tests/puppeteer/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ downloads/*
!downloads/downloads.txt
.directory
.env
media/*
media/*
data/
4 changes: 4 additions & 0 deletions bigbluebutton-html5/tests/puppeteer/core/elements.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ exports.actions = 'button[aria-label="Actions"]';
exports.options = 'button[aria-label="Options"]';
exports.userList = 'button[aria-label="Users and Messages Toggle"]';
exports.joinAudio = 'button[aria-label="Join Audio"]';
exports.connectingStatus = 'div[class^="connecting--"]';
exports.leaveAudio = 'button[aria-label="Leave Audio"]';
exports.videoMenu = 'button[aria-label="Open video menu dropdown"]';
exports.screenShare = 'button[aria-label="Share your screen"]';
exports.screenShareVideo = '[id="screenshareVideo"]';
exports.logout = 'li[data-test="logout"]';
exports.meetingEndedModal = 'div[data-test="meetingEndedModal"]';
exports.rating = 'div[data-test="rating"]';
12 changes: 8 additions & 4 deletions bigbluebutton-html5/tests/puppeteer/core/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,26 @@ function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min)) + min;
}

async function createMeeting(params, meetingId) {
async function createMeeting(params, meetingId, customParameter) {
const meetingID = meetingId || `random-${getRandomInt(1000000, 10000000).toString()}`;
const mp = params.moderatorPW;
const ap = params.attendeePW;
const query = `name=${meetingID}&meetingID=${meetingID}&attendeePW=${ap}&moderatorPW=${mp}&joinViaHtml5=true`
const query = customParameter !== undefined ? `name=${meetingID}&meetingID=${meetingID}&attendeePW=${ap}&moderatorPW=${mp}&joinViaHtml5=true`
+ `&record=false&allowStartStopRecording=true&${customParameter}&autoStartRecording=false&welcome=${params.welcome}`
: `name=${meetingID}&meetingID=${meetingID}&attendeePW=${ap}&moderatorPW=${mp}&joinViaHtml5=true`
+ `&record=false&allowStartStopRecording=true&autoStartRecording=false&welcome=${params.welcome}`;
const apicall = `create${query}${params.secret}`;
const checksum = sha1(apicall);
const url = `${params.server}/create?${query}&checksum=${checksum}`;

const response = await axios.get(url, { adapter: http });
return meetingID;
}

function getJoinURL(meetingID, params, moderator) {
function getJoinURL(meetingID, params, moderator, customParameter) {
const pw = moderator ? params.moderatorPW : params.attendeePW;
const query = `fullName=${params.fullName}&joinViaHtml5=true&meetingID=${meetingID}&password=${pw}`;
const query = customParameter !== undefined ? `fullName=${params.fullName}&joinViaHtml5=true&meetingID=${meetingID}&password=${pw}&${customParameter}`
: `fullName=${params.fullName}&joinViaHtml5=true&meetingID=${meetingID}&password=${pw}`;
const apicall = `join${query}${params.secret}`;
const checksum = sha1(apicall);
const url = `${params.server}/join?${query}&checksum=${checksum}`;
Expand Down
102 changes: 79 additions & 23 deletions bigbluebutton-html5/tests/puppeteer/core/page.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
require('dotenv').config();
const puppeteer = require('puppeteer');
const fs = require('fs');
const moment = require('moment');
const path = require('path');
const helper = require('./helper');
const params = require('../params');
Expand All @@ -21,7 +22,7 @@ class Page {
}

// Join BigBlueButton meeting
async init(args, meetingId, newParams) {
async init(args, meetingId, newParams, customParameter, testFolderName) {
try {
this.effectiveParams = newParams || params;
const isModerator = this.effectiveParams.moderatorPW;
Expand All @@ -41,22 +42,27 @@ class Page {
// ));

await this.setDownloadBehavior(`${this.parentDir}/downloads`);
this.meetingId = await helper.createMeeting(params, meetingId);
const joinURL = helper.getJoinURL(this.meetingId, this.effectiveParams, isModerator);
this.logger('before create meeting', customParameter);
this.meetingId = await helper.createMeeting(params, meetingId, customParameter);
this.logger('after create meeting', customParameter);

this.logger('before getJoinURL', customParameter);
const joinURL = helper.getJoinURL(this.meetingId, this.effectiveParams, isModerator, customParameter);
this.logger('after getJoinURL', customParameter);

await this.page.goto(joinURL);
const checkForGetMetrics = async () => {
if (process.env.BBB_COLLECT_METRICS === 'true') {
await this.page.waitForSelector('[data-test^="userListItem"]');
await this.getMetrics();
await this.getMetrics(testFolderName);
}
};
if (process.env.IS_AUDIO_TEST !== 'true') {
await this.closeAudioModal();
}
// if (process.env.IS_AUDIO_TEST !== 'true') {
// await this.closeAudioModal();
// }
await checkForGetMetrics();
} catch (e) {
console.log(e);
this.logger(e);
}
}

Expand All @@ -65,10 +71,27 @@ class Page {
await this.waitForSelector(e.audioDialog);
await this.waitForSelector(e.microphoneButton);
await this.click(e.microphoneButton, true);
await this.waitForSelector(e.connectingStatus);
await this.waitForSelector(e.echoYes);
await this.click(e.echoYes, true);
}

// Joining audio with microphone
async joinMicrophoneWithoutEchoTest() {
await this.waitForSelector(e.audioDialog);
await this.waitForSelector(e.microphoneButton);
await this.click(e.microphoneButton, true);
await this.waitForSelector(e.connectingStatus);
}

// Logout from meeting
async logoutFromMeeting() {
await this.waitForSelector(e.options);
await this.click(e.options, true);
await this.waitForSelector(e.logout);
await this.click(e.logout, true);
}

// Joining audio with Listen Only mode
async listenOnly() {
await this.waitForSelector(e.audioDialog);
Expand Down Expand Up @@ -110,9 +133,7 @@ class Page {
const args = [
'--no-sandbox',
'--use-fake-ui-for-media-stream',
'--use-fake-device-for-media-stream',
`--use-file-for-fake-audio-capture=${path.join(__dirname, '../media/audio.wav')}`,
'--allow-file-access',
'--use-fake-device-for-media-stream'
];
return {
headless: false,
Expand All @@ -123,6 +144,8 @@ class Page {
'--no-sandbox',
'--use-fake-ui-for-media-stream',
'--use-fake-device-for-media-stream',
`--use-file-for-fake-audio-capture=${path.join(__dirname, '../media/audio.wav')}`,
'--allow-file-access',
];
return {
headless: false,
Expand All @@ -146,7 +169,7 @@ class Page {
'--no-sandbox',
'--use-fake-ui-for-media-stream',
'--use-fake-device-for-media-stream',
`--use-file-for-fake-video-capture=${path.join(__dirname, '../media/video.wav')}`,
`--use-file-for-fake-video-capture=${path.join(__dirname, '../media/video_rgb.y4m')}`,
'--allow-file-access',
];
return {
Expand Down Expand Up @@ -211,12 +234,35 @@ class Page {
await this.page.type(element, text);
}

async screenshot(relief = false) {
if (relief) await helper.sleep(1000);
const filename = `${this.name}-${this.screenshotIndex}.png`;
const path = `${this.parentDir}/screenshots/${filename}`;
await this.page.screenshot({ path });
this.screenshotIndex++;
async screenshot(testFolderName, testFileName, relief = false) {
if (process.env.GENERATE_EVIDENCES === 'true') {
const today = moment().format('DD-MM-YYYY');
const dir = path.join(__dirname, `../${process.env.TEST_FOLDER}`);
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir);
}
const testResultsFolder = `${dir}/test-${today}-${testFolderName}`;
if (!fs.existsSync(testResultsFolder)) {
fs.mkdirSync(testResultsFolder);
}
const screenshots = `${testResultsFolder}/screenshots`;
if (!fs.existsSync(screenshots)) {
fs.mkdirSync(screenshots);
}
if (relief) await helper.sleep(1000);
const filename = `${testFileName}.png`;
await this.page.screenshot({ path: `${screenshots}/${filename}` });
this.screenshotIndex++;
}
}

async logger() {
if (process.env.DEBUG === 'true') {
const date = `${new Date().getDate()}.${new Date().getMonth()}.${new Date().getFullYear()} / ${new Date().getHours()}:${new Date().getMinutes()}:${new Date().getSeconds()}`;
const args = Array.prototype.slice.call(arguments);
args.unshift(`${date} `);
console.log(...args);
}
}

async paste(element) {
Expand All @@ -230,29 +276,39 @@ class Page {
await this.page.waitForSelector(element, { timeout: 0 });
}

async getMetrics() {
async getMetrics(testFolderName) {
const pageMetricsObj = {};
const dir = process.env.METRICS_FOLDER;
const today = moment().format('DD-MM-YYYY');
const dir = path.join(__dirname, `../${process.env.TEST_FOLDER}`);
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir);
}
const testExecutionResultsName = `${dir}/test-${today}-${testFolderName}`;
if (!fs.existsSync(testExecutionResultsName)) {
fs.mkdirSync(testExecutionResultsName);
}
const metricsFolder = `${testExecutionResultsName}/metrics`;
if (!fs.existsSync(metricsFolder)) {
fs.mkdirSync(metricsFolder);
}
await this.waitForSelector('[data-test^="userListItem"]');
const totalNumberOfUsersMongo = await this.page.evaluate(() => {
const collection = require('/imports/api/users/index.js');
const users = collection.default._collection.find({ connectionStatus: 'online' }).count();
return users;
});
const totalNumberOfUsersDom = await this.page.evaluate(() => document.querySelectorAll('[data-test^="userListItem"]').length);
console.log({ totalNumberOfUsersDom, totalNumberOfUsersMongo });
this.logger({ totalNumberOfUsersDom, totalNumberOfUsersMongo });
const metric = await this.page.metrics();
pageMetricsObj.totalNumberOfUsersMongoObj = totalNumberOfUsersMongo;
pageMetricsObj.totalNumberOfUsersDomObj = totalNumberOfUsersDom;
pageMetricsObj[`metricObj-${this.meetingId}`] = metric;
const metricsFile = path.join(__dirname, `../${process.env.TEST_FOLDER}/test-${today}-${testFolderName}/metrics/metrics-${this.effectiveParams.fullName}-${this.meetingId}.json`);
const createFile = () => {
try {
fs.appendFileSync(`${dir}/metrics-${this.effectiveParams.fullName}-${this.meetingId}.json`, `${JSON.stringify(pageMetricsObj)},\n`);
fs.appendFileSync(metricsFile, `${JSON.stringify(pageMetricsObj)},\n`);
} catch (error) {
console.log(error);
this.logger(error);
}
};
createFile();
Expand Down
Loading

0 comments on commit 9981b02

Please sign in to comment.