Merge pull request #14333 from antonbsa/tests-user-actions

test: Adds some user actions and private chat tests
This commit is contained in:
Anton Georgiev 2022-02-16 14:12:42 -05:00 committed by GitHub
commit d5a5bb7d3c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 3491 additions and 477 deletions

View File

@ -199,6 +199,7 @@ class ActionsDropdown extends PureComponent {
label: intl.formatMessage(intlMessages.selectRandUserLabel),
key: this.selectUserRandId,
onClick: () => mountModal(<RandomUserSelectContainer isSelectedUser={false} />),
dataTest: "selectRandomUser",
})
}

View File

@ -120,6 +120,7 @@ const Chat = (props) => {
aria-label={intl.formatMessage(intlMessages.closeChatLabel, { 0: title })}
label={intl.formatMessage(intlMessages.closeChatLabel, { 0: title })}
accessKey={CLOSE_CHAT_AK}
data-test="closePrivateChat"
/>
)
: (

View File

@ -69,7 +69,7 @@ class BBBMenu extends React.Component {
a.dividerTop && <Divider disabled />,
<MenuItem
key={label}
data-test={dataTest || key}
data-test={dataTest}
className={itemClasses.join(' ')}
disableRipple={true}
disableGutters={true}

View File

@ -143,7 +143,9 @@ class RandomUserSelect extends Component {
<div className={styles.modalViewTitle}>
{intl.formatMessage(messages.randUserTitle)}
</div>
<div>{intl.formatMessage(messages.noViewers)}</div>
<div data-test="noViewersSelectedMessage">
{intl.formatMessage(messages.noViewers)}
</div>
</div>
);
} else { // viewers are available
@ -164,7 +166,7 @@ class RandomUserSelect extends Component {
<div aria-hidden className={styles.modalAvatar} style={{ backgroundColor: `${selectedUser.color}` }}>
{selectedUser.name.slice(0, 2)}
</div>
<div className={styles.selectedUserName}>
<div className={styles.selectedUserName} data-test="selectedUserName">
{selectedUser.name}
</div>
{currentUser.presenter
@ -176,6 +178,7 @@ class RandomUserSelect extends Component {
size="md"
className={styles.selectBtn}
onClick={() => this.reselect()}
data-test="selectAgainRadomUser"
/>
)}
</div>

View File

@ -51,7 +51,7 @@ const UserAvatar = ({
<div
aria-hidden="true"
data-test="userAvatar"
data-test={moderator ? 'moderatorAvatar' : 'viewerAvatar'}
className={cx(styles.avatar, {
[styles.moderator]: moderator,
[styles.presenter]: presenter,

View File

@ -319,6 +319,7 @@ class UserDropdown extends PureComponent {
this.handleClose();
},
icon: getEmojiList[s],
dataTest: s,
});
});
return actions;
@ -331,6 +332,7 @@ class UserDropdown extends PureComponent {
onClick: () => this.setState({ showNestedOptions: true }),
icon: 'user',
iconRight: 'right_arrow',
dataTest: 'setStatus',
});
}
@ -444,6 +446,7 @@ class UserDropdown extends PureComponent {
this.handleClose();
},
icon: 'presentation',
dataTest: isMe(user.userId) ? 'takePresenter' : 'makePresenter',
});
}
@ -456,6 +459,7 @@ class UserDropdown extends PureComponent {
this.handleClose();
},
icon: 'promote',
dataTest: 'promoteToModerator',
});
}
@ -468,6 +472,7 @@ class UserDropdown extends PureComponent {
this.handleClose();
},
icon: 'user',
dataTest: 'demoteToViewer',
});
}
@ -665,7 +670,7 @@ class UserDropdown extends PureComponent {
style={{ direction: isRTL ? 'rtl' : 'ltr', width: '100%' }}
>
<div className={styles.userItemContents}>
<div className={styles.userAvatar}>
<div className={styles.userAvatar} data-test="userAvatar">
{this.renderUserAvatar()}
</div>
<UserName

View File

@ -46,4 +46,16 @@ test.describe.parallel('Chat', () => {
await chat.init(true, true);
await chat.emptyMessage();
});
test('Close private chat', async ({ browser, context, page }) => {
const privateChat = new PrivateChat(browser, context);
await privateChat.initPages(page);
await privateChat.closeChat();
});
test('Private chat disabled when user leaves meeting', async ({ browser, context, page }) => {
const privateChat = new PrivateChat(browser, context);
await privateChat.initPages(page);
await privateChat.chatDisabledUserLeaves();
});
});

