bigbluebutton-Github/bigbluebutton-tests/playwright/breakout/join.js

126 lines
4.1 KiB
JavaScript
Raw Normal View History

const { Create } = require('./create');
2021-11-30 21:42:57 +08:00
const utilScreenShare = require('../screenshare/util');
const e = require('../core/elements');
const { ELEMENT_WAIT_LONGER_TIME } = require('../core/constants');
2022-06-08 02:52:22 +08:00
const { getSettings } = require('../core/settings');
2021-11-30 21:42:57 +08:00
class Join extends Create {
constructor(browser, context) {
super(browser, context);
}
async joinRoom(shouldJoinAudio = false) {
await this.userPage.bringToFront();
2021-11-30 21:42:57 +08:00
if (shouldJoinAudio) {
await this.userPage.waitAndClick(e.joinAudio);
await this.userPage.joinMicrophone();
2021-11-30 21:42:57 +08:00
}
await this.userPage.waitAndClick(e.breakoutRoomsItem);
await this.userPage.waitAndClick(e.joinRoom1);
await this.userPage.waitForSelector(e.alreadyConnected, ELEMENT_WAIT_LONGER_TIME);
2021-11-30 21:42:57 +08:00
const breakoutUserPage = await this.userPage.getLastTargetPage(this.context);
await breakoutUserPage.bringToFront();
2021-11-30 21:42:57 +08:00
if (shouldJoinAudio) {
await this.userPage.waitForSelector(e.joinAudio);
} else {
await breakoutUserPage.closeAudioModal();
}
2022-04-21 19:19:08 +08:00
await breakoutUserPage.waitForSelector(e.presentationTitle);
return breakoutUserPage;
2021-11-30 21:42:57 +08:00
}
async joinAndShareWebcam() {
const breakoutPage = await this.joinRoom();
2022-06-08 02:52:22 +08:00
const { videoPreviewTimeout } = getSettings();
2022-03-29 21:53:07 +08:00
await breakoutPage.shareWebcam(true, videoPreviewTimeout);
2021-11-30 21:42:57 +08:00
}
async joinAndShareScreen() {
const breakoutPage = await this.joinRoom();
await utilScreenShare.startScreenshare(breakoutPage);
}
async joinWithAudio() {
const breakoutUserPage = await this.joinRoom(true);
2021-11-30 21:42:57 +08:00
await breakoutUserPage.waitForSelector(e.talkingIndicator);
await breakoutUserPage.hasElement(e.isTalking);
2021-11-30 21:42:57 +08:00
}
2022-09-16 02:31:10 +08:00
async messageToAllRooms() {
const breakoutUserPage = await this.joinRoom();
await this.modPage.waitAndClick(e.breakoutRoomsItem);
await this.modPage.type(e.chatBox, "teste");
await this.modPage.waitAndClick(e.sendButton);
await breakoutUserPage.hasElement(e.chatUserMessageText);
}
async changeDurationTime() {
const breakoutUserPage = await this.joinRoom();
await this.modPage.waitAndClick(e.breakoutRoomsItem);
await this.modPage.waitAndClick(e.breakoutOptionsMenu);
await this.modPage.waitAndClick(e.openBreakoutTimeManager);
await this.modPage.getLocator(e.inputSetTimeSelector).press('Backspace');
await this.modPage.type(e.inputSetTimeSelector, '2');
await this.modPage.waitAndClick(e.sendButtonDurationTime);
await breakoutUserPage.hasText(e.breakoutRemainingTime, /12:00/);
}
async inviteUserAfterCreatingRooms() {
await this.modPage.waitAndClick(e.breakoutRoomsItem);
await this.modPage.waitAndClick(e.breakoutOptionsMenu);
await this.modPage.waitAndClick(e.openUpdateBreakoutUsersModal);
await this.modPage.dragDropSelector(e.userTest, e.breakoutBox1);
await this.modPage.hasText(e.breakoutBox1, /Attendee/);
await this.modPage.waitAndClick(e.modalConfirmButton);
await this.userPage.hasElement(e.modalConfirmButton);
await this.userPage.waitAndClick(e.modalDismissButton);
}
async usernameShowsBelowRoomsName() {
const breakoutUserPage = await this.joinRoom();
await this.modPage.waitAndClick(e.breakoutRoomsItem);
await this.modPage.hasText(e.userNameBreakoutRoom, /Attendee/);
}
async showBreakoutRoomTimeRemaining() {
const breakoutUserPage = await this.joinRoom();
await this.modPage.waitAndClick(e.breakoutRoomsItem);
await this.modPage.waitAndClick(e.breakoutOptionsMenu);
await this.modPage.waitAndClick(e.openBreakoutTimeManager);
await this.modPage.getLocator(e.inputSetTimeSelector).press('Backspace');
await this.modPage.type(e.inputSetTimeSelector, '2');
await this.modPage.waitAndClick(e.sendButtonDurationTime);
await this.modPage.hasText(e.breakoutRemainingTime, /12:00/);
await breakoutUserPage.hasText(e.breakoutRemainingTime, /12:00/);
}
async endAllBreakoutRooms() {
await this.modPage.waitAndClick(e.breakoutRoomsItem);
await this.modPage.waitAndClick(e.breakoutOptionsMenu);
await this.modPage.waitAndClick(e.endAllBreakouts);
await this.modPage.wasRemoved(e.breakoutRoomsItem);
}
2021-11-30 21:42:57 +08:00
}
exports.Join = Join;