Merge pull request #18275 from gabriellpr/lock-viewers-test
test: refactoring + adding two tests lock viewers
This commit is contained in:
commit
7b7c854ed8
@ -58,6 +58,7 @@ const Cursor = (props) => {
|
||||
backgroundColor: color,
|
||||
border: `1px solid ${color}`,
|
||||
}}
|
||||
data-test="whiteboardCursorIndicator"
|
||||
>
|
||||
{name}
|
||||
</div>
|
||||
|
@ -381,6 +381,9 @@ exports.lockPublicChat = 'input[data-test="lockPublicChat"]';
|
||||
exports.lockPrivateChat = 'input[data-test="lockPrivateChat"]';
|
||||
exports.lockEditSharedNotes = 'input[data-test="lockEditSharedNotes"]';
|
||||
exports.lockUserList = 'input[data-test="lockUserList"]';
|
||||
exports.hideViewersAnnotation = 'input[data-test="hideViewersAnnotation"]';
|
||||
exports.hideViewersCursor = 'input[data-test="hideViewersCursor"]';
|
||||
exports.whiteboardCursorIndicator = 'div[data-test="whiteboardCursorIndicator"]';
|
||||
|
||||
// Closed Captions
|
||||
exports.writeClosedCaptions = 'li[data-test="writeClosedCaptions"]';
|
||||
|
@ -1,5 +1,5 @@
|
||||
const { MultiUsers } = require("./multiusers");
|
||||
const { openLockViewers } = require('./util');
|
||||
const { openLockViewers, drawArrow } = require('./util');
|
||||
const e = require('../core/elements');
|
||||
const { expect } = require("@playwright/test");
|
||||
const { ELEMENT_WAIT_LONGER_TIME, ELEMENT_WAIT_TIME } = require("../core/constants");
|
||||
@ -16,28 +16,30 @@ class LockViewers extends MultiUsers {
|
||||
await this.modPage.shareWebcam();
|
||||
await this.modPage.hasElement(e.webcamVideoItem);
|
||||
await this.userPage.hasElement(e.webcamVideoItem);
|
||||
await this.userPage2.hasElement(e.webcamVideoItem);
|
||||
await this.userPage.shareWebcam();
|
||||
|
||||
await this.modPage.hasNElements(e.webcamVideoItem, 2);
|
||||
await this.userPage.hasNElements(e.webcamVideoItem, 2);
|
||||
await this.userPage2.hasNElements(e.webcamVideoItem, 2);
|
||||
await openLockViewers(this.modPage);
|
||||
await this.modPage.waitAndClickElement(e.lockShareWebcam);
|
||||
await this.modPage.waitAndClick(e.applyLockSettings);
|
||||
await waitAndClearNotification(this.modPage);
|
||||
await this.modPage.wasNthElementRemoved(e.webcamVideoItem, 2);
|
||||
await this.userPage.wasNthElementRemoved(e.webcamVideoItem, 2);
|
||||
await this.userPage2.wasNthElementRemoved(e.webcamVideoItem, 2);
|
||||
|
||||
await this.userPage2.waitForSelector(e.dropdownWebcamButton);
|
||||
await this.userPage2.hasText(e.dropdownWebcamButton, this.modPage.username);
|
||||
await this.userPage.checkElementCount(e.webcamContainer, 1);
|
||||
|
||||
await this.initUserPage2(true);
|
||||
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);
|
||||
await this.userPage.hasElementDisabled(e.joinVideo);
|
||||
}
|
||||
|
||||
async lockSeeOtherViewersWebcams() {
|
||||
await this.modPage.shareWebcam();
|
||||
await this.userPage.shareWebcam();
|
||||
await this.userPage2.shareWebcam();
|
||||
|
||||
await openLockViewers(this.modPage);
|
||||
await this.modPage.waitAndClickElement(e.lockSeeOtherViewersWebcam);
|
||||
await this.modPage.waitAndClick(e.applyLockSettings);
|
||||
@ -45,9 +47,19 @@ class LockViewers extends MultiUsers {
|
||||
const videoContainersCount = [
|
||||
await this.modPage.getSelectorCount(e.webcamVideoItem),
|
||||
await this.userPage.getSelectorCount(e.webcamVideoItem),
|
||||
await this.userPage2.getSelectorCount(e.webcamVideoItem),
|
||||
];
|
||||
expect(videoContainersCount).toStrictEqual([3, 2, 2]);
|
||||
expect(videoContainersCount).toStrictEqual([2, 2]);
|
||||
|
||||
await this.initUserPage2(true);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
async lockShareMicrophone() {
|
||||
@ -58,9 +70,16 @@ class LockViewers extends MultiUsers {
|
||||
await this.modPage.waitAndClick(e.applyLockSettings);
|
||||
await this.userPage.wasRemoved(e.isTalking);
|
||||
await this.userPage.waitForSelector(e.unmuteMicButton);
|
||||
await this.userPage2.waitAndClick(e.joinAudio);
|
||||
await this.userPage2.waitForSelector(e.establishingAudioLabel);
|
||||
await this.initUserPage2(false);
|
||||
await this.userPage2.hasElement(e.leaveListenOnly, ELEMENT_WAIT_LONGER_TIME);
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
async lockSendPublicChatMessages() {
|
||||
@ -69,10 +88,17 @@ class LockViewers extends MultiUsers {
|
||||
await this.modPage.waitAndClick(e.applyLockSettings);
|
||||
await this.userPage.hasElementDisabled(e.chatBox);
|
||||
await this.userPage.hasElementDisabled(e.sendButton);
|
||||
await this.initUserPage2(true);
|
||||
await this.userPage2.hasElementDisabled(e.chatBox);
|
||||
await this.userPage2.hasElementDisabled(e.sendButton);
|
||||
await this.modPage.type(e.chatBox, e.message);
|
||||
await this.modPage.waitAndClick(e.sendButton);
|
||||
await this.modPage.waitAndClick(`${e.userListItem}>>nth=1`);
|
||||
await this.modPage.waitAndClick(`${e.unlockUserButton}>>nth=1`);
|
||||
await this.userPage2.type(e.chatBox, e.message);
|
||||
await this.userPage2.waitAndClick(e.sendButton);
|
||||
await this.userPage.waitForSelector(e.chatUserMessageText);
|
||||
await this.userPage.checkElementCount(e.chatUserMessageText, 1);
|
||||
await this.userPage.checkElementCount(e.chatUserMessageText, 2);
|
||||
}
|
||||
|
||||
async lockSendPrivateChatMessages() {
|
||||
@ -83,6 +109,16 @@ class LockViewers extends MultiUsers {
|
||||
await openLockViewers(this.modPage);
|
||||
await this.modPage.waitAndClickElement(e.lockPrivateChat);
|
||||
await this.modPage.waitAndClick(e.applyLockSettings);
|
||||
await this.initUserPage2(true);
|
||||
await this.modPage.waitAndClick(`${e.userListItem}>>nth=1`);
|
||||
await this.modPage.waitAndClick(`${e.unlockUserButton}>>nth=1`);
|
||||
|
||||
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);
|
||||
|
||||
await this.userPage.waitAndClick(`${e.chatButton}>>nth=1`);
|
||||
await this.userPage.hasElementDisabled(e.chatBox);
|
||||
await this.userPage.hasElementDisabled(e.sendButton);
|
||||
}
|
||||
@ -91,42 +127,84 @@ class LockViewers extends MultiUsers {
|
||||
await this.userPage.waitAndClick(e.sharedNotes);
|
||||
await this.userPage.waitForSelector(e.hideNotesLabel);
|
||||
const sharedNotesLocator = getNotesLocator(this.userPage);
|
||||
await sharedNotesLocator.type(e.message, { timeout: ELEMENT_WAIT_TIME });
|
||||
await sharedNotesLocator.type(e.message, { timeout: ELEMENT_WAIT_LONGER_TIME });
|
||||
expect(sharedNotesLocator).toContainText(e.message, { timeout: ELEMENT_WAIT_TIME });
|
||||
|
||||
await openLockViewers(this.modPage);
|
||||
await this.modPage.waitAndClickElement(e.lockEditSharedNotes);
|
||||
await this.modPage.waitAndClick(e.applyLockSettings);
|
||||
|
||||
await this.initUserPage2(true);
|
||||
await this.userPage2.waitAndClick(e.sharedNotes);
|
||||
await this.userPage2.wasRemoved(e.etherpadFrame);
|
||||
|
||||
await this.userPage.waitAndClick(e.sharedNotes);
|
||||
await this.userPage.waitAndClick(e.sharedNotes);
|
||||
// tries to type, but the element is not editable
|
||||
await this.userPage.wasRemoved(e.etherpadFrame);
|
||||
|
||||
await this.modPage.waitAndClick(`${e.userListItem}>>nth=1`);
|
||||
await this.modPage.waitAndClick(`${e.unlockUserButton}>>nth=1`);
|
||||
}
|
||||
|
||||
async lockSeeOtherViewersUserList() {
|
||||
expect(await this.userPage.getLocator(e.userListItem).count()).toBe(2);
|
||||
await openLockViewers(this.modPage);
|
||||
await this.modPage.waitAndClickElement(e.lockUserList);
|
||||
await this.modPage.waitAndClick(e.applyLockSettings);
|
||||
|
||||
await this.initUserPage2(true);
|
||||
await this.userPage2.checkElementCount(e.userListItem, 1);
|
||||
await sleep(1000);
|
||||
expect(await this.userPage.getLocator(e.userListItem).count()).toBe(1);
|
||||
await this.userPage2.hasText(e.userListItem, this.modPage.username);
|
||||
|
||||
await this.modPage.waitAndClick(`${e.userListItem}>>nth=1`);
|
||||
await this.modPage.waitAndClick(`${e.unlockUserButton}>>nth=1`);
|
||||
await this.userPage2.checkElementCount(e.userListItem, 2);
|
||||
}
|
||||
|
||||
async unlockUser() {
|
||||
await openLockViewers(this.modPage);
|
||||
await this.modPage.waitAndClickElement(e.lockShareWebcam);
|
||||
await this.modPage.waitAndClick(e.applyLockSettings);
|
||||
await this.userPage.hasElementDisabled(e.joinVideo);
|
||||
await this.userPage2.hasElementDisabled(e.joinVideo);
|
||||
async lockSeeOtherViewersAnnotations() {
|
||||
await this.modPage.waitForSelector(e.whiteboard);
|
||||
await this.modPage.waitAndClick(e.multiUsersWhiteboardOn);
|
||||
await this.userPage.waitForSelector(e.whiteboard);
|
||||
await drawArrow(this.userPage);
|
||||
|
||||
const lastUserItemLocator = this.modPage.getLocatorByIndex(e.userListItem, -1);
|
||||
await this.modPage.clickOnLocator(lastUserItemLocator);
|
||||
const unlockUserButton = this.modPage.getLocatorByIndex(e.unlockUserButton, -1);
|
||||
await this.modPage.clickOnLocator(unlockUserButton);
|
||||
await this.userPage.hasElementDisabled(e.joinVideo);
|
||||
await this.userPage2.hasElementEnabled(e.joinVideo);
|
||||
await openLockViewers(this.modPage);
|
||||
await this.modPage.waitAndClickElement(e.hideViewersAnnotation);
|
||||
await this.modPage.waitAndClick(e.applyLockSettings);
|
||||
|
||||
const screenshotOptions = {
|
||||
maxDiffPixels: 1000,
|
||||
};
|
||||
|
||||
await this.initUserPage2(true);
|
||||
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);
|
||||
}
|
||||
|
||||
async lockSeeOtherViewersCursor() {
|
||||
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);
|
||||
|
||||
await this.modPage.checkElementCount(e.whiteboardCursorIndicator, 1);
|
||||
|
||||
await this.initUserPage2(true);
|
||||
await this.userPage2.checkElementCount(e.whiteboardCursorIndicator, 0);
|
||||
|
||||
await this.modPage.waitAndClick(`${e.userListItem}>>nth=1`);
|
||||
await this.modPage.waitAndClick(`${e.unlockUserButton}>>nth=1`);
|
||||
|
||||
await drawArrow(this.userPage);
|
||||
await this.userPage2.checkElementCount(e.whiteboardCursorIndicator, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -158,7 +158,6 @@ test.describe.parallel('User', () => {
|
||||
test('Lock Share webcam', async ({ browser, context, page }) => {
|
||||
const lockViewers = new LockViewers(browser, context);
|
||||
await lockViewers.initPages(page);
|
||||
await lockViewers.initUserPage2();
|
||||
await lockViewers.lockShareWebcam();
|
||||
});
|
||||
|
||||
@ -166,7 +165,6 @@ test.describe.parallel('User', () => {
|
||||
test('Lock See other viewers webcams', async ({ browser, context, page }) => {
|
||||
const lockViewers = new LockViewers(browser, context);
|
||||
await lockViewers.initPages(page);
|
||||
await lockViewers.initUserPage2();
|
||||
await lockViewers.lockSeeOtherViewersWebcams();
|
||||
});
|
||||
|
||||
@ -174,7 +172,6 @@ test.describe.parallel('User', () => {
|
||||
test('Lock Share microphone', async ({ browser, context, page }) => {
|
||||
const lockViewers = new LockViewers(browser, context);
|
||||
await lockViewers.initPages(page);
|
||||
await lockViewers.initUserPage2();
|
||||
await lockViewers.lockShareMicrophone();
|
||||
});
|
||||
|
||||
@ -182,7 +179,6 @@ test.describe.parallel('User', () => {
|
||||
test('Lock Send public chat messages', async ({ browser, context, page }) => {
|
||||
const lockViewers = new LockViewers(browser, context);
|
||||
await lockViewers.initPages(page);
|
||||
await lockViewers.initUserPage2();
|
||||
await lockViewers.lockSendPublicChatMessages();
|
||||
});
|
||||
|
||||
@ -190,7 +186,6 @@ test.describe.parallel('User', () => {
|
||||
test('Lock Send private chat messages', async ({ browser, context, page }) => {
|
||||
const lockViewers = new LockViewers(browser, context);
|
||||
await lockViewers.initPages(page);
|
||||
await lockViewers.initUserPage2();
|
||||
await lockViewers.lockSendPrivateChatMessages();
|
||||
});
|
||||
|
||||
@ -205,16 +200,19 @@ test.describe.parallel('User', () => {
|
||||
test('Lock See other viewers in the Users list', async ({ browser, context, page }) => {
|
||||
const lockViewers = new LockViewers(browser, context);
|
||||
await lockViewers.initPages(page);
|
||||
await lockViewers.initUserPage2();
|
||||
await lockViewers.lockSeeOtherViewersUserList();
|
||||
});
|
||||
|
||||
// https://docs.bigbluebutton.org/2.6/release-tests.html#unlock-a-specific-user
|
||||
test('Unlock a user', async ({ browser, context, page }) => {
|
||||
test('Lock see other viewers annotations', async ({ browser, context, page }) => {
|
||||
const lockViewers = new LockViewers(browser, context);
|
||||
await lockViewers.initPages(page);
|
||||
await lockViewers.initUserPage2();
|
||||
await lockViewers.unlockUser();
|
||||
await lockViewers.lockSeeOtherViewersAnnotations();
|
||||
});
|
||||
|
||||
test('Lock see other viewers cursor', async ({ browser, context, page }) => {
|
||||
const lockViewers = new LockViewers(browser, context);
|
||||
await lockViewers.initPages(page);
|
||||
await lockViewers.lockSeeOtherViewersCursor();
|
||||
});
|
||||
});
|
||||
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 61 KiB |
Binary file not shown.
After Width: | Height: | Size: 56 KiB |
@ -32,9 +32,22 @@ async function checkMutedUsers(test) {
|
||||
await test.hasElement(e.unmuteMicButton);
|
||||
}
|
||||
|
||||
async function drawArrow(test) {
|
||||
const modWbLocator = test.getLocator(e.whiteboard);
|
||||
const wbBox = await modWbLocator.boundingBox();
|
||||
|
||||
await test.waitAndClick(e.wbArrowShape);
|
||||
|
||||
await test.page.mouse.move(wbBox.x + 0.3 * wbBox.width, wbBox.y + 0.3 * wbBox.height);
|
||||
await test.page.mouse.down();
|
||||
await test.page.mouse.move(wbBox.x + 0.7 * wbBox.width, wbBox.y + 0.7 * wbBox.height);
|
||||
await test.page.mouse.up();
|
||||
}
|
||||
|
||||
exports.setStatus = setStatus;
|
||||
exports.openLockViewers = openLockViewers;
|
||||
exports.setGuestPolicyOption = setGuestPolicyOption;
|
||||
exports.checkAvatarIcon = checkAvatarIcon;
|
||||
exports.checkIsPresenter = checkIsPresenter;
|
||||
exports.checkMutedUsers = checkMutedUsers;
|
||||
exports.drawArrow = drawArrow;
|
||||
|
Loading…
Reference in New Issue
Block a user