improvements to check all shortcuts

This commit is contained in:
Anton Barboza 2021-10-18 11:23:00 -03:00
parent 0f1f8b9fbb
commit ff97cbb516
4 changed files with 84 additions and 19 deletions

View File

@ -9,7 +9,6 @@ exports.clientTitle = `userdata-bbb_client_title=${docTitle}`;
exports.askForFeedbackOnLogout = 'userdata-bbb_ask_for_feedback_on_logout=true';
exports.displayBrandingArea = 'userdata-bbb_display_branding_area=true';
exports.logo = 'logo=https://bigbluebutton.org/wp-content/themes/bigbluebutton/library/images/bigbluebutton-logo.png';
exports.shortcuts = 'userdata-bbb_shortcuts=["openOptions", "toggleUserList", "toggleMute", "joinAudio", "leaveAudio", "togglePublicChat", "hidePrivateChat", "closePrivateChat", "openActions", "openStatus"]';
exports.enableScreensharing = 'userdata-bbb_enable_screen_sharing=false';
exports.enableVideo = 'userdata-bbb_enable_video=false';
exports.autoShareWebcam = 'userdata-bbb_auto_share_webcam=true';
@ -33,3 +32,35 @@ exports.skipVideoPreview = 'userdata-bbb_skip_video_preview=true';
exports.skipVideoPreviewOnFirstJoin = 'userdata-bbb_skip_video_preview_on_first_join=true';
exports.mirrorOwnWebcam = 'userdata-bbb_mirror_own_webcam=true';
exports.showParticipantsOnLogin = 'userdata-bbb_show_participants_on_login=false';
// Shortcuts
exports.shortcuts = 'userdata-bbb_shortcuts=[$]';
exports.initialShortcuts = [{
param: 'openOptions',
key: 'O'
}, {
param: 'toggleUserList',
key: 'U'
}, {
param: 'togglePublicChat',
key: 'P'
}, {
param: 'openActions',
key: 'A'
}, {
param: 'joinAudio',
key: 'J'
}];
exports.laterShortcuts = [{
param: 'toggleMute',
key: 'M'
}, {
param: 'leaveAudio',
key: 'L'
}, {
param: 'hidePrivateChat',
key: 'H'
}, {
param: 'closePrivateChat',
key: 'G'
}];

View File

@ -218,23 +218,30 @@ class CustomParameters {
async shortcuts(testName, customParameter) {
try {
await this.page1.init(true, true, testName, 'Moderator', undefined, customParameter);
await this.page2.init(false, true, testName, 'Attendee', this.page1.meetingId);
await this.page1.startRecording(testName);
await this.page1.screenshot(`${testName}`, `01-${testName}`);
await this.page1.screenshot(`${testName}`, `02-${testName}`);
await this.page1.logger('audio modal closed');
await this.page1.waitForSelector(e.options);
await this.page1.page.keyboard.down('Alt');
await this.page1.page.keyboard.press('O');
const resp = await this.page1.page.evaluate(checkElementLengthEqualTo, e.verticalListOptions, 0);
if (!resp) {
await this.page1.screenshot(`${testName}`, `03-fail-${testName}`);
await this.page1.logger(testName, ' failed');
return false;
}
await this.page1.screenshot(`${testName}`, `03-success-${testName}`);
await this.page1.logger(testName, ' passed');
await this.page1.screenshot(`${testName}`, '01-after-close-audio-modal');
return resp === true;
// Check the initial shortcuts that can be used right after joining the meeting
const check1 = await util.checkShortcutsArray(this.page1, c.initialShortcuts);
if (!check1) return false;
await this.page1.bringToFront();
// Join audio
await this.page1.waitAndClick(e.joinAudio);
await this.page1.joinMicrophone();
await this.page1.screenshot(`${testName}`, '02-after-join-audio');
// Open private chat
await this.page1.waitAndClick(e.userListItem);
await this.page1.waitAndClick(e.activeChat);
await this.page1.waitForSelector(e.hidePrivateChat);
await this.page1.screenshot(`${testName}`, '03-after-open-private-chat');
// Check the later shortcuts that can be used after joining audio and opening private chat
const check2 = await util.checkShortcutsArray(this.page1, c.laterShortcuts);
return check2 === true;
} catch (err) {
await this.page1.logger(err);
return false;

View File

@ -207,14 +207,15 @@ const customParametersTest = () => {
try {
const testName = 'shortcuts';
await page.logger('before ', testName);
response = await test.shortcuts(testName, util.encodeCustomParams(c.shortcuts));
const shortcutParam = util.getAllShortcutParams();
response = await test.shortcuts(testName, util.encodeCustomParams(shortcutParam));
await test.page1.stopRecording();
screenshot = await test.page1.page.screenshot();
await page.logger('after ', testName);
} catch (err) {
await page.logger(err);
} finally {
await test.closePage(test.page1);
await test.close(test.page1, test.page2);
}
expect(response).toBe(true);
Page.checkRegression(0.5, screenshot);

View File

@ -1,7 +1,8 @@
const path = require('path');
const e = require('../core/elements');
const c = require('./constants');
const { ELEMENT_WAIT_LONGER_TIME } = require('../core/constants');
const { checkElementLengthEqualTo, checkElementLengthDifferentTo, checkElementText } = require('../core/util');
const { checkElementLengthEqualTo, checkElementLengthDifferentTo, checkElementText, checkElement } = require('../core/util');
async function autoJoinTest(test) {
try {
@ -160,6 +161,28 @@ function encodeCustomParams(param) {
}
}
function getAllShortcutParams() {
const getParams = (shortcutArray) => {
return Object.values(shortcutArray.map(e => `"${e.param}"`));
}
return c.shortcuts.replace('$', [...getParams(c.initialShortcuts), ...getParams(c.laterShortcuts)]);
}
async function checkAccesskey(test, key) {
return test.page.evaluate(checkElement, `[accesskey="${key}"]`);
}
async function checkShortcutsArray(test, shortcut) {
for (const { param, key } of shortcut) {
const resp = await checkAccesskey(test, key);
if (!resp) {
await test.logger(`${param} shortcut failed`)
return false;
}
}
return true;
}
exports.zoomIn = zoomIn;
exports.zoomOut = zoomOut;
exports.poll = poll;
@ -173,3 +196,6 @@ exports.listenOnlyMode = listenOnlyMode;
exports.forceListenOnly = forceListenOnly;
exports.skipCheck = skipCheck;
exports.encodeCustomParams = encodeCustomParams;
exports.getAllShortcutParams = getAllShortcutParams;
exports.checkAccesskey = checkAccesskey;
exports.checkShortcutsArray = checkShortcutsArray;