improve the use of init options

This commit is contained in:
Anton 2021-11-18 17:09:29 -03:00
parent 75645f15bd
commit e94bc894bc
3 changed files with 12 additions and 9 deletions

View File

@ -12,8 +12,8 @@ function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min)) + min;
}
async function createMeeting(params, meetingId, customParameter) {
const meetingID = meetingId || `random-${getRandomInt(1000000, 10000000).toString()}`;
async function createMeeting(params, customParameter) {
const meetingID = `random-${getRandomInt(1000000, 10000000).toString()}`;
const mp = params.moderatorPW;
const ap = params.attendeePW;
const query = customParameter !== undefined ? `name=${meetingID}&meetingID=${meetingID}&attendeePW=${ap}&moderatorPW=${mp}&joinViaHtml5=true`

View File

@ -11,13 +11,16 @@ class Page {
this.initParameters = Object.assign({}, parameters);
}
async init(isModerator, shouldCloseAudioModal, fullName, meetingId, customParameter) {
if(!isModerator) this.initParameters.moderatorPW = '';
if(fullName) this.initParameters.fullName = fullName;
if(meetingId) this.meetingId = meetingId;
else this.meetingId = await helpers.createMeeting(parameters, meetingId, customParameter);
async init(isModerator, shouldCloseAudioModal, initOptions) {
const { fullName, meetingId, customParameter } = initOptions || {};
if (!isModerator) this.initParameters.moderatorPW = '';
if (fullName) this.initParameters.fullName = fullName;
this.meetingId = (meetingId) ? meetingId : await helpers.createMeeting(parameters, customParameter);
const joinUrl = helpers.getJoinURL(this.meetingId, this.initParameters, isModerator, customParameter);
await this.page.goto(joinUrl);
if (shouldCloseAudioModal) await this.closeAudioModal();
}

View File

@ -10,8 +10,8 @@ class MultiUsers {
}
async init(testFolderName) {
await this.page1.init(true, true, 'User1');
await this.page2.init(true, true, 'User2', this.page1.meetingId); // joining the same meeting
await this.page1.init(true, true, { fullName: 'User1' });
await this.page2.init(true, true, { fullName: 'User1', meetingId: this.page1.meetingId }); // joining the same meeting
}
async test() {