bigbluebutton-Github/bigbluebutton-tests/playwright/user/lockViewers.js

217 lines
9.0 KiB
JavaScript
Raw Normal View History

2022-01-29 03:52:22 +08:00
const { MultiUsers } = require("./multiusers");
2023-07-03 21:01:05 +08:00
const { openLockViewers, drawArrow } = require('./util');
2022-01-29 03:52:22 +08:00
const e = require('../core/elements');
const { expect } = require("@playwright/test");
const { ELEMENT_WAIT_LONGER_TIME, ELEMENT_WAIT_TIME } = require("../core/constants");
const { getNotesLocator } = require("../sharednotes/util");
const { waitAndClearNotification } = require("../notifications/util");
const { sleep } = require("../core/helpers");
2022-01-29 03:52:22 +08:00
class LockViewers extends MultiUsers {
constructor(browser, page) {
super(browser, page);
}
2023-07-05 21:05:57 +08:00
async lockShareWebcam() {
2022-01-29 03:52:22 +08:00
await this.modPage.shareWebcam();
await this.modPage.hasElement(e.webcamVideoItem);
await this.userPage.hasElement(e.webcamVideoItem);
2022-01-29 03:52:22 +08:00
await this.userPage.shareWebcam();
await this.modPage.hasNElements(e.webcamVideoItem, 2);
await this.userPage.hasNElements(e.webcamVideoItem, 2);
2022-01-29 03:52:22 +08:00
await openLockViewers(this.modPage);
await this.modPage.waitAndClickElement(e.lockShareWebcam);
await this.modPage.waitAndClick(e.applyLockSettings);
2022-06-08 02:52:22 +08:00
await waitAndClearNotification(this.modPage);
2023-07-03 21:01:05 +08:00
await this.userPage.checkElementCount(e.webcamContainer, 1);
2023-07-05 21:05:57 +08:00
await this.initUserPage2(true);
2023-07-03 21:01:05 +08:00
await this.userPage2.hasElementDisabled(e.joinVideo);
await this.modPage.waitAndClick(`${e.userListItem}>>nth=1`);
await this.modPage.waitAndClick(`${e.unlockUserButton}>>nth=1`);
await this.userPage2.waitAndClick(e.joinVideo);
await this.userPage2.waitAndClick(e.startSharingWebcam);
await this.modPage.checkElementCount(e.webcamContainer, 2);
2022-01-29 03:52:22 +08:00
await this.userPage.hasElementDisabled(e.joinVideo);
}
2023-07-05 21:05:57 +08:00
async lockSeeOtherViewersWebcams() {
2022-01-29 03:52:22 +08:00
await this.modPage.shareWebcam();
await this.userPage.shareWebcam();
2023-07-05 21:05:57 +08:00
2022-01-29 03:52:22 +08:00
await openLockViewers(this.modPage);
await this.modPage.waitAndClickElement(e.lockSeeOtherViewersWebcam);
await this.modPage.waitAndClick(e.applyLockSettings);
await sleep(500);
2022-01-29 03:52:22 +08:00
const videoContainersCount = [
await this.modPage.getSelectorCount(e.webcamVideoItem),
await this.userPage.getSelectorCount(e.webcamVideoItem),
2022-01-29 03:52:22 +08:00
];
2023-09-16 03:38:43 +08:00
await expect(videoContainersCount).toStrictEqual([2, 2]);
2023-07-03 21:01:05 +08:00
2023-07-05 21:05:57 +08:00
await this.initUserPage2(true);
2023-07-03 21:01:05 +08:00
await this.userPage2.shareWebcam();
await this.modPage.waitAndClick(`${e.userListItem}>>nth=1`);
await this.modPage.waitAndClick(`${e.unlockUserButton}>>nth=1`);
await this.modPage.checkElementCount(e.webcamContainer, 3);
await this.userPage.checkElementCount(e.webcamContainer, 2);
await this.userPage2.checkElementCount(e.webcamContainer, 3);
2022-01-29 03:52:22 +08:00
}
2023-07-05 21:05:57 +08:00
async lockShareMicrophone() {
2022-01-29 03:52:22 +08:00
await this.userPage.waitAndClick(e.joinAudio);
await this.userPage.joinMicrophone();
await openLockViewers(this.modPage);
await this.modPage.waitAndClickElement(e.lockShareMicrophone);
await this.modPage.waitAndClick(e.applyLockSettings);
await this.userPage.wasRemoved(e.isTalking);
await this.userPage.waitForSelector(e.unmuteMicButton);
2023-07-05 21:05:57 +08:00
await this.initUserPage2(false);
await this.userPage2.hasElement(e.leaveListenOnly, ELEMENT_WAIT_LONGER_TIME);
2023-07-03 21:01:05 +08:00
await this.modPage.waitAndClick(`${e.userListItem}>>nth=1`);
await this.modPage.waitAndClick(`${e.unlockUserButton}>>nth=1`);
await this.userPage2.waitAndClick(e.leaveListenOnly);
await this.userPage2.waitAndClick(e.joinAudio);
await this.userPage2.joinMicrophone();
await this.userPage2.hasElement(e.isTalking);
2022-01-29 03:52:22 +08:00
}
2023-07-05 21:05:57 +08:00
async lockSendPublicChatMessages() {
2022-01-29 03:52:22 +08:00
await openLockViewers(this.modPage);
await this.modPage.waitAndClickElement(e.lockPublicChat);
await this.modPage.waitAndClick(e.applyLockSettings);
await this.userPage.hasElementDisabled(e.chatBox);
await this.userPage.hasElementDisabled(e.sendButton);
2023-07-05 21:05:57 +08:00
await this.initUserPage2(true);
2023-07-03 21:01:05 +08:00
await this.userPage2.hasElementDisabled(e.chatBox);
await this.userPage2.hasElementDisabled(e.sendButton);
2022-01-29 03:52:22 +08:00
await this.modPage.type(e.chatBox, e.message);
await this.modPage.waitAndClick(e.sendButton);
2023-07-03 21:01:05 +08:00
await this.modPage.waitAndClick(`${e.userListItem}>>nth=1`);
await this.modPage.waitAndClick(`${e.unlockUserButton}>>nth=1`);
2023-09-26 01:40:11 +08:00
await this.userPage2.hasElementEnabled(e.chatBox, ELEMENT_WAIT_LONGER_TIME);
2023-07-03 21:01:05 +08:00
await this.userPage2.type(e.chatBox, e.message);
await this.userPage2.waitAndClick(e.sendButton);
2022-01-29 03:52:22 +08:00
await this.userPage.waitForSelector(e.chatUserMessageText);
2023-07-03 21:01:05 +08:00
await this.userPage.checkElementCount(e.chatUserMessageText, 2);
2022-01-29 03:52:22 +08:00
}
2023-07-05 21:05:57 +08:00
async lockSendPrivateChatMessages() {
2022-02-05 03:26:35 +08:00
const lastUserItemLocator = this.userPage.getLocatorByIndex(e.userListItem, -1);
2022-02-03 08:45:23 +08:00
await this.userPage.clickOnLocator(lastUserItemLocator);
2022-02-05 03:26:35 +08:00
const startPrivateChatButton = this.userPage.getLocatorByIndex(e.startPrivateChat, -1);
2022-02-03 08:45:23 +08:00
await this.userPage.clickOnLocator(startPrivateChatButton);
2022-01-29 03:52:22 +08:00
await openLockViewers(this.modPage);
await this.modPage.waitAndClickElement(e.lockPrivateChat);
await this.modPage.waitAndClick(e.applyLockSettings);
2023-07-05 21:05:57 +08:00
await this.initUserPage2(true);
2023-07-03 21:01:05 +08:00
await this.modPage.waitAndClick(`${e.userListItem}>>nth=1`);
await this.modPage.waitAndClick(`${e.unlockUserButton}>>nth=1`);
2023-09-14 04:11:15 +08:00
await this.modPage.waitAndClick(`${e.userListItem}>>nth=0`);
2023-09-26 01:40:11 +08:00
await this.modPage.waitAndClick(`${e.unlockUserButton}>>nth=0`);
2023-07-03 21:01:05 +08:00
await this.userPage2.waitAndClick(`${e.userListItem}>>nth=1`);
await this.userPage2.waitAndClick(`${e.startPrivateChat}>>nth=1`);
await this.userPage2.type(e.chatBox, 'Test');
await this.userPage2.waitAndClick(e.sendButton);
2023-09-26 01:40:11 +08:00
await this.userPage.waitAndClick(e.closePrivateChat);
2023-07-03 21:01:05 +08:00
await this.userPage.waitAndClick(`${e.chatButton}>>nth=1`);
2023-09-26 01:40:11 +08:00
await this.userPage.hasElementEnabled(e.chatBox);
await this.userPage.hasElementEnabled(e.sendButton);
2022-01-29 03:52:22 +08:00
}
2023-07-05 21:05:57 +08:00
async lockEditSharedNotes() {
2022-01-29 03:52:22 +08:00
await this.userPage.waitAndClick(e.sharedNotes);
await this.userPage.waitForSelector(e.hideNotesLabel);
2022-01-29 03:52:22 +08:00
const sharedNotesLocator = getNotesLocator(this.userPage);
2023-07-03 21:01:05 +08:00
await sharedNotesLocator.type(e.message, { timeout: ELEMENT_WAIT_LONGER_TIME });
2023-09-16 03:38:43 +08:00
await expect(sharedNotesLocator).toContainText(e.message, { timeout: ELEMENT_WAIT_TIME });
2022-01-29 03:52:22 +08:00
await openLockViewers(this.modPage);
await this.modPage.waitAndClickElement(e.lockEditSharedNotes);
await this.modPage.waitAndClick(e.applyLockSettings);
2023-07-03 21:01:05 +08:00
2023-07-05 21:05:57 +08:00
await this.initUserPage2(true);
2023-07-03 21:01:05 +08:00
await this.userPage2.waitAndClick(e.sharedNotes);
await this.userPage2.wasRemoved(e.etherpadFrame);
2022-01-29 03:52:22 +08:00
await this.userPage.waitAndClick(e.sharedNotes);
await this.userPage.wasRemoved(e.etherpadFrame);
2023-07-03 21:01:05 +08:00
await this.modPage.waitAndClick(`${e.userListItem}>>nth=1`);
await this.modPage.waitAndClick(`${e.unlockUserButton}>>nth=1`);
2022-01-29 03:52:22 +08:00
}
2023-07-05 21:05:57 +08:00
async lockSeeOtherViewersUserList() {
2022-01-29 03:52:22 +08:00
await openLockViewers(this.modPage);
await this.modPage.waitAndClickElement(e.lockUserList);
await this.modPage.waitAndClick(e.applyLockSettings);
2023-07-05 21:05:57 +08:00
await this.initUserPage2(true);
2023-07-03 21:01:05 +08:00
await this.userPage2.checkElementCount(e.userListItem, 1);
await sleep(1000);
2023-09-16 03:38:43 +08:00
await expect(await this.userPage.getLocator(e.userListItem).count()).toBe(1);
2023-07-03 21:01:05 +08:00
await this.modPage.waitAndClick(`${e.userListItem}>>nth=1`);
await this.modPage.waitAndClick(`${e.unlockUserButton}>>nth=1`);
await this.userPage2.checkElementCount(e.userListItem, 2);
2022-01-29 03:52:22 +08:00
}
2022-02-03 08:45:23 +08:00
2023-07-05 21:05:57 +08:00
async lockSeeOtherViewersAnnotations() {
2023-07-03 21:01:05 +08:00
await this.modPage.waitForSelector(e.whiteboard);
await this.modPage.waitAndClick(e.multiUsersWhiteboardOn);
await this.userPage.waitForSelector(e.whiteboard);
await drawArrow(this.userPage);
await openLockViewers(this.modPage);
await this.modPage.waitAndClickElement(e.hideViewersAnnotation);
await this.modPage.waitAndClick(e.applyLockSettings);
const screenshotOptions = {
maxDiffPixels: 1000,
};
2023-07-05 21:05:57 +08:00
await this.initUserPage2(true);
2023-07-03 21:01:05 +08:00
const userWbLocator = this.userPage2.getLocator(e.whiteboard);
await expect(userWbLocator).toHaveScreenshot('viewer2-no-arrow.png', screenshotOptions);
await this.modPage.waitAndClick(`${e.userListItem}>>nth=1`);
await this.modPage.waitAndClick(`${e.unlockUserButton}>>nth=1`);
const userWbLocatorArrow = this.userPage2.getLocator(e.whiteboard);
await expect(userWbLocatorArrow).toHaveScreenshot('viewer2-arrow.png', screenshotOptions);
}
2023-07-05 21:05:57 +08:00
async lockSeeOtherViewersCursor() {
2023-07-03 21:01:05 +08:00
await this.modPage.waitForSelector(e.whiteboard);
await this.modPage.waitAndClick(e.multiUsersWhiteboardOn);
await this.userPage.waitForSelector(e.whiteboard);
await drawArrow(this.userPage);
await openLockViewers(this.modPage);
await this.modPage.waitAndClickElement(e.hideViewersCursor);
await this.modPage.waitAndClick(e.applyLockSettings);
2023-07-05 21:05:57 +08:00
await this.modPage.checkElementCount(e.whiteboardCursorIndicator, 1);
2023-07-03 21:01:05 +08:00
2023-07-05 21:05:57 +08:00
await this.initUserPage2(true);
await this.userPage2.checkElementCount(e.whiteboardCursorIndicator, 0);
2023-07-03 21:01:05 +08:00
await this.modPage.waitAndClick(`${e.userListItem}>>nth=1`);
await this.modPage.waitAndClick(`${e.unlockUserButton}>>nth=1`);
await drawArrow(this.userPage);
2023-07-05 21:05:57 +08:00
await this.userPage2.checkElementCount(e.whiteboardCursorIndicator, 1);
2023-07-03 21:01:05 +08:00
}
2022-01-29 03:52:22 +08:00
}
exports.LockViewers = LockViewers;