View File

@ -1,8 +1,7 @@
const { MultiUsers } = require('../user/multiusers');
const e = require('../core/elements');
const { sleep } = require('../core/helpers');
const { checkElementLengthEqualTo } = require('../core/util');
const { ELEMENT_WAIT_TIME } = require('../core/constants');
const { expect } = require('@playwright/test');
class PrivateChat extends MultiUsers {
constructor(browser, context) {
@ -17,11 +16,7 @@ class PrivateChat extends MultiUsers {
// modPage send message
await this.modPage.type(e.chatBox, e.message1);
await this.modPage.waitAndClick(e.sendButton);
await this.userPage.page.waitForFunction(
checkElementLengthEqualTo,
[e.chatButton, 2],
{ timeout: ELEMENT_WAIT_TIME },
);
await this.userPage.waitUntilHaveCountSelector(e.chatButton, 2);
await this.userPage.waitAndClickElement(e.chatButton, 1);
await this.userPage.waitForSelector(e.hidePrivateChat);
// check sent messages
@ -34,6 +29,33 @@ class PrivateChat extends MultiUsers {
await this.modPage.hasText(e.privateChat, e.message2);
await this.userPage.hasText(e.privateChat, e.message2);
}
async closeChat() {
await this.modPage.waitAndClick(e.userListItem);
await this.modPage.waitAndClick(e.startPrivateChat);
await this.modPage.waitUntilHaveCountSelector(e.chatButton, 2);
const privateChatLocator = this.modPage.getLocatorByIndex(e.chatButton, -1);
expect(privateChatLocator).toContainText(this.userPage.username);
await this.modPage.type(e.chatBox, e.message1);
await this.modPage.waitAndClick(e.sendButton);
await this.userPage.waitUntilHaveCountSelector(e.chatButton, 2);
await this.modPage.waitAndClick(e.closePrivateChat);
await this.modPage.wasRemoved(e.hidePrivateChat);
await this.modPage.waitUntilHaveCountSelector(e.chatButton, 1);
const userChatCount = await this.userPage.getSelectorCount(e.chatButton);
expect(userChatCount).toBe(2);
}
async chatDisabledUserLeaves() {
await this.modPage.waitAndClick(e.userListItem);
await this.modPage.waitAndClick(e.startPrivateChat);
await this.modPage.waitForSelector(e.sendButton);
await this.userPage.waitAndClick(e.optionsButton);
await this.userPage.waitAndClick(e.logout);
await this.modPage.hasElementDisabled(e.chatBox);
await this.modPage.hasElementDisabled(e.sendButton);
}
}
exports.PrivateChat = PrivateChat;

View File

@ -59,9 +59,11 @@ exports.publicChat = 'div[data-test="publicChat"]';
exports.privateChat = 'div[data-test="privateChat"]';
exports.hidePublicChat = 'button[data-test="hidePublicChat"]';
exports.hidePrivateChat = 'button[data-test="hidePrivateChat"]';
exports.closePrivateChat = 'button[data-test="closePrivateChat"]';
exports.typingIndicator = 'span[data-test="typingIndicator"]';
exports.chatUserMessageText = 'p[data-test="chatUserMessageText"]';
exports.chatClearMessageText = 'p[data-test="chatClearMessageText"]';
exports.chatWelcomeMessageText = 'p[data-test="chatWelcomeMessageText"]';
// Messages
exports.message = 'Hello World!';
exports.testMessage = 'Just a test';
@ -187,9 +189,11 @@ exports.notesTitle = 'h2[data-test="notesTitle"]';
// User
exports.userAvatar = 'div[data-test="userAvatar"]';
exports.moderatorAvatar = 'div[data-test="moderatorAvatar"]';
exports.viewerAvatar = 'div[data-test="viewerAvatar"]';
exports.applauseIcon = `${this.userAvatar} > div > i[class="icon-bbb-applause"]`;
exports.awayIcon = `${this.userAvatar} > div > i[class="icon-bbb-time"]`;
exports.setStatus = 'li[data-test="setstatus"]';
exports.setStatus = 'li[data-test="setStatus"]';
exports.away = 'li[data-test="away"]';
exports.applaud = 'li[data-test="applause"]';
exports.userListItem = 'div[data-test="userListItem"]';
@ -198,7 +202,7 @@ exports.multiWhiteboardTool = 'span[data-test="multiWhiteboardTool"]';
exports.manageUsers = 'button[data-test="manageUsers"]';
exports.presenterClassName = 'presenter--';
exports.anyUser = 'div[data-test="userListItem"]';
exports.userList = 'button[data-test="toggleUserList"]';
exports.userListToggleBtn = 'button[data-test="toggleUserList"]';
exports.mobileUser = 'span[data-test="mobileUser"]';
exports.connectionStatusBtn = 'button[data-test="connectionStatusButton"]';
exports.connectionStatusModal = 'div[data-test="connectionStatusModal"]';
@ -216,6 +220,14 @@ exports.joinMeetingDemoPage = 'div[class^="join-meeting"]';
exports.askModerator = 'button[data-test="askModerator"]';
exports.alwaysAccept = 'button[data-test="alwaysAccept"]';
exports.alwaysDeny = 'button[data-test="alwaysDeny"]';
exports.selectRandomUser = 'li[data-test="selectRandomUser"]';
exports.noViewersSelectedMessage = 'div[data-test="noViewersSelectedMessage"]';
exports.selectedUserName = 'div[data-test="selectedUserName"]';
exports.selectAgainRadomUser = 'button[data-test="selectAgainRadomUser"]';
exports.promoteToModerator = 'li[data-test="promoteToModerator"]';
exports.demoteToViewer = 'li[data-test="demoteToViewer"]';
exports.makePresenter = 'li[data-test="makePresenter"]';
exports.takePresenter = 'li[data-test="takePresenter"]';
// Lock Viewers
exports.lockViewersButton = 'li[data-test="lockViewersButton"]';
exports.unlockUserButton = 'li[data-test="unlockUserButton"]';

View File

@ -7,7 +7,7 @@ const parameters = require('./parameters');
const helpers = require('./helpers');
const e = require('./elements');
const { ELEMENT_WAIT_TIME, ELEMENT_WAIT_LONGER_TIME, VIDEO_LOADING_WAIT_TIME } = require('./constants');
const { checkElement } = require('./util');
const { checkElement, checkElementLengthEqualTo } = require('./util');
class Page {
constructor(browser, page) {
@ -81,6 +81,10 @@ class Page {
return this.page.locator(selector);
}
getLocatorByIndex(selector, index) {
return this.page.locator(selector).nth(index);
}
async getSelectorCount(selector) {
const locator = this.getLocator(selector);
return locator.count();
@ -95,6 +99,14 @@ class Page {
await this.page.waitForSelector(selector, { timeout });
}
async waitUntilHaveCountSelector(selector, count, timeout = ELEMENT_WAIT_TIME) {
await this.page.waitForFunction(
checkElementLengthEqualTo,
[selector, count],
{ timeout },
);
}
async type(selector, text) {
const handle = this.getLocator(selector);
await handle.focus();

View File

@ -9,7 +9,7 @@ function checkElementLengthEqualTo([element, count]) {
}
function checkIncludeClass([selector, className]) {
return document.querySelectorAll(selector)[0].className.includes(className);
return document.querySelectorAll(`${selector} > div`)[0].className.includes(className);
}
exports.checkElement = checkElement;

View File

@ -1,7 +1,5 @@
const { expect } = require('@playwright/test');
const e = require('../core/elements');
const { ELEMENT_WAIT_TIME } = require('../core/constants');
const { checkElementLengthEqualTo } = require('../core/util');
async function enableChatPopup(test) {
await test.waitAndClick(e.notificationsTab);
@ -40,11 +38,7 @@ async function privateChatMessageToast(page2) {
await page2.waitAndClick(e.userListItem);
await page2.waitAndClick(e.startPrivateChat);
// wait for the private chat to be ready
await page2.page.waitForFunction(
checkElementLengthEqualTo,
[e.chatButton, 2],
{ timeout: ELEMENT_WAIT_TIME },
);
await page2.waitUntilHaveCountSelector(e.chatButton, 2);
// send a private message
await page2.type(e.chatBox, e.message1);
await page2.waitAndClick(e.sendButton);

File diff suppressed because it is too large Load Diff

View File

@ -6,11 +6,11 @@
"test:debug": "npx playwright test --debug -g"
},
"devDependencies": {
"@playwright/test": "^1.16.3",
"axios": "^0.24.0",
"dotenv": "^10.0.0",
"@playwright/test": "^1.18.1",
"axios": "^0.25.0",
"dotenv": "^16.0.0",
"js-yaml": "^4.1.0",
"playwright": "^1.16.3",
"playwright": "^1.18.1",
"sha1": "^1.1.1"
}
}

View File

@ -133,17 +133,15 @@ class Polling extends MultiUsers {
}
async typeOnLastChoiceInput() {
const allInputs = this.modPage.getLocator(e.pollOptionItem);
const lastInput = allInputs.last();
const lastInput = this.modPage.getLocatorByIndex(e.pollOptionItem, -1);
await lastInput.fill(this.newInputText);
}
async checkLastOptionText() {
await this.userPage.waitForSelector(e.pollingContainer);
const answerOptions = this.userPage.getLocator(e.pollAnswerOptionBtn);
const lastOptionText = await answerOptions.last().textContent();
await expect(lastOptionText).toEqual(this.newInputText);
const lastOptionText = this.userPage.getLocatorByIndex(e.pollAnswerOptionBtn, -1);
await expect(lastOptionText).toHaveText(this.newInputText);
}
}

View File

@ -2,7 +2,7 @@ const { expect } = require('@playwright/test');
const Page = require('../core/page');
const e = require('../core/elements');
const c = require('../core/constants');
const { checkIncludeClass } = require('../core/util');
const { checkPresenterClass } = require('../user/util');
class Stress {
constructor(browser, context, page) {
@ -18,7 +18,7 @@ class Stress {
for (let i = 1; i <= c.JOIN_AS_MODERATOR_TEST_ROUNDS; i++) {
await this.modPage.init(true, true, { fullName: `Moderator-${i}` });
await this.modPage.waitForSelector(e.userAvatar);
const hasPresenterClass = await this.modPage.page.evaluate(checkIncludeClass, [e.userAvatar, e.presenterClassName]);
const hasPresenterClass = await checkPresenterClass(this.modPage);
await this.modPage.waitAndClick(e.actions);
const canStartPoll = await this.modPage.checkElement(e.polling);
if (!hasPresenterClass || !canStartPoll) {

View File

@ -1,6 +1,7 @@
const { MultiUsers } = require("./multiusers");
const e = require('../core/elements');
const { sleep } = require('../core/helpers');
const { setGuestPolicyOption } = require("./util");
class GuestPolicy extends MultiUsers {
constructor(browser, context) {
@ -8,25 +9,22 @@ class GuestPolicy extends MultiUsers {
}
async askModerator() {
await this.modPage.waitAndClick(e.manageUsers);
await this.modPage.waitAndClick(e.guestPolicyLabel);
await this.modPage.waitAndClick(e.askModerator);
await setGuestPolicyOption(this.modPage, e.askModerator);
await sleep(500);
await this.initUserPage(false);
await this.modPage.hasElement(e.waitingUsersBtn);
}
async alwaysAccept() {
await this.modPage.waitAndClick(e.manageUsers);
await this.modPage.waitAndClick(e.guestPolicyLabel);
await this.modPage.waitAndClick(e.alwaysAccept);
await setGuestPolicyOption(this.modPage, e.askModerator);
await setGuestPolicyOption(this.modPage, e.alwaysAccept);
await sleep(500);
await this.initUserPage(false);
await this.userPage.hasElement(e.audioModal);
}
async alwaysDeny() {
await this.modPage.waitAndClick(e.manageUsers);
await this.modPage.waitAndClick(e.guestPolicyLabel);
await this.modPage.waitAndClick(e.alwaysDeny);
await setGuestPolicyOption(this.modPage, e.alwaysDeny);
await sleep(1500);
await this.initUserPage(false);
await this.userPage.hasElement(e.joinMeetingDemoPage);

View File

@ -5,6 +5,7 @@ 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");
class LockViewers extends MultiUsers {
constructor(browser, page) {
@ -35,6 +36,7 @@ class LockViewers extends MultiUsers {
await openLockViewers(this.modPage);
await this.modPage.waitAndClickElement(e.lockSeeOtherViewersWebcam);
await this.modPage.waitAndClick(e.applyLockSettings);
await sleep(500);
const videoContainersCount = [
await this.modPage.getSelectorCount(e.webcamVideoItem),
await this.userPage.getSelectorCount(e.webcamVideoItem),
@ -69,9 +71,9 @@ class LockViewers extends MultiUsers {
}
async lockSendPrivateChatMessages() {
const lastUserItemLocator = this.userPage.getLocator(e.userListItem).last();
const lastUserItemLocator = this.userPage.getLocatorByIndex(e.userListItem, -1);
await this.userPage.clickOnLocator(lastUserItemLocator);
const startPrivateChatButton = this.userPage.getLocator(e.startPrivateChat).last();
const startPrivateChatButton = this.userPage.getLocatorByIndex(e.startPrivateChat, -1);
await this.userPage.clickOnLocator(startPrivateChatButton);
await openLockViewers(this.modPage);
await this.modPage.waitAndClickElement(e.lockPrivateChat);
@ -115,9 +117,9 @@ class LockViewers extends MultiUsers {
await this.userPage.hasElementDisabled(e.joinVideo);
await this.userPage2.hasElementDisabled(e.joinVideo);
const lastUserItemLocator = this.modPage.getLocator(e.userListItem).last();
const lastUserItemLocator = this.modPage.getLocatorByIndex(e.userListItem, -1);
await this.modPage.clickOnLocator(lastUserItemLocator);
const unlockUserButton = this.modPage.getLocator(e.unlockUserButton).last();
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);

View File

@ -7,7 +7,7 @@ class MobileDevices extends MultiUsers {
}
async mobileTagName() {
await this.modPage.waitAndClick(e.userList);
await this.modPage.waitAndClick(e.userListToggleBtn);
await this.modPage.waitForSelector(e.firstUser);
await this.modPage.hasElement(e.mobileUser);
}

View File

@ -2,6 +2,8 @@ const { expect } = require('@playwright/test');
const Page = require('../core/page');
const e = require('../core/elements');
const { waitAndClearNotification } = require('../notifications/util');
const { sleep } = require('../core/helpers');
const { checkAvatarIcon, checkPresenterClass } = require('./util');
class MultiUsers {
constructor(browser, context) {
@ -16,14 +18,26 @@ class MultiUsers {
async initModPage(page, shouldCloseAudioModal = true, { fullName = 'Moderator', ...restOptions } = {}) {
const options = {
fullName,
...restOptions,
fullName,
};
this.modPage = new Page(this.browser, page);
await this.modPage.init(true, shouldCloseAudioModal, options);
}
async initModPage2(shouldCloseAudioModal = true, context = this.context, { fullName = 'Moderator2', useModMeetingId = true, ...restOptions } = {}) {
const options = {
...restOptions,
fullName,
meetingId: (useModMeetingId) ? this.modPage.meetingId : undefined,
};
const page = await context.newPage();
this.modPage2 = new Page(this.browser, page);
await this.modPage2.init(true, shouldCloseAudioModal, options);
}
async initUserPage(shouldCloseAudioModal = true, context = this.context, { fullName = 'Attendee', useModMeetingId = true, ...restOptions } = {}) {
const options = {
...restOptions,
@ -59,6 +73,51 @@ class MultiUsers {
await expect(secondUserOnUserPage).toHaveCount(1);
}
async makePresenter() {
await this.modPage.waitAndClick(e.userListItem);
await this.modPage.waitAndClick(e.makePresenter);
await this.userPage.hasElement(e.startScreenSharing);
await this.userPage.hasElement(e.presentationToolbarWrapper);
await this.userPage.hasElement(e.toolsButton);
await this.userPage.hasElement(e.actions);
const hasPresenterClass = await checkPresenterClass(this.userPage);
expect(hasPresenterClass).toBeTruthy();
}
async takePresenter() {
await this.modPage2.waitAndClick(e.firstUser);
await this.modPage2.waitAndClick(e.takePresenter);
await this.modPage2.hasElement(e.startScreenSharing);
await this.modPage2.hasElement(e.toolsButton);
await this.modPage2.hasElement(e.presentationToolbarWrapper);
const hasPresenterClass = await checkPresenterClass(this.modPage2);
expect(hasPresenterClass).toBeTruthy();
await this.modPage2.waitAndClick(e.actions);
await this.modPage2.hasElement(e.managePresentations);
await this.modPage2.hasElement(e.polling);
await this.modPage2.hasElement(e.shareExternalVideoBtn);
}
async promoteToModerator() {
await checkAvatarIcon(this.userPage, false);
await this.userPage.wasRemoved(e.manageUsers);
await this.modPage.waitAndClick(e.userListItem);
await this.modPage.waitAndClick(e.promoteToModerator);
await checkAvatarIcon(this.userPage);
await this.userPage.hasElement(e.manageUsers);
}
async demoteToViewer() {
await checkAvatarIcon(this.modPage2);
await this.modPage2.hasElement(e.manageUsers);
await this.modPage.waitAndClick(e.userListItem);
await this.modPage.waitAndClick(e.demoteToViewer);
await checkAvatarIcon(this.modPage2, false);
await this.modPage2.wasRemoved(e.manageUsers);
}
async raiseHandTest() {
await this.userPage.waitAndClick(e.raiseHandBtn);
await this.userPage.hasElement(e.lowerHandBtn);
@ -78,6 +137,52 @@ class MultiUsers {
await this.userPage.hasElement(e.raiseHandBtn);
}
async toggleUserList() {
await this.modPage.hasElement(e.chatWelcomeMessageText);
await this.modPage.hasElement(e.chatBox);
await this.modPage.hasElement(e.chatButton);
await this.modPage.waitAndClick(e.userListToggleBtn);
await this.modPage.wasRemoved(e.chatWelcomeMessageText);
await this.modPage.wasRemoved(e.chatBox);
await this.modPage.wasRemoved(e.chatButton);
await this.modPage.waitAndClick(e.userListToggleBtn);
await this.modPage.wasRemoved(e.chatWelcomeMessageText);
await this.modPage.wasRemoved(e.chatBox);
await this.modPage.hasElement(e.chatButton);
}
async selectRandomUser() {
// check with no viewer joined
await this.modPage.waitAndClick(e.actions);
await this.modPage.waitAndClick(e.selectRandomUser);
await this.modPage.hasElement(e.noViewersSelectedMessage);
// check with only one viewer
await this.modPage.waitAndClick(e.closeModal);
await this.initUserPage();
await this.modPage.waitAndClick(e.actions);
await this.modPage.waitAndClick(e.selectRandomUser);
await this.modPage.hasText(e.selectedUserName, this.userPage.username);
// check with more users
await this.modPage.waitAndClick(e.closeModal);
await this.initUserPage2();
await this.modPage.waitAndClick(e.actions);
await this.modPage.waitAndClick(e.selectRandomUser);
const nameSelected = await this.modPage.getLocator(e.selectedUserName).textContent();
await this.userPage.hasText(e.selectedUserName, nameSelected);
await this.userPage2.hasText(e.selectedUserName, nameSelected);
// user close modal just for you
await this.userPage.waitAndClick(e.closeModal);
await this.userPage.wasRemoved(e.selectedUserName);
await this.userPage2.hasElement(e.selectedUserName);
await this.modPage.hasElement(e.selectedUserName);
// moderator close modal
await this.modPage.waitAndClick(e.selectAgainRadomUser);
await sleep(500);
await this.modPage.waitAndClick(e.closeModal);
await this.userPage.wasRemoved(e.selectedUserName);
await this.userPage2.wasRemoved(e.selectedUserName);
}
async whiteboardAccess() {
await this.modPage.waitForSelector(e.whiteboard);
await this.modPage.waitAndClick(e.userListItem);

View File

@ -20,7 +20,7 @@ class Status extends Page {
}
async mobileTagName() {
await this.waitAndClick(e.userList);
await this.waitAndClick(e.userListToggleBtn);
await this.waitForSelector(e.firstUser);
await this.hasElement(e.mobileUser);
}

View File

@ -16,6 +16,12 @@ test.describe.parallel('User', () => {
await multiusers.getAvatarColorAndCompareWithUserListItem();
await multiusers.lowerHandTest();
});
test('Toggle user list', async ({ browser, context, page }) => {
const multiusers = new MultiUsers(browser, context);
await multiusers.initModPage(page);
await multiusers.toggleUserList();
});
});
test.describe.parallel('List', () => {
@ -30,6 +36,32 @@ test.describe.parallel('User', () => {
await multiusers.initPages(page);
await multiusers.userPresence();
});
test('Make presenter', async ({ browser, context, page }) => {
const multiusers = new MultiUsers(browser, context);
await multiusers.initPages(page);
await multiusers.makePresenter();
});
test('Take presenter', async ({ browser, context, page }) => {
const multiusers = new MultiUsers(browser, context);
await multiusers.initModPage(page);
await multiusers.initModPage2();
await multiusers.takePresenter();
});
test('Promote to moderator', async ({ browser, context, page }) => {
const multiusers = new MultiUsers(browser, context);
await multiusers.initPages(page);
await multiusers.promoteToModerator();
});
test('Demote to viewer', async ({ browser, context, page }) => {
const multiusers = new MultiUsers(browser, context);
await multiusers.initModPage(page);
await multiusers.initModPage2();
await multiusers.demoteToViewer();
});
});
test.describe.parallel('Manage', () => {
@ -52,6 +84,69 @@ test.describe.parallel('User', () => {
await guestPolicy.alwaysDeny();
});
});
test.describe.parallel('Lock viewers', () => {
test('Lock Share webcam', async ({ browser, context, page }) => {
const lockViewers = new LockViewers(browser, context);
await lockViewers.initPages(page);
await lockViewers.initUserPage2();
await lockViewers.lockShareWebcam();
});
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();
});
test('Lock Share microphone', async ({ browser, context, page }) => {
const lockViewers = new LockViewers(browser, context);
await lockViewers.initPages(page);
await lockViewers.initUserPage2();
await lockViewers.lockShareMicrophone();
});
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();
});
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();
});
test('Lock Edit Shared Notes', async ({ browser, context, page }) => {
const lockViewers = new LockViewers(browser, context);
await lockViewers.initPages(page);
await lockViewers.lockEditSharedNotes();
});
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();
});
test('Unlock a user', async ({ browser, context, page }) => {
const lockViewers = new LockViewers(browser, context);
await lockViewers.initPages(page);
await lockViewers.initUserPage2();
await lockViewers.unlockUser();
});
});
test('Select random user', async ({ browser, context, page }) => {
const multiusers = new MultiUsers(browser, context);
await multiusers.initModPage(page);
await multiusers.selectRandomUser();
});
});
test.describe.parallel('Mobile devices', () => {
@ -94,61 +189,4 @@ test.describe.parallel('User', () => {
await mobileDevices.chatPanelNotAppearOnMobile();
});
});
test.describe.parallel('Lock viewers', () => {
test('Lock Share webcam', async ({ browser, context, page }) => {
const lockViewers = new LockViewers(browser, context);
await lockViewers.initPages(page);
await lockViewers.initUserPage2();
await lockViewers.lockShareWebcam();
});
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();
});
test('Lock Share microphone', async ({ browser, context, page }) => {
const lockViewers = new LockViewers(browser, context);
await lockViewers.initPages(page);
await lockViewers.initUserPage2();
await lockViewers.lockShareMicrophone();
});
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();
});
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();
});
test('Lock Edit Shared Notes', async ({ browser, context, page }) => {
const lockViewers = new LockViewers(browser, context);
await lockViewers.initPages(page);
await lockViewers.lockEditSharedNotes();
});
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();
});
test('Unlock a user', async ({ browser, context, page }) => {
const lockViewers = new LockViewers(browser, context);
await lockViewers.initPages(page);
await lockViewers.initUserPage2();
await lockViewers.unlockUser();
});
});
});

View File

@ -1,4 +1,5 @@
const e = require('../core/elements');
const { checkIncludeClass } = require('../core/util');
async function setStatus(page, status) {
await page.waitAndClick(e.firstUser);
@ -11,5 +12,22 @@ async function openLockViewers(test) {
await test.waitAndClick(e.lockViewersButton);
}
async function setGuestPolicyOption(test, option) {
await test.waitAndClick(e.manageUsers);
await test.waitAndClick(e.guestPolicyLabel);
await test.waitAndClick(option);
}
async function checkAvatarIcon(test, checkModIcon = true) {
await test.hasElement(`${e.firstUser} ${checkModIcon ? e.moderatorAvatar : e.viewerAvatar}`);
}
async function checkPresenterClass(test) {
return test.page.evaluate(checkIncludeClass, [e.userAvatar, e.presenterClassName]);
}
exports.setStatus = setStatus;
exports.openLockViewers = openLockViewers;
exports.setGuestPolicyOption = setGuestPolicyOption;
exports.checkAvatarIcon = checkAvatarIcon;
exports.checkPresenterClass = checkPresenterClass;