Skip to content

Commit

Permalink
Merge pull request #13920 from antonbsa/playwright-tests-user-and-cus…
Browse files Browse the repository at this point in the history
…tomparameter

test: Adds User and customParameters test suite
  • Loading branch information
antobinary committed Dec 17, 2021
2 parents 0dce2d7 + 6867959 commit b617eb2
Show file tree
Hide file tree
Showing 14 changed files with 928 additions and 46 deletions.
1 change: 0 additions & 1 deletion bigbluebutton-tests/playwright/core/constants.js
Expand Up @@ -2,7 +2,6 @@
exports.ELEMENT_WAIT_TIME = 5000;
exports.ELEMENT_WAIT_LONGER_TIME = 10000;
exports.LOOP_INTERVAL = 1200;
exports.NOTIFICATION_WAIT_TIME = 6000;
exports.USER_LIST_VLIST_BOTS_LISTENING = 50;

// STRESS TESTS VARS
Expand Down
55 changes: 53 additions & 2 deletions bigbluebutton-tests/playwright/core/elements.js
Expand Up @@ -9,18 +9,29 @@ exports.screenShareVideo = 'video[id="screenshareVideo"]';
exports.closeModal = 'button[data-test="modalDismissButton"]';
exports.isSharingScreen = 'div[data-test="isSharingScreen"]';
exports.pdfFileName = '100PagesFile.pdf';
exports.raiseHandLabel = 'button[data-test="raiseHandLabel"]';
exports.lowerHandLabel = 'button[data-test="lowerHandLabel"]';
exports.meetingEndedModal = 'div[data-test="meetingEndedModal"]';
exports.logout = 'li[data-test="logout"]';
exports.rating = 'div[data-test="rating"]';
// Accesskey
exports.chatButtonKey = '[accesskey="P"]';
exports.userListButton = '[accesskey="U"]';

// Audio
exports.joinAudio = 'button[data-test="joinAudio"]';
exports.audioModal = 'div[aria-label="Join audio modal"]';
exports.closeAudioButton = 'button[aria-label="Close Join audio modal"]';
exports.listenOnlyButton = 'button[aria-label="Listen only"]';
exports.connecting = 'span[data-test="connecting"]';
exports.connectingStatus = 'div[class^="connecting--"]';
exports.leaveAudio = 'button[data-test="leaveAudio"]';
exports.microphoneButton = 'button[aria-label="Microphone"]';
exports.echoYesButton = 'button[aria-label="Echo is audible"]';
exports.connectingToEchoTest = 'span[data-test="connectingToEchoTest"]';
exports.isTalking = '[data-test="isTalking"]';
exports.talkingIndicator = 'div[class^="isTalkingWrapper--"] > div[class^="speaking--"]';
exports.audioModalHeader = '[data-test="audioModalHeader"]';

// Breakout
exports.createBreakoutRooms = 'li[data-test="createBreakoutRooms"]';
Expand All @@ -46,6 +57,7 @@ exports.chatSave = 'li[data-test="chatSave"]';
exports.chatCopy = 'li[data-test="chatCopy"]';
exports.chatTitle = 'div[data-test="chatTitle"]';
exports.activeChat = 'li[data-test="activeChat"]';
exports.hidePrivateChat = 'button[aria-label^="Hide Private Chat with"]';
// Messages
exports.message = 'Hello World!';
exports.message1 = 'Hello User2';
Expand All @@ -56,8 +68,19 @@ exports.publicMessage2 = 'This is a Public Message from User2';
exports.chatUserMessageText = 'p[data-test="chatUserMessageText"]';
exports.chatClearMessageText = 'p[data-test="chatClearMessageText"]';

// Messages
exports.message = 'Hello World!';
// CustomParameters
exports.audioOptionsButtons = '[class^="audioOptions"] > button';
exports.userListContent = 'div[data-test="userListContent"]';
exports.brandingAreaLogo = 'div[class^="branding--"]';
exports.multiUsersWhiteboard = 'button[aria-label="Turn multi-user whiteboard on"]';
exports.toolbarListClass = '[class^="toolbarList--"]';
exports.notificationBar = 'div[class^="notificationsBar--"]';
exports.chat = 'section[aria-label="Chat"]';
exports.defaultContent = 'div[class^="defaultContent--"]';
exports.zoomIn = 'button[aria-label="Zoom in"]';
exports.recordingIndicator = 'div[class^="recordingIndicator--"]';
exports.webcamMirroredVideoContainer = 'video[data-test="mirroredVideoContainer"]';
exports.userslistContainer = 'div[aria-label="User list"]';

// Notes
exports.sharedNotes = 'div[data-test="sharedNotes"]';
Expand All @@ -77,6 +100,8 @@ exports.joinAudioToast = 'You have joined the audio conference';
exports.pollPublishedToast = 'Poll results were published';
exports.startScreenshareToast = 'Screenshare has started';
exports.endScreenshareToast = 'Screenshare has ended';
exports.toastContainer = 'div[class^="toastContainer--"]';
exports.joiningMessageLabel = 'You have joined the audio conference';

// Polling
exports.polling = 'li[data-test="polling"]';
Expand All @@ -103,6 +128,8 @@ exports.addPollItem = 'button[data-test="addPollItem"]';
exports.deletePollOption = 'button[data-test="deletePollOption"]';
exports.cancelPollBtn = 'button[data-test="cancelPollLabel"]';
exports.questionSlideFileName = 'mockPollSlide.pdf';
exports.pollYesNoAbstentionBtn = 'button[aria-label="Yes / No / Abstention"]';
exports.yesBtn = 'button[aria-label="Yes"]';

// Presentation
exports.startScreenSharing = 'button[data-test="startScreenShare"]';
Expand Down Expand Up @@ -131,6 +158,7 @@ exports.externalVideoModalHeader = 'header[data-test="videoModalHeader"]';
exports.videoModalInput = 'input[id="video-modal-input"]';
exports.startShareVideoBtn = 'button[aria-label="Share a new video"]';
exports.videoPlayer = 'div[data-test="videoPlayer"]';
exports.presentationTitle = '[class^="presentationTitle--"]';
// YouTube frame
exports.youtubeLink = 'https://www.youtube.com/watch?v=Hso8yLzkqj8&ab_channel=BigBlueButton';
exports.youtubeFrame = 'iframe[title^="YouTube"]';
Expand All @@ -149,6 +177,26 @@ exports.multiWhiteboardTool = 'span[data-test="multiWhiteboardTool"]';
exports.manageUsers = 'button[data-test="manageUsers"]';
exports.presenterClassName = 'presenter--';
exports.anyUser = '[data-test^="userListItem"]';
exports.userList = 'button[aria-label="Users and messages toggle"]';
exports.mobileUser = 'span[data-test="mobileUser"]';
exports.connectionStatusBtn = 'button[data-test="connectionStatusButton"]';
exports.connectionStatusModal = 'div[aria-label="Connection status modal"]';
exports.dataSavingScreenshare = 'input[data-test="dataSavingScreenshare"]';
exports.closeConnectionStatusModal = 'button[aria-label="Close Connection status modal"]';
exports.screenshareLocked = 'button[aria-label="Screenshare locked"]';
exports.connectionStatusItemEmpty = 'div[data-test="connectionStatusItemEmpty"]';
exports.connectionStatusItemUser = 'div[data-test="connectionStatusItemUser"]';
exports.dataSavingWebcams = 'input[data-test="dataSavingWebcams"]';
exports.connectionStatusOfflineUser = 'div[data-test="offlineUser"]';
exports.connectionDataContainer = '[class^=networkDataContainer--]';
exports.connectionNetwordData = '[class^=networkData--]';
exports.avatarsWrapperAvatar = 'div[data-test="avatarsWrapperAvatar"]';
exports.guestPolicyLabel = 'li[data-test="guestPolicyLabel"]';
exports.waitingUsersBtn = 'div[data-test="waitingUsersBtn"]';
exports.joinMeetingDemoPage = 'div[class^="join-meeting"]';
exports.askModerator = 'button[data-test="askModerator"]';
exports.alwaysAccept = 'button[data-test="alwaysAccept"]';
exports.alwaysDeny = 'button[data-test="alwaysDeny"]';

// Locales
exports.locales = ['af', 'ar', 'az', 'bg-BG', 'bn', 'ca', 'cs-CZ', 'da', 'de',
Expand All @@ -168,6 +216,8 @@ exports.webcamConnecting = 'div[data-test="webcamConnecting"]';
exports.webcamVideo = 'video[data-test="videoContainer"]';
exports.videoContainer = 'div[class^="videoListItem"]';
exports.webcamItemTalkingUser = 'div[data-test="webcamItemTalkingUser"]';
exports.webcamSettingsModal = 'div[aria-label="Webcam settings"]';
exports.webcamMirroredVideoPreview = 'video[data-test="mirroredVideoPreview"]';

// Whiteboard
exports.whiteboard = 'svg[data-test="whiteboard"]';
Expand All @@ -176,3 +226,4 @@ exports.rectangle = 'button[aria-label="Rectangle"]';
exports.drawnRectangle = 'svg g[clip-path] > g:nth-child(2) rect[data-test="drawnRectangle"]';
exports.whiteboardViewBox = 'svg g[clip-path="url(#viewBox)"]';
exports.changeWhiteboardAccess = 'li[data-test="changeWhiteboardAccess"]';
exports.pencil = 'button[aria-label="Pencil"]';
4 changes: 2 additions & 2 deletions bigbluebutton-tests/playwright/core/helpers.js
Expand Up @@ -17,9 +17,9 @@ async function createMeeting(params, customParameter) {
const mp = params.moderatorPW;
const ap = params.attendeePW;
const query = customParameter !== undefined ? `name=${meetingID}&meetingID=${meetingID}&attendeePW=${ap}&moderatorPW=${mp}&joinViaHtml5=true`
+ `&record=false&allowStartStopRecording=true&${customParameter}&autoStartRecording=false&welcome=${params.welcome}`
+ `&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}`;
+ `&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}`;
Expand Down
22 changes: 15 additions & 7 deletions bigbluebutton-tests/playwright/core/page.js
Expand Up @@ -42,7 +42,6 @@ class Page {
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();
}

Expand All @@ -56,6 +55,16 @@ class Page {
await this.waitForSelector(e.isTalking);
}

async leaveAudio() {
await this.waitAndClick(e.leaveAudio);
await this.waitForSelector(e.joinAudio);
}

async logoutFromMeeting() {
await this.waitAndClick(e.options);
await this.waitAndClick(e.logout);
}

async shareWebcam(shouldConfirmSharing, videoPreviewTimeout = ELEMENT_WAIT_TIME) {
await this.waitAndClick(e.joinVideo);
if (shouldConfirmSharing) {
Expand All @@ -67,13 +76,12 @@ class Page {
await this.waitForSelector(e.leaveVideo, VIDEO_LOADING_WAIT_TIME);
}

async getLocator(selector, { timeout, hidden } = { timeout: ELEMENT_WAIT_TIME, hidden: false }) {
if (!hidden) await this.waitForSelector(selector, timeout);
async getLocator(selector) {
return this.page.locator(selector);
}

async getSelectorCount(selector, timeout = ELEMENT_WAIT_TIME) {
const locator = await this.getLocator(selector, timeout);
async getSelectorCount(selector) {
const locator = await this.getLocator(selector);
return locator.count();
}

Expand Down Expand Up @@ -102,15 +110,15 @@ class Page {
async waitAndClick(selector, timeout = ELEMENT_WAIT_TIME) {
await this.waitForSelector(selector, timeout);
await this.page.focus(selector);
await this.page.click(selector);
await this.page.click(selector, { timeout });
}

async checkElement(selector, index = 0) {
return this.page.evaluate(checkElement, [selector, index]);
}

async wasRemoved(selector, timeout = ELEMENT_WAIT_TIME) {
const locator = await this.getLocator(selector, { hidden: true });
const locator = await this.getLocator(selector);
await expect(locator).toBeHidden({ timeout });
}

Expand Down
65 changes: 65 additions & 0 deletions bigbluebutton-tests/playwright/customparameters/constants.js
@@ -0,0 +1,65 @@
exports.autoJoin = 'userdata-bbb_auto_join_audio=false';
exports.listenOnlyMode = 'userdata-bbb_listen_only_mode=false';
exports.forceListenOnly = 'userdata-bbb_force_listen_only=true';
exports.skipCheck = 'userdata-bbb_skip_check_audio=true';
exports.skipCheckOnFirstJoin = 'userdata-bbb_skip_check_audio_on_first_join=true';
exports.docTitle = 'playwright';
exports.clientTitle = `userdata-bbb_client_title=${this.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.enableScreensharing = 'userdata-bbb_enable_screen_sharing=false';
exports.enableVideo = 'userdata-bbb_enable_video=false';
exports.autoShareWebcam = 'userdata-bbb_auto_share_webcam=true';
exports.multiUserPenOnly = 'userdata-bbb_multi_user_pen_only=true';
exports.presenterTools = 'userdata-bbb_presenter_tools=["pencil", "hand"]';
exports.multiUserTools = 'userdata-bbb_multi_user_tools=["pencil", "hand"]';
const cssCode = '.presentationTitle--1LT79g{display: none;}';
exports.customStyle = `userdata-bbb_custom_style=${cssCode}`;
exports.customStyleUrl = 'userdata-bbb_custom_style_url=https://develop.bigbluebutton.org/css-test-file.css';
exports.autoSwapLayout = 'userdata-bbb_auto_swap_layout=true';
exports.hidePresentation = 'userdata-bbb_hide_presentation=true';
exports.outsideToggleSelfVoice = 'userdata-bbb_outside_toggle_self_voice=true';
exports.outsideToggleRecording = 'userdata-bbb_outside_toggle_recording=true';
exports.showPublicChatOnLogin = 'userdata-bbb_show_public_chat_on_login=false';
exports.forceRestorePresentationOnNewEvents = 'userdata-bbb_force_restore_presentation_on_new_events=true';
exports.bannerText = 'bannerText=some text';
exports.color = 'FFFF00';
exports.bannerColor = `bannerColor=%23${this.color}`;
exports.recordMeeting = 'record=true';
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'
}];

0 comments on commit b617eb2

Please sign in to comment.