2022-12-31 05:49:18 +08:00
|
|
|
const { default: test } = require('@playwright/test');
|
2021-12-02 12:12:14 +08:00
|
|
|
const { Create } = require('./create');
|
2021-11-30 21:42:57 +08:00
|
|
|
const utilScreenShare = require('../screenshare/util');
|
|
|
|
const e = require('../core/elements');
|
2022-11-26 03:54:32 +08:00
|
|
|
const { ELEMENT_WAIT_LONGER_TIME, ELEMENT_WAIT_TIME } = require('../core/constants');
|
2022-06-08 02:52:22 +08:00
|
|
|
const { getSettings } = require('../core/settings');
|
2022-09-30 19:17:15 +08:00
|
|
|
const { expect } = require('@playwright/test');
|
2022-11-26 03:54:32 +08:00
|
|
|
const { sleep } = require('../core/helpers');
|
2022-12-31 05:49:18 +08:00
|
|
|
const { getNotesLocator } = require('../sharednotes/util');
|
2021-11-30 21:42:57 +08:00
|
|
|
|
|
|
|
class Join extends Create {
|
|
|
|
constructor(browser, context) {
|
|
|
|
super(browser, context);
|
|
|
|
}
|
|
|
|
|
|
|
|
async joinRoom(shouldJoinAudio = false) {
|
2021-12-02 12:12:14 +08:00
|
|
|
await this.userPage.bringToFront();
|
2021-11-30 21:42:57 +08:00
|
|
|
if (shouldJoinAudio) {
|
2021-12-02 12:12:14 +08:00
|
|
|
await this.userPage.waitAndClick(e.joinAudio);
|
|
|
|
await this.userPage.joinMicrophone();
|
2021-11-30 21:42:57 +08:00
|
|
|
}
|
|
|
|
|
2021-12-02 12:12:14 +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
|
|
|
|
2021-12-02 12:12:14 +08:00
|
|
|
const breakoutUserPage = await this.userPage.getLastTargetPage(this.context);
|
|
|
|
await breakoutUserPage.bringToFront();
|
2021-11-30 21:42:57 +08:00
|
|
|
|
2022-07-02 04:55:32 +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);
|
2021-12-02 12:12:14 +08:00
|
|
|
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() {
|
2021-12-02 12:12:14 +08:00
|
|
|
const breakoutUserPage = await this.joinRoom(true);
|
2021-11-30 21:42:57 +08:00
|
|
|
|
2021-12-02 12:12:14 +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();
|
2022-09-23 04:17:15 +08:00
|
|
|
await breakoutUserPage.hasElement(e.presentationTitle);
|
2022-09-16 02:31:10 +08:00
|
|
|
|
|
|
|
await this.modPage.waitAndClick(e.breakoutRoomsItem);
|
2022-09-23 04:17:15 +08:00
|
|
|
await this.modPage.type(e.chatBox, "test");
|
2022-09-16 02:31:10 +08:00
|
|
|
await this.modPage.waitAndClick(e.sendButton);
|
|
|
|
|
|
|
|
await breakoutUserPage.hasElement(e.chatUserMessageText);
|
|
|
|
}
|
|
|
|
|
|
|
|
async changeDurationTime() {
|
|
|
|
const breakoutUserPage = await this.joinRoom();
|
2022-09-23 04:17:15 +08:00
|
|
|
await breakoutUserPage.hasElement(e.presentationTitle);
|
2022-09-16 02:31:10 +08:00
|
|
|
|
|
|
|
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);
|
2022-10-06 04:41:22 +08:00
|
|
|
await this.modPage.hasText(e.breakoutRemainingTime, /[11-12]:[0-5][0-9]/);
|
2022-09-16 02:31:10 +08:00
|
|
|
|
2022-10-06 04:35:19 +08:00
|
|
|
await breakoutUserPage.hasText(e.timeRemaining, /[11-12]:[0-5][0-9]/);
|
2022-09-16 02:31:10 +08: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();
|
2022-09-23 04:17:15 +08:00
|
|
|
await breakoutUserPage.hasElement(e.presentationTitle);
|
2022-09-16 02:31:10 +08:00
|
|
|
|
|
|
|
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);
|
2022-10-06 04:41:22 +08:00
|
|
|
await this.modPage.hasText(e.breakoutRemainingTime, /[11-12]:[0-5][0-9]/);
|
2022-09-16 02:31:10 +08:00
|
|
|
|
2022-11-26 03:54:32 +08:00
|
|
|
await breakoutUserPage.hasText(e.timeRemaining, /[11-12]:[0-5][0-9]/);
|
2022-09-16 02:31:10 +08: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);
|
|
|
|
}
|
2022-09-30 19:17:15 +08:00
|
|
|
|
|
|
|
async moveUserToOtherRoom() {
|
|
|
|
const breakoutUserPage = await this.joinRoom();
|
|
|
|
await breakoutUserPage.hasElement(e.presentationTitle);
|
|
|
|
|
|
|
|
await this.modPage.waitAndClick(e.breakoutRoomsItem);
|
|
|
|
await this.modPage.hasText(e.userNameBreakoutRoom, /Attendee/);
|
|
|
|
|
|
|
|
await this.modPage.waitAndClick(e.breakoutOptionsMenu);
|
|
|
|
|
|
|
|
await this.modPage.waitAndClick(e.openUpdateBreakoutUsersModal);
|
|
|
|
await this.modPage.dragDropSelector(e.moveUser, e.breakoutBox2);
|
|
|
|
await this.modPage.waitAndClick(e.modalConfirmButton);
|
|
|
|
|
|
|
|
await this.userPage.waitForSelector(e.modalConfirmButton);
|
2023-02-14 21:59:46 +08:00
|
|
|
await breakoutUserPage.page.isClosed();
|
2022-09-30 19:17:15 +08:00
|
|
|
|
|
|
|
await this.userPage.waitAndClick(e.modalConfirmButton);
|
|
|
|
await this.modPage.hasText(e.userNameBreakoutRoom2, /Attendee/);
|
|
|
|
}
|
2022-12-31 05:49:18 +08:00
|
|
|
|
|
|
|
async exportBreakoutNotes() {
|
|
|
|
const { sharedNotesEnabled } = getSettings();
|
|
|
|
test.fail(!sharedNotesEnabled, 'Shared notes is disabled');
|
|
|
|
|
|
|
|
const breakoutUserPage = await this.joinRoom();
|
|
|
|
await breakoutUserPage.hasElement(e.presentationTitle);
|
|
|
|
await breakoutUserPage.waitAndClick(e.sharedNotes);
|
|
|
|
await breakoutUserPage.waitForSelector(e.hideNotesLabel);
|
|
|
|
|
|
|
|
const notesLocator = getNotesLocator(breakoutUserPage);
|
|
|
|
await notesLocator.type(e.message);
|
|
|
|
await sleep(1000); // making sure there's enough time for the typing to finish
|
|
|
|
|
|
|
|
await this.modPage.waitAndClick(e.breakoutRoomsItem);
|
|
|
|
await this.modPage.waitAndClick(e.breakoutOptionsMenu);
|
|
|
|
await this.modPage.waitAndClick(e.endAllBreakouts);
|
|
|
|
|
|
|
|
await this.modPage.hasElement(e.presentationUploadProgressToast);
|
2023-02-14 21:59:46 +08:00
|
|
|
await this.modPage.waitForSelectorDetached(e.presentationUploadProgressToast, ELEMENT_WAIT_LONGER_TIME);
|
2022-12-31 05:49:18 +08:00
|
|
|
|
|
|
|
await this.modPage.waitAndClick(e.closeModal); // closing the audio modal
|
|
|
|
await this.modPage.waitAndClick(e.actions);
|
|
|
|
await this.modPage.checkElementCount(e.actionsItem, 9);
|
2023-04-06 22:43:50 +08:00
|
|
|
await this.modPage.getLocatorByIndex(e.actionsItem, 1).click({ timeout: ELEMENT_WAIT_TIME });
|
2022-12-31 05:49:18 +08:00
|
|
|
|
2023-02-14 21:59:46 +08:00
|
|
|
const wbBox = await this.modPage.getElementBoundingBox(e.whiteboard);
|
2022-12-31 05:49:18 +08:00
|
|
|
const clipObj = {
|
|
|
|
x: wbBox.x,
|
|
|
|
y: wbBox.y,
|
|
|
|
width: wbBox.width,
|
|
|
|
height: wbBox.height,
|
|
|
|
};
|
|
|
|
await expect(this.modPage.page).toHaveScreenshot('capture-breakout-notes.png', {
|
|
|
|
maxDiffPixels: 1000,
|
|
|
|
clip: clipObj,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
async exportBreakoutWhiteboard() {
|
|
|
|
const { sharedNotesEnabled } = getSettings();
|
|
|
|
test.fail(!sharedNotesEnabled, 'Shared notes is disabled');
|
|
|
|
|
|
|
|
const breakoutUserPage = await this.joinRoom();
|
|
|
|
await breakoutUserPage.hasElement(e.presentationTitle);
|
|
|
|
await breakoutUserPage.waitAndClick(e.sharedNotes);
|
|
|
|
await breakoutUserPage.waitForSelector(e.hideNotesLabel);
|
|
|
|
|
|
|
|
// draw a line
|
|
|
|
await breakoutUserPage.waitForSelector(e.whiteboard, ELEMENT_WAIT_LONGER_TIME);
|
|
|
|
await breakoutUserPage.waitAndClick(e.wbShapesButton);
|
|
|
|
await breakoutUserPage.waitAndClick(e.wbLineShape);
|
|
|
|
const wbBreakout = await breakoutUserPage.page.$(e.whiteboard);
|
|
|
|
const wbBoxBreakout = await wbBreakout.boundingBox();
|
|
|
|
await breakoutUserPage.page.mouse.move(wbBoxBreakout.x + 0.3 * wbBoxBreakout.width, wbBoxBreakout.y + 0.3 * wbBoxBreakout.height);
|
|
|
|
await breakoutUserPage.page.mouse.down();
|
|
|
|
await breakoutUserPage.page.mouse.move(wbBoxBreakout.x + 0.7 * wbBoxBreakout.width, wbBoxBreakout.y + 0.7 * wbBoxBreakout.height);
|
|
|
|
await breakoutUserPage.page.mouse.up();
|
|
|
|
await sleep(1000); // making sure there's enough time for the typing to finish
|
|
|
|
|
|
|
|
await this.modPage.waitAndClick(e.breakoutRoomsItem);
|
|
|
|
await this.modPage.waitAndClick(e.breakoutOptionsMenu);
|
|
|
|
await this.modPage.waitAndClick(e.endAllBreakouts);
|
|
|
|
|
|
|
|
await this.modPage.waitForSelector(e.presentationUploadProgressToast, ELEMENT_WAIT_LONGER_TIME);
|
2023-02-14 21:59:46 +08:00
|
|
|
await this.modPage.waitForSelectorDetached(e.presentationUploadProgressToast, ELEMENT_WAIT_LONGER_TIME);
|
2022-12-31 05:49:18 +08:00
|
|
|
|
|
|
|
await this.modPage.waitAndClick(e.closeModal); // closing the audio modal
|
|
|
|
await this.modPage.waitAndClick(e.actions);
|
|
|
|
await this.modPage.checkElementCount(e.actionsItem, 9);
|
2023-04-06 22:43:50 +08:00
|
|
|
await this.modPage.getLocatorByIndex(e.actionsItem, 1).click({ timeout: ELEMENT_WAIT_TIME });
|
2022-12-31 05:49:18 +08:00
|
|
|
|
2023-02-14 21:59:46 +08:00
|
|
|
const wbBox = await this.modPage.getElementBoundingBox(e.whiteboard);
|
2022-12-31 05:49:18 +08:00
|
|
|
const clipObj = {
|
2023-02-14 21:59:46 +08:00
|
|
|
x: wbBox.x,
|
|
|
|
y: wbBox.y,
|
|
|
|
width: wbBox.width,
|
|
|
|
height: wbBox.height,
|
2022-12-31 05:49:18 +08:00
|
|
|
};
|
|
|
|
await expect(this.modPage.page).toHaveScreenshot('capture-breakout-whiteboard.png', {
|
|
|
|
maxDiffPixels: 1000,
|
|
|
|
clip: clipObj,
|
|
|
|
});
|
|
|
|
}
|
2023-01-31 22:01:56 +08:00
|
|
|
|
2023-02-10 03:43:49 +08:00
|
|
|
async userCanChooseRoom() {
|
2023-01-31 22:01:56 +08:00
|
|
|
await this.userPage.bringToFront();
|
2023-02-10 03:43:49 +08:00
|
|
|
|
|
|
|
await this.userPage.checkElementCount(e.roomOption, 2);
|
2023-01-31 22:01:56 +08:00
|
|
|
|
2023-02-13 21:37:14 +08:00
|
|
|
await this.userPage.getLocator(`${e.fullscreenModal} >> select`).selectOption({index: 1});
|
2023-01-31 22:01:56 +08:00
|
|
|
await this.userPage.waitAndClick(e.modalConfirmButton);
|
|
|
|
|
|
|
|
const breakoutUserPage = await this.userPage.getLastTargetPage(this.context);
|
|
|
|
await breakoutUserPage.bringToFront();
|
2023-02-13 21:37:14 +08:00
|
|
|
await breakoutUserPage.waitForSelector(e.presentationTitle, ELEMENT_WAIT_LONGER_TIME);
|
2023-01-31 22:01:56 +08:00
|
|
|
}
|
2021-11-30 21:42:57 +08:00
|
|
|
}
|
|
|
|
|
2021-12-02 12:12:14 +08:00
|
|
|
exports.Join = Join;
|