2020-05-22 00:45:52 +08:00
|
|
|
const path = require('path');
|
2020-05-13 21:53:14 +08:00
|
|
|
const Page = require('../core/page');
|
|
|
|
const params = require('../params');
|
2020-05-22 00:45:52 +08:00
|
|
|
const helper = require('../core/helper');
|
2020-05-13 21:53:14 +08:00
|
|
|
const cpe = require('./elements');
|
|
|
|
const util = require('./util');
|
2020-05-15 22:49:03 +08:00
|
|
|
const c = require('./constants');
|
2020-05-13 21:53:14 +08:00
|
|
|
|
|
|
|
class CustomParameters {
|
|
|
|
constructor() {
|
|
|
|
this.page1 = new Page();
|
|
|
|
this.page2 = new Page();
|
2020-05-22 00:45:52 +08:00
|
|
|
this.name = name;
|
|
|
|
this.screenshotIndex = 0;
|
|
|
|
this.parentDir = this.getParentDir(__dirname);
|
2020-05-13 21:53:14 +08:00
|
|
|
}
|
|
|
|
|
2020-05-22 00:45:52 +08:00
|
|
|
getParentDir(dir) {
|
|
|
|
const tmp = dir.split('/');
|
|
|
|
tmp.pop();
|
|
|
|
return tmp.join('/');
|
|
|
|
}
|
|
|
|
|
|
|
|
async autoJoin(testName, args, meetingId, customParameter) {
|
2020-05-13 21:53:14 +08:00
|
|
|
console.log('before init');
|
2020-05-22 00:45:52 +08:00
|
|
|
await this.page1.init(args, meetingId, { ...params, fullName: 'Moderator' }, customParameter, testName);
|
|
|
|
await this.page1.screenshot(`${testName}`, `01-${testName}`);
|
2020-05-13 21:53:14 +08:00
|
|
|
console.log('after init');
|
2020-05-22 00:45:52 +08:00
|
|
|
await this.page1.waitForSelector('div[data-test="chatMessages"]', { timeout: 5000 });
|
|
|
|
if (await this.page1.page.evaluate(util.getTestElement, cpe.audioModal) === false) {
|
|
|
|
await this.page1.screenshot(`${testName}`, `02-fail-${testName}`);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
const resp = await this.page1.page.evaluate(util.getTestElement, cpe.audioModal) === true;
|
|
|
|
await this.page1.screenshot(`${testName}`, `02-success-${testName}`);
|
|
|
|
return resp === true;
|
2020-05-13 21:53:14 +08:00
|
|
|
}
|
|
|
|
|
2020-05-22 00:45:52 +08:00
|
|
|
async listenOnlyMode(testName, args, meetingId, customParameter) {
|
2020-05-13 23:26:30 +08:00
|
|
|
console.log('before init');
|
2020-05-22 00:45:52 +08:00
|
|
|
await this.page1.init(args, meetingId, { ...params, fullName: 'Moderator' }, customParameter, testName);
|
|
|
|
await this.page1.screenshot(`${testName}`, `01-page1-${testName}`);
|
|
|
|
await this.page2.init(args, this.page1.meetingId, { ...params, fullName: 'Attendee', moderatorPW: '' }, customParameter, testName);
|
|
|
|
await this.page2.screenshot(`${testName}`, `01-page2-${testName}`);
|
2020-05-13 23:26:30 +08:00
|
|
|
console.log('after init');
|
2020-05-22 00:45:52 +08:00
|
|
|
if (await this.page2.page.$('[data-test="audioModalHeader"]')) {
|
|
|
|
await this.page2.screenshot(`${testName}`, `02-fail-${testName}`);
|
2020-05-13 23:26:30 +08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
await this.page1.page.waitFor(cpe.echoTestYesButton);
|
2020-05-22 00:45:52 +08:00
|
|
|
await this.page1.screenshot(`${testName}`, `02-success-page1-${testName}`);
|
2020-05-13 23:26:30 +08:00
|
|
|
await this.page2.page.waitFor(cpe.echoTestYesButton);
|
2020-05-22 00:45:52 +08:00
|
|
|
await this.page2.screenshot(`${testName}`, `02-success-page2-${testName}`);
|
2020-05-13 23:26:30 +08:00
|
|
|
const resp1 = await util.listenOnlyMode(this.page1);
|
2020-05-22 00:45:52 +08:00
|
|
|
await this.page1.screenshot(`${testName}`, `03-success-page1-${testName}`);
|
2020-05-13 23:26:30 +08:00
|
|
|
const resp2 = await util.listenOnlyMode(this.page2);
|
2020-05-22 00:45:52 +08:00
|
|
|
await this.page2.screenshot(`${testName}`, `03-success-page2-${testName}`);
|
2020-05-13 23:26:30 +08:00
|
|
|
console.log({ resp1, resp2 });
|
|
|
|
return resp1 === true && resp2 === true;
|
|
|
|
}
|
|
|
|
|
2020-05-22 00:45:52 +08:00
|
|
|
async forceListenOnly(testName, args, meetingId, customParameter) {
|
2020-05-14 00:54:56 +08:00
|
|
|
console.log('before init');
|
2020-05-22 00:45:52 +08:00
|
|
|
await this.page2.init(args, meetingId, { ...params, fullName: 'Attendee', moderatorPW: '' }, customParameter, testName);
|
|
|
|
await this.page2.screenshot(`${testName}`, `01-${testName}`);
|
2020-05-14 00:54:56 +08:00
|
|
|
console.log('after init');
|
|
|
|
if (await this.page2.page.$('[data-test="audioModalHeader"]')) {
|
2020-05-22 00:45:52 +08:00
|
|
|
await this.page2.screenshot(`${testName}`, `02-fail-${testName}`);
|
2020-05-14 00:54:56 +08:00
|
|
|
return false;
|
|
|
|
}
|
2020-05-22 00:45:52 +08:00
|
|
|
await this.page2.waitForSelector(cpe.audioNotification);
|
|
|
|
await this.page2.screenshot(`${testName}`, `02-success-${testName}`);
|
2020-05-14 00:54:56 +08:00
|
|
|
const resp = await util.forceListenOnly(this.page2);
|
2020-05-22 00:45:52 +08:00
|
|
|
await this.page2.screenshot(`${testName}`, `03-success-${testName}`);
|
2020-05-14 00:54:56 +08:00
|
|
|
console.log(resp);
|
|
|
|
return resp === true;
|
|
|
|
}
|
|
|
|
|
2020-05-22 00:45:52 +08:00
|
|
|
async skipCheck(testName, args, meetingId, customParameter) {
|
2020-05-15 22:49:03 +08:00
|
|
|
console.log('before init');
|
2020-05-22 00:45:52 +08:00
|
|
|
await this.page1.init(args, meetingId, { ...params, fullName: 'Moderator' }, customParameter, testName);
|
|
|
|
await this.page1.screenshot(`${testName}`, `01-${testName}`);
|
2020-05-15 22:49:03 +08:00
|
|
|
console.log('after init');
|
|
|
|
console.log('connecting with microphone');
|
|
|
|
await this.page1.joinMicrophoneWithoutEchoTest();
|
2020-05-22 00:45:52 +08:00
|
|
|
await this.page1.screenshot(`${testName}`, `02-${testName}`);
|
2020-05-15 22:49:03 +08:00
|
|
|
await this.page1.elementRemoved('div[class^="connecting--"]');
|
2020-05-22 00:45:52 +08:00
|
|
|
await this.page1.screenshot(`${testName}`, `03-${testName}`);
|
2020-05-15 22:49:03 +08:00
|
|
|
console.log('before if condition');
|
|
|
|
if (await this.page1.page.evaluate(util.countTestElements, cpe.echoTestYesButton) === true) {
|
2020-05-22 00:45:52 +08:00
|
|
|
await this.page1.screenshot(`${testName}`, `04-fail-${testName}`);
|
2020-05-15 22:49:03 +08:00
|
|
|
console.log('fail');
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
console.log('before skipCheck');
|
|
|
|
const resp = await this.page1.page.evaluate(util.countTestElements, cpe.echoTestYesButton) === false;
|
2020-05-22 00:45:52 +08:00
|
|
|
await this.page1.screenshot(`${testName}`, `04-success-${testName}`);
|
2020-05-15 22:49:03 +08:00
|
|
|
console.log('after skipCheck');
|
|
|
|
console.log(resp);
|
|
|
|
return resp === true;
|
|
|
|
}
|
|
|
|
|
2020-05-22 00:45:52 +08:00
|
|
|
async clientTitle(testName, args, meetingId, customParameter) {
|
|
|
|
testName = 'clientTitle';
|
2020-05-15 22:49:03 +08:00
|
|
|
console.log('before init');
|
2020-05-22 00:45:52 +08:00
|
|
|
await this.page1.init(args, meetingId, { ...params, fullName: 'Moderator' }, customParameter, testName);
|
|
|
|
await this.page1.screenshot(`${testName}`, `01-${testName}`);
|
2020-05-15 22:49:03 +08:00
|
|
|
console.log('after init');
|
|
|
|
await this.page1.waitForSelector('button[aria-label="Microphone"]');
|
2020-05-22 00:45:52 +08:00
|
|
|
await this.page1.screenshot(`${testName}`, `02-${testName}`);
|
2020-05-15 22:49:03 +08:00
|
|
|
if (await !(await this.page1.page.title()).includes(c.docTitle)) {
|
2020-05-22 00:45:52 +08:00
|
|
|
await this.page1.screenshot(`${testName}`, `03-fail-${testName}`);
|
2020-05-15 22:49:03 +08:00
|
|
|
console.log('fail');
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
const resp = await (await this.page1.page.title()).includes(c.docTitle);
|
2020-05-22 00:45:52 +08:00
|
|
|
await this.page1.screenshot(`${testName}`, `03-success-${testName}`);
|
2020-05-15 22:49:03 +08:00
|
|
|
console.log(resp);
|
|
|
|
return resp === true;
|
|
|
|
}
|
|
|
|
|
2020-05-22 00:45:52 +08:00
|
|
|
async askForFeedbackOnLogout(testName, args, meetingId, customParameter) {
|
2020-05-15 22:49:03 +08:00
|
|
|
console.log('before init');
|
2020-05-22 00:45:52 +08:00
|
|
|
await this.page1.init(args, meetingId, { ...params, fullName: 'Moderator' }, customParameter, testName);
|
|
|
|
await this.page1.screenshot(`${testName}`, `01-${testName}`);
|
2020-05-15 22:49:03 +08:00
|
|
|
console.log('after init');
|
|
|
|
await this.page1.closeAudioModal();
|
2020-05-22 00:45:52 +08:00
|
|
|
await this.page1.screenshot(`${testName}`, `02-${testName}`);
|
2020-05-15 22:49:03 +08:00
|
|
|
await this.page1.logoutFromMeeting();
|
2020-05-22 00:45:52 +08:00
|
|
|
await this.page1.screenshot(`${testName}`, `03-${testName}`);
|
2020-05-15 22:49:03 +08:00
|
|
|
await this.page1.waitForSelector(cpe.meetingEndedModal);
|
2020-05-22 00:45:52 +08:00
|
|
|
await this.page1.screenshot(`${testName}`, `04-${testName}`);
|
2020-05-15 22:49:03 +08:00
|
|
|
console.log('audio modal closed');
|
|
|
|
if (await this.page1.page.evaluate(util.countTestElements, cpe.rating) === false) {
|
2020-05-22 00:45:52 +08:00
|
|
|
await this.page1.screenshot(`${testName}`, `05-fail-${testName}`);
|
2020-05-15 22:49:03 +08:00
|
|
|
console.log('fail');
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
const resp = await this.page1.page.evaluate(util.countTestElements, cpe.rating) === true;
|
2020-05-22 00:45:52 +08:00
|
|
|
await this.page1.screenshot(`${testName}`, `05-success-${testName}`);
|
|
|
|
console.log(resp);
|
|
|
|
return resp === true;
|
|
|
|
}
|
|
|
|
|
|
|
|
async displayBrandingArea(testName, args, meetingId, customParameter) {
|
|
|
|
console.log('before init');
|
|
|
|
await this.page1.init(args, meetingId, { ...params, fullName: 'Moderator' }, customParameter, testName);
|
|
|
|
await this.page1.screenshot(`${testName}`, `01-${testName}`);
|
|
|
|
console.log('after init');
|
|
|
|
await this.page1.closeAudioModal();
|
|
|
|
await this.page1.screenshot(`${testName}`, `02-${testName}`);
|
|
|
|
console.log('audio modal closed');
|
|
|
|
await this.page1.waitForSelector('div[data-test="userListContent"]');
|
|
|
|
if (await this.page1.page.evaluate(util.countTestElements, cpe.brandingAreaLogo) === false) {
|
|
|
|
console.log('fail');
|
|
|
|
await this.page1.screenshot(`${testName}`, `03-fail-${testName}`);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
const resp = await this.page1.page.evaluate(util.countTestElements, cpe.brandingAreaLogo) === true;
|
2020-05-15 22:49:03 +08:00
|
|
|
console.log(resp);
|
2020-05-22 00:45:52 +08:00
|
|
|
await this.page1.screenshot(`${testName}`, `03-success-${testName}`);
|
|
|
|
return resp === true;
|
|
|
|
}
|
|
|
|
|
|
|
|
async shortcuts(testName, args, meetingId, customParameter) {
|
|
|
|
console.log('before init');
|
|
|
|
await this.page1.init(args, meetingId, { ...params, fullName: 'Moderator' }, customParameter, testName);
|
|
|
|
await this.page1.screenshot(`${testName}`, `01-${testName}`);
|
|
|
|
console.log('after init');
|
|
|
|
await this.page1.closeAudioModal();
|
|
|
|
await this.page1.screenshot(`${testName}`, `02-${testName}`);
|
|
|
|
console.log('audio modal closed');
|
|
|
|
await this.page1.waitForSelector('button[aria-label="Options"]');
|
|
|
|
await this.page1.page.keyboard.down('Alt');
|
|
|
|
await this.page1.page.keyboard.press('O');
|
|
|
|
if (await this.page1.page.evaluate(util.getTestElement, cpe.verticalListOptions) === false) {
|
|
|
|
console.log('fail');
|
|
|
|
await this.page1.screenshot(`${testName}`, `03-fail-${testName}`);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
const resp = await this.page1.page.evaluate(util.getTestElement, cpe.verticalListOptions) === true;
|
|
|
|
console.log(resp);
|
|
|
|
await this.page1.screenshot(`${testName}`, `03-success-${testName}`);
|
|
|
|
return resp === true;
|
|
|
|
}
|
|
|
|
|
|
|
|
async enableScreensharing(testName, args, meetingId, customParameter) {
|
|
|
|
console.log('before init');
|
|
|
|
await this.page1.init(args, meetingId, { ...params, fullName: 'Moderator' }, customParameter, testName);
|
2020-05-22 20:39:16 +08:00
|
|
|
await this.page1.closeAudioModal();
|
|
|
|
await this.page1.screenshot(`${testName}`, `01-${testName}`);
|
2020-05-22 00:45:52 +08:00
|
|
|
console.log('after init');
|
|
|
|
if (await this.page1.page.evaluate(util.getTestElement, cpe.screenShareButton) === false) {
|
|
|
|
await this.page1.screenshot(`${testName}`, `02-fail-${testName}`);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
const resp = await this.page1.page.evaluate(util.getTestElement, cpe.screenShareButton) === true;
|
|
|
|
await this.page1.screenshot(`${testName}`, `02-success-${testName}`);
|
2020-05-15 22:49:03 +08:00
|
|
|
return resp === true;
|
|
|
|
}
|
|
|
|
|
2020-05-22 20:39:16 +08:00
|
|
|
async enableVideo(testName, args, meetingId, customParameter) {
|
|
|
|
console.log('before init');
|
|
|
|
await this.page1.init(args, meetingId, { ...params, fullName: 'Moderator' }, customParameter, testName);
|
|
|
|
await this.page1.closeAudioModal();
|
|
|
|
await this.page1.screenshot(`${testName}`, `01-${testName}`);
|
|
|
|
console.log('after init');
|
|
|
|
if (await this.page1.page.evaluate(util.getTestElement, cpe.shareWebcamButton) === false) {
|
|
|
|
await this.page1.screenshot(`${testName}`, `02-fail-${testName}`);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
const resp = await this.page1.page.evaluate(util.getTestElement, cpe.shareWebcamButton) === true;
|
|
|
|
await this.page1.screenshot(`${testName}`, `02-success-${testName}`);
|
|
|
|
return resp === true;
|
|
|
|
}
|
|
|
|
|
|
|
|
async autoShareWebcam(testName, args, meetingId, customParameter) {
|
|
|
|
console.log('before init');
|
|
|
|
await this.page1.init(args, meetingId, { ...params, fullName: 'Moderator' }, customParameter, testName);
|
|
|
|
await this.page1.screenshot(`${testName}`, `01-${testName}`);
|
|
|
|
console.log('after init');
|
|
|
|
await this.page1.closeAudioModal();
|
|
|
|
await this.page1.screenshot(`${testName}`, `02-${testName}`);
|
|
|
|
if (await this.page1.page.evaluate(util.getTestElement, cpe.webcamSettingsModal) === true) {
|
|
|
|
await this.page1.screenshot(`${testName}`, `03-fail-${testName}`);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
const resp = await this.page1.page.evaluate(util.getTestElement, cpe.webcamSettingsModal) === false;
|
|
|
|
await this.page1.screenshot(`${testName}`, `03-success-${testName}`);
|
|
|
|
return resp === true;
|
|
|
|
}
|
|
|
|
|
2020-05-13 21:53:14 +08:00
|
|
|
async closePage(page) {
|
|
|
|
page.close();
|
|
|
|
}
|
|
|
|
|
2020-05-13 23:26:30 +08:00
|
|
|
async close(page1, page2) {
|
2020-05-13 21:53:14 +08:00
|
|
|
page1.close();
|
|
|
|
page2.close();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = exports = CustomParameters;
|