enableScreenSharing() test spec

This commit is contained in:
Mohamed Amine Ben Salah 2020-05-21 13:45:52 -03:00
parent c23752926f
commit 4d468e65c2
8 changed files with 257 additions and 80 deletions

View File

@ -3,22 +3,25 @@ BBB_SERVER_URL=""
BBB_SHARED_SECRET="" BBB_SHARED_SECRET=""
# browserless credentials # browserless credentials
BROWSERLESS_ENABLED=false # true/false BROWSERLESS_ENABLED=false # true/false
BROWSERLESS_URL= # ip:port BROWSERLESS_URL= # ip:port
BROWSERLESS_TOKEN= # token BROWSERLESS_TOKEN= # token
# collecting metrics # collecting metrics
BBB_COLLECT_METRICS=true # (true/false): true to collect metrics BBB_COLLECT_METRICS=true # (true/false): true to collect metrics
METRICS_FOLDER=/tmp/bbb-metrics # the metrics output folder 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 # 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 CAMERA_SHARE_FAILED_WAIT_TIME=15000 # this is set by default in the BBB server
# audio test # 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_TALKING=1
USER_LIST_VLIST_BOTS_LISTENING=100 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

View File

@ -5,4 +5,5 @@ downloads/*
!downloads/downloads.txt !downloads/downloads.txt
.directory .directory
.env .env
media/* media/*
data/

View File

@ -22,7 +22,7 @@ class Page {
} }
// Join BigBlueButton meeting // Join BigBlueButton meeting
async init(args, meetingId, newParams, customParameter) { async init(args, meetingId, newParams, customParameter, testFolderName) {
try { try {
this.effectiveParams = newParams || params; this.effectiveParams = newParams || params;
const isModerator = this.effectiveParams.moderatorPW; const isModerator = this.effectiveParams.moderatorPW;
@ -54,7 +54,7 @@ class Page {
const checkForGetMetrics = async () => { const checkForGetMetrics = async () => {
if (process.env.BBB_COLLECT_METRICS === 'true') { if (process.env.BBB_COLLECT_METRICS === 'true') {
await this.page.waitForSelector('[data-test^="userListItem"]'); await this.page.waitForSelector('[data-test^="userListItem"]');
await this.getMetrics(); await this.getMetrics(testFolderName);
} }
}; };
// if (process.env.IS_AUDIO_TEST !== 'true') { // if (process.env.IS_AUDIO_TEST !== 'true') {
@ -234,25 +234,24 @@ class Page {
await this.page.type(element, text); await this.page.type(element, text);
} }
async screenshot(testName, relief = false) { async screenshot(testFolderName, testFileName, relief = false) {
if (process.env.GENERATE_EVIDENCES === 'true') { if (process.env.GENERATE_EVIDENCES === 'true') {
const today = moment().format('D MMM, YYYY'); const today = moment().format('DD-MM-YYYY');
const dir = `../${process.env.TEST_FOLDER}`; const dir = path.join(__dirname, `../${process.env.TEST_FOLDER}`);
if (!fs.existsSync(path.join(__dirname, `${dir}`))) { if (!fs.existsSync(dir)) {
fs.mkdirSync(path.join(__dirname, `${dir}`)); fs.mkdirSync(dir);
} }
const testResultsFolder = `${dir}/test-${today}`; const testResultsFolder = `${dir}/test-${today}-${testFolderName}`;
if (!fs.existsSync(path.join(__dirname, `${testResultsFolder}`))) { if (!fs.existsSync(testResultsFolder)) {
fs.mkdirSync(path.join(__dirname, `${testResultsFolder}`)); fs.mkdirSync(testResultsFolder);
} }
const screenshots = `${testResultsFolder}/screenshots`; const screenshots = `${testResultsFolder}/screenshots`;
if (!fs.existsSync(path.join(__dirname, `${screenshots}`))) { if (!fs.existsSync(screenshots)) {
fs.mkdirSync(path.join(__dirname, `${screenshots}`)); fs.mkdirSync(screenshots);
} }
if (relief) await helper.sleep(1000); if (relief) await helper.sleep(1000);
const filename = `${testName}.png`; const filename = `${testFileName}.png`;
const dirTest = `${this.parentDir}/${screenshots}/${filename}`; await this.page.screenshot({ path: `${screenshots}/${filename}` });
await this.page.screenshot({ dirTest });
this.screenshotIndex++; this.screenshotIndex++;
} }
} }
@ -268,20 +267,20 @@ class Page {
await this.page.waitForSelector(element, { timeout: 0 }); await this.page.waitForSelector(element, { timeout: 0 });
} }
async getMetrics(testName) { async getMetrics(testFolderName) {
const pageMetricsObj = {}; const pageMetricsObj = {};
const dir = `../${process.env.TEST_FOLDER}`; const today = moment().format('DD-MM-YYYY');
const today = moment().format('D MMM, YYYY'); const dir = path.join(__dirname, `../${process.env.TEST_FOLDER}`);
const testExecutionResults = testName ? `${dir}/${testName}-${today}` : `${dir}/test-${today}`; if (!fs.existsSync(dir)) {
const metricsFolder = `${dir}/${testExecutionResults}/metrics`; fs.mkdirSync(dir);
if (!fs.existsSync(path.join(__dirname, `${dir}`))) {
fs.mkdirSync(path.join(__dirname, `${dir}`));
} }
if (!fs.existsSync(path.join(__dirname, `${testExecutionResults}`))) { const testExecutionResultsName = `${dir}/test-${today}-${testFolderName}`;
fs.mkdirSync(path.join(__dirname, `${testExecutionResults}`)); if (!fs.existsSync(testExecutionResultsName)) {
fs.mkdirSync(testExecutionResultsName);
} }
if (!fs.existsSync(path.join(__dirname, `${metricsFolder}`))) { const metricsFolder = `${testExecutionResultsName}/metrics`;
fs.mkdirSync(path.join(__dirname, `${metricsFolder}`)); if (!fs.existsSync(metricsFolder)) {
fs.mkdirSync(metricsFolder);
} }
await this.waitForSelector('[data-test^="userListItem"]'); await this.waitForSelector('[data-test^="userListItem"]');
const totalNumberOfUsersMongo = await this.page.evaluate(() => { const totalNumberOfUsersMongo = await this.page.evaluate(() => {
@ -295,9 +294,10 @@ class Page {
pageMetricsObj.totalNumberOfUsersMongoObj = totalNumberOfUsersMongo; pageMetricsObj.totalNumberOfUsersMongoObj = totalNumberOfUsersMongo;
pageMetricsObj.totalNumberOfUsersDomObj = totalNumberOfUsersDom; pageMetricsObj.totalNumberOfUsersDomObj = totalNumberOfUsersDom;
pageMetricsObj[`metricObj-${this.meetingId}`] = metric; 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 = () => { const createFile = () => {
try { try {
fs.appendFileSync(path.join(__dirname, `${metricsFolder}/metrics-${this.effectiveParams.fullName}-${this.meetingId}.json`), `${JSON.stringify(pageMetricsObj)},\n`); fs.appendFileSync(metricsFile, `${JSON.stringify(pageMetricsObj)},\n`);
} catch (error) { } catch (error) {
console.log(error); console.log(error);
} }

View File

@ -7,14 +7,15 @@ describe('Custom parameters', () => {
jest.setTimeout(30000); jest.setTimeout(30000);
}); });
// This test spec sets the userdata-autoJoin parameter to false // This test spec sets the userdata-autoJoin parameter to false
// and checks if the users don't get audio modal on login // and checks that the users don't get audio modal on login
test('Auto join', async () => { test('Auto join', async () => {
const test = new CustomParameters(); const test = new CustomParameters();
let response; let response;
try { try {
console.log('before'); console.log('before');
response = await test.autoJoin(Page.getArgs(), undefined, c.autoJoin); const testName = 'autoJoin';
response = await test.autoJoin(testName, Page.getArgs(), undefined, c.autoJoin);
console.log('after'); console.log('after');
} catch (e) { } catch (e) {
console.log(e); console.log(e);
@ -24,14 +25,15 @@ describe('Custom parameters', () => {
expect(response).toBe(true); expect(response).toBe(true);
}); });
// This test spec sets the userdata-listenOnlyMode parameter to false // This test spec sets the userdata-listenOnlyMode parameter to false
// and checks if the users can't see or use listen Only mode // and checks that the users can't see or use listen Only mode
test('Listen Only Mode', async () => { test('Listen Only Mode', async () => {
const test = new CustomParameters(); const test = new CustomParameters();
let response; let response;
try { try {
console.log('before'); console.log('before');
response = await test.listenOnlyMode(Page.getArgs(), undefined, c.listenOnlyMode); const testName = 'listenOnlyMode';
response = await test.listenOnlyMode(testName, Page.getArgs(), undefined, c.listenOnlyMode);
console.log('after'); console.log('after');
} catch (e) { } catch (e) {
console.log(e); console.log(e);
@ -41,31 +43,33 @@ describe('Custom parameters', () => {
expect(response).toBe(true); expect(response).toBe(true);
}); });
// This test spec sets the userdata-forceListenOnly parameter to false // This test spec sets the userdata-forceListenOnly parameter to false
// and checks if the Viewers can only use listen only mode // and checks that the Viewers can only use listen only mode
test('Force Listen Only', async () => { test('Force Listen Only', async () => {
const test = new CustomParameters(); const test = new CustomParameters();
let response; let response;
try { try {
console.log('before'); console.log('before');
response = await test.forceListenOnly(Page.getArgs(), undefined, c.forceListenOnly); const testName = 'forceListenOnly';
response = await test.forceListenOnly(testName, Page.getArgs(), undefined, c.forceListenOnly);
console.log('after'); console.log('after');
} catch (e) { } catch (e) {
console.log(e); console.log(e);
} finally { } finally {
await test.close(test.page1, test.page2); await test.closePage(test.page2);
} }
expect(response).toBe(true); expect(response).toBe(true);
}); });
// This test spec sets the userdata-skipCheck parameter to true // This test spec sets the userdata-skipCheck parameter to true
// and checks if the users automatically skip audio check when clicking on Microphone // and checks that the users automatically skip audio check when clicking on Microphone
test('Skip audio check', async () => { test('Skip audio check', async () => {
const test = new CustomParameters(); const test = new CustomParameters();
let response; let response;
try { try {
console.log('before'); console.log('before');
response = await test.skipCheck(Page.getArgs(), undefined, c.skipCheck); const testName = 'skipCheck';
response = await test.skipCheck(testName, Page.getArgs(), undefined, c.skipCheck);
console.log('after'); console.log('after');
} catch (e) { } catch (e) {
console.log(e); console.log(e);
@ -75,14 +79,15 @@ describe('Custom parameters', () => {
expect(response).toBe(true); expect(response).toBe(true);
}); });
// This test spec sets the userdata-clientTitle parameter to some value // This test spec sets the userdata-clientTitle parameter to some value
// and checks if the meeting window contains that value // and checks that the meeting window name starts with that value
test('Client title', async () => { test('Client title', async () => {
const test = new CustomParameters(); const test = new CustomParameters();
let response; let response;
try { try {
console.log('before'); console.log('before');
response = await test.clientTitle(Page.getArgs(), undefined, c.clientTitle); const testName = 'clientTitle';
response = await test.clientTitle(testName, Page.getArgs(), undefined, c.clientTitle);
console.log('after'); console.log('after');
} catch (e) { } catch (e) {
console.log(e); console.log(e);
@ -92,14 +97,70 @@ describe('Custom parameters', () => {
expect(response).toBe(true); expect(response).toBe(true);
}); });
// This test spec sets the userdata-askForFeedbackOnLogout parameter to true // This test spec sets the userdata-askForFeedbackOnLogout parameter to true
// and checks if the users automatically get asked for feedback on logout page // and checks that the users automatically get asked for feedback on logout page
test('Ask For Feed back On Logout', async () => { test('Ask For Feed back On Logout', async () => {
const test = new CustomParameters(); const test = new CustomParameters();
let response; let response;
try { try {
console.log('before'); console.log('before');
response = await test.askForFeedbackOnLogout(Page.getArgs(), undefined, c.askForFeedbackOnLogout); const testName = 'askForFeedbackOnLogout';
response = await test.askForFeedbackOnLogout(testName, Page.getArgs(), undefined, c.askForFeedbackOnLogout);
console.log('after');
} catch (e) {
console.log(e);
} finally {
await test.closePage(test.page1);
}
expect(response).toBe(true);
});
// This test spec sets the userdata-displayBrandingArea parameter to true and add a logo link
// and checks that the users see the logo displaying in the meeting
test('Display Branding Area', async () => {
const test = new CustomParameters();
let response;
try {
console.log('before');
const testName = 'displayBrandingArea';
const parameterWithLogo = `${c.displayBrandingArea}&${c.logo}`;
response = await test.displayBrandingArea(testName, Page.getArgs(), undefined, parameterWithLogo);
console.log('after');
} catch (e) {
console.log(e);
} finally {
await test.closePage(test.page1);
}
expect(response).toBe(true);
});
// This test spec sets the userdata-shortcuts parameter to one or a list of shortcuts parameters
// and checks that the users can use those shortcuts
test('Shortcuts', async () => {
const test = new CustomParameters();
let response;
try {
console.log('before');
const testName = 'shortcuts';
response = await test.shortcuts(testName, Page.getArgs(), undefined, c.shortcuts);
console.log('after');
} catch (e) {
console.log(e);
} finally {
await test.closePage(test.page1);
}
expect(response).toBe(true);
});
// This test spec sets the userdata-enableScreensharing parameter to false
// and checks that the Moderator can not see the Screen sharing button
test('Enable Screensharing', async () => {
const test = new CustomParameters();
let response;
try {
console.log('before');
const testName = 'enableScreensharing';
response = await test.enableScreensharing(testName, Page.getArgs(), undefined, c.enableScreensharing);
console.log('after'); console.log('after');
} catch (e) { } catch (e) {
console.log(e); console.log(e);

View File

@ -6,3 +6,7 @@ const docTitle = 'puppeteer';
exports.docTitle = docTitle; exports.docTitle = docTitle;
exports.clientTitle = `userdata-clientTitle=${docTitle}`; exports.clientTitle = `userdata-clientTitle=${docTitle}`;
exports.askForFeedbackOnLogout = 'userdata-askForFeedbackOnLogout=true'; exports.askForFeedbackOnLogout = 'userdata-askForFeedbackOnLogout=true';
exports.displayBrandingArea = 'userdata-displayBrandingArea=true';
exports.logo = 'logo=https://bigbluebutton.org/wp-content/themes/bigbluebutton/library/images/bigbluebutton-logo.png';
exports.shortcuts = 'userdata-shortcuts=["openOptions", "toggleUserList", "toggleMute", "joinAudio", "leaveAudio", "togglePublicChat", "hidePrivateChat", "closePrivateChat", "openActions", "openStatus"]';
exports.enableScreensharing = 'userdata-enableScreensharing=false';

View File

@ -1,5 +1,7 @@
const path = require('path');
const Page = require('../core/page'); const Page = require('../core/page');
const params = require('../params'); const params = require('../params');
const helper = require('../core/helper');
const cpe = require('./elements'); const cpe = require('./elements');
const util = require('./util'); const util = require('./util');
const c = require('./constants'); const c = require('./constants');
@ -8,99 +10,194 @@ class CustomParameters {
constructor() { constructor() {
this.page1 = new Page(); this.page1 = new Page();
this.page2 = new Page(); this.page2 = new Page();
this.name = name;
this.screenshotIndex = 0;
this.parentDir = this.getParentDir(__dirname);
} }
async autoJoin(args, meetingId, customParameter) { getParentDir(dir) {
console.log('before init'); const tmp = dir.split('/');
await this.page1.init(args, meetingId, { ...params, fullName: 'Moderator' }, customParameter); tmp.pop();
console.log('after init'); return tmp.join('/');
await this.page1.waitForSelector('div[class^="spinner--"]', { timeout: 5000 });
console.log('after spinner');
await this.page1.waitForSelector(cpe.whiteboard, { timeout: 5000 });
const resp = await util.autoJoinTest(this.page1);
console.log(resp, 'response');
return resp;
} }
async listenOnlyMode(args, meetingId, customParameter) { async autoJoin(testName, args, meetingId, customParameter) {
console.log('before init'); console.log('before init');
await this.page1.init(args, meetingId, { ...params, fullName: 'Moderator' }, customParameter); await this.page1.init(args, meetingId, { ...params, fullName: 'Moderator' }, customParameter, testName);
await this.page2.init(args, this.page1.meetingId, { ...params, fullName: 'Attendee', moderatorPW: '' }, customParameter); await this.page1.screenshot(`${testName}`, `01-${testName}`);
console.log('after init'); console.log('after init');
if (await this.page1.page.$('[data-test="audioModalHeader"]')) { 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;
}
async listenOnlyMode(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-page1-${testName}`);
await this.page2.init(args, this.page1.meetingId, { ...params, fullName: 'Attendee', moderatorPW: '' }, customParameter, testName);
await this.page2.screenshot(`${testName}`, `01-page2-${testName}`);
console.log('after init');
if (await this.page2.page.$('[data-test="audioModalHeader"]')) {
await this.page2.screenshot(`${testName}`, `02-fail-${testName}`);
return false; return false;
} }
await this.page1.page.waitFor(cpe.echoTestYesButton); await this.page1.page.waitFor(cpe.echoTestYesButton);
await this.page1.screenshot(`${testName}`, `02-success-page1-${testName}`);
await this.page2.page.waitFor(cpe.echoTestYesButton); await this.page2.page.waitFor(cpe.echoTestYesButton);
await this.page2.screenshot(`${testName}`, `02-success-page2-${testName}`);
const resp1 = await util.listenOnlyMode(this.page1); const resp1 = await util.listenOnlyMode(this.page1);
await this.page1.screenshot(`${testName}`, `03-success-page1-${testName}`);
const resp2 = await util.listenOnlyMode(this.page2); const resp2 = await util.listenOnlyMode(this.page2);
await this.page2.screenshot(`${testName}`, `03-success-page2-${testName}`);
console.log({ resp1, resp2 }); console.log({ resp1, resp2 });
return resp1 === true && resp2 === true; return resp1 === true && resp2 === true;
} }
async forceListenOnly(args, meetingId, customParameter) { async forceListenOnly(testName, args, meetingId, customParameter) {
console.log('before init'); console.log('before init');
await this.page2.init(args, meetingId, { ...params, fullName: 'Attendee', moderatorPW: '' }, customParameter); await this.page2.init(args, meetingId, { ...params, fullName: 'Attendee', moderatorPW: '' }, customParameter, testName);
await this.page2.screenshot(`${testName}`, `01-${testName}`);
console.log('after init'); console.log('after init');
if (await this.page2.page.$('[data-test="audioModalHeader"]')) { if (await this.page2.page.$('[data-test="audioModalHeader"]')) {
await this.page2.screenshot(`${testName}`, `02-fail-${testName}`);
return false; return false;
} }
await this.page2.page.waitFor(cpe.audioNotification); await this.page2.waitForSelector(cpe.audioNotification);
await this.page2.screenshot(`${testName}`, `02-success-${testName}`);
const resp = await util.forceListenOnly(this.page2); const resp = await util.forceListenOnly(this.page2);
await this.page2.screenshot(`${testName}`, `03-success-${testName}`);
console.log(resp); console.log(resp);
return resp === true; return resp === true;
} }
async skipCheck(args, meetingId, customParameter) { async skipCheck(testName, args, meetingId, customParameter) {
console.log('before init'); console.log('before init');
await this.page1.init(args, meetingId, { ...params, fullName: 'Moderator' }, customParameter); await this.page1.init(args, meetingId, { ...params, fullName: 'Moderator' }, customParameter, testName);
await this.page1.screenshot(`${testName}`, `01-${testName}`);
console.log('after init'); console.log('after init');
console.log('connecting with microphone'); console.log('connecting with microphone');
await this.page1.joinMicrophoneWithoutEchoTest(); await this.page1.joinMicrophoneWithoutEchoTest();
await this.page1.screenshot(`${testName}`, `02-${testName}`);
await this.page1.elementRemoved('div[class^="connecting--"]'); await this.page1.elementRemoved('div[class^="connecting--"]');
await this.page1.screenshot(`${testName}`, `03-${testName}`);
console.log('before if condition'); console.log('before if condition');
if (await this.page1.page.evaluate(util.countTestElements, cpe.echoTestYesButton) === true) { if (await this.page1.page.evaluate(util.countTestElements, cpe.echoTestYesButton) === true) {
await this.page1.screenshot(`${testName}`, `04-fail-${testName}`);
console.log('fail'); console.log('fail');
return false; return false;
} }
console.log('before skipCheck'); console.log('before skipCheck');
const resp = await this.page1.page.evaluate(util.countTestElements, cpe.echoTestYesButton) === false; const resp = await this.page1.page.evaluate(util.countTestElements, cpe.echoTestYesButton) === false;
await this.page1.screenshot(`${testName}`, `04-success-${testName}`);
console.log('after skipCheck'); console.log('after skipCheck');
console.log(resp); console.log(resp);
return resp === true; return resp === true;
} }
async clientTitle(args, meetingId, customParameter) { async clientTitle(testName, args, meetingId, customParameter) {
testName = 'clientTitle';
console.log('before init'); console.log('before init');
await this.page1.init(args, meetingId, { ...params, fullName: 'Moderator' }, customParameter); await this.page1.init(args, meetingId, { ...params, fullName: 'Moderator' }, customParameter, testName);
await this.page1.screenshot(`${testName}`, `01-${testName}`);
console.log('after init'); console.log('after init');
await this.page1.waitForSelector('button[aria-label="Microphone"]'); await this.page1.waitForSelector('button[aria-label="Microphone"]');
await this.page1.screenshot(`${testName}`, `02-${testName}`);
if (await !(await this.page1.page.title()).includes(c.docTitle)) { if (await !(await this.page1.page.title()).includes(c.docTitle)) {
await this.page1.screenshot(`${testName}`, `03-fail-${testName}`);
console.log('fail'); console.log('fail');
return false; return false;
} }
const resp = await (await this.page1.page.title()).includes(c.docTitle); const resp = await (await this.page1.page.title()).includes(c.docTitle);
await this.page1.screenshot(`${testName}`, `03-success-${testName}`);
console.log(resp); console.log(resp);
return resp === true; return resp === true;
} }
async askForFeedbackOnLogout(args, meetingId, customParameter) { async askForFeedbackOnLogout(testName, args, meetingId, customParameter) {
console.log('before init'); console.log('before init');
await this.page1.init(args, meetingId, { ...params, fullName: 'Moderator' }, customParameter); await this.page1.init(args, meetingId, { ...params, fullName: 'Moderator' }, customParameter, testName);
await this.page1.screenshot(`${testName}`, `01-${testName}`);
console.log('after init'); console.log('after init');
await this.page1.closeAudioModal(); await this.page1.closeAudioModal();
await this.page1.screenshot(`${testName}`, `02-${testName}`);
await this.page1.logoutFromMeeting(); await this.page1.logoutFromMeeting();
await this.page1.screenshot(`${testName}`, `03-${testName}`);
await this.page1.waitForSelector(cpe.meetingEndedModal); await this.page1.waitForSelector(cpe.meetingEndedModal);
await this.page1.screenshot(`${testName}`, `04-${testName}`);
console.log('audio modal closed'); console.log('audio modal closed');
if (await this.page1.page.evaluate(util.countTestElements, cpe.rating) === false) { if (await this.page1.page.evaluate(util.countTestElements, cpe.rating) === false) {
await this.page1.screenshot(`${testName}`, `05-fail-${testName}`);
console.log('fail'); console.log('fail');
return false; return false;
} }
const resp = await this.page1.page.evaluate(util.countTestElements, cpe.rating) === true; const resp = await this.page1.page.evaluate(util.countTestElements, cpe.rating) === true;
await this.page1.screenshot(`${testName}`, `05-success-${testName}`);
console.log(resp); console.log(resp);
return resp === true; 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;
console.log(resp);
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);
await this.page1.screenshot(`${testName}`, `01-page1-${testName}`);
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}`);
return resp === true;
}
async closePage(page) { async closePage(page) {
page.close(); page.close();
} }

View File

@ -8,3 +8,6 @@ exports.options = 'button[aria-label="Options"]';
exports.logout = 'li[data-test="logout"]'; exports.logout = 'li[data-test="logout"]';
exports.meetingEndedModal = 'div[data-test="meetingEndedModal"]'; exports.meetingEndedModal = 'div[data-test="meetingEndedModal"]';
exports.rating = 'div[data-test="rating"]'; exports.rating = 'div[data-test="rating"]';
exports.brandingAreaLogo = 'div[class^="branding--"]';
exports.verticalListOptions = 'div[aria-expanded="true"] > div[class^="scrollable--"] > ul[class^="verticalList"]';
exports.screenShareButton = 'button[aria-label="Share your screen"]';

View File

@ -1,5 +1,8 @@
async function autoJoinTest(test) { async function autoJoinTest(test) {
const resp = await test.page.evaluate(async () => await document.querySelectorAll('div[aria-label="Join audio modal"]').length === 0) !== false; const resp = await test.page.evaluate(async () => {
const rep = await document.querySelectorAll('div[aria-label="Join audio modal"]').length === 0;
return rep !== false;
});
return resp; return resp;
} }
@ -21,7 +24,7 @@ async function forceListenOnly(test) {
try { try {
const resp = await test.page.evaluate(async () => { const resp = await test.page.evaluate(async () => {
await document.querySelectorAll('div[class^="connecting--"]')[0]; await document.querySelectorAll('div[class^="connecting--"]')[0];
if (await test.page.$('button[aria-label="Echo is audible"]')) { if (await document.querySelectorAll('button[aria-label="Echo is audible"]').length > 0) {
return false; return false;
} }
const audibleNotification = await document.querySelectorAll('div[class^="toastContainer--"]')[0].innerText === 'You have joined the audio conference'; const audibleNotification = await document.querySelectorAll('div[class^="toastContainer--"]')[0].innerText === 'You have joined the audio conference';
@ -53,6 +56,11 @@ async function countTestElements(element) {
return document.querySelectorAll(element).length !== 0; return document.querySelectorAll(element).length !== 0;
} }
async function getTestElement(element) {
return document.querySelectorAll(element).length === 0;
}
exports.getTestElement = getTestElement;
exports.countTestElements = countTestElements; exports.countTestElements = countTestElements;
exports.autoJoinTest = autoJoinTest; exports.autoJoinTest = autoJoinTest;
exports.listenOnlyMode = listenOnlyMode; exports.listenOnlyMode = listenOnlyMode;