fix currentUser selector and fix the presenter verification
This commit is contained in:
parent
94ea254d21
commit
774c623b30
@ -429,8 +429,8 @@ class UserListItem extends PureComponent {
|
||||
&& !showNestedOptions,
|
||||
key: 'changeWhiteboardAccess',
|
||||
label: user.whiteboardAccess
|
||||
? intl.formatMessage(messages.removeWhiteboardAccess)
|
||||
: intl.formatMessage(messages.giveWhiteboardAccess),
|
||||
? intl.formatMessage(messages.removeWhiteboardAccess)
|
||||
: intl.formatMessage(messages.giveWhiteboardAccess),
|
||||
onClick: () => {
|
||||
WhiteboardService.changeWhiteboardAccess(user.userId, !user.whiteboardAccess);
|
||||
this.handleClose();
|
||||
@ -525,7 +525,7 @@ class UserListItem extends PureComponent {
|
||||
this.handleClose();
|
||||
},
|
||||
icon: 'video_off',
|
||||
}
|
||||
},
|
||||
];
|
||||
|
||||
const statuses = Object.keys(getEmojiList);
|
||||
@ -542,10 +542,10 @@ class UserListItem extends PureComponent {
|
||||
},
|
||||
icon: getEmojiList[s],
|
||||
dataTest: s,
|
||||
})
|
||||
});
|
||||
});
|
||||
|
||||
return availableActions.filter(action => action.allowed);
|
||||
return availableActions.filter((action) => action.allowed);
|
||||
}
|
||||
|
||||
getDropdownMenuParent() {
|
||||
@ -713,7 +713,7 @@ class UserListItem extends PureComponent {
|
||||
|
||||
const innerContents = (
|
||||
<Styled.UserItemInnerContents>
|
||||
<Styled.UserAvatar data-test="userAvatar">
|
||||
<Styled.UserAvatar data-test="userAvatar" data-test-presenter={user.presenter ? '' : undefined}>
|
||||
{this.renderUserAvatar()}
|
||||
</Styled.UserAvatar>
|
||||
{!compact
|
||||
|
@ -197,7 +197,7 @@ exports.setStatus = 'li[data-test="setStatus"]';
|
||||
exports.away = 'li[data-test="away"]';
|
||||
exports.applaud = 'li[data-test="applause"]';
|
||||
exports.userListItem = 'div[data-test="userListItem"]';
|
||||
exports.firstUser = 'div[data-test="userListItemCurrent"]';
|
||||
exports.currentUser = 'div[data-test="userListItemCurrent"]';
|
||||
exports.multiWhiteboardTool = 'span[data-test="multiWhiteboardTool"]';
|
||||
exports.manageUsers = 'button[data-test="manageUsers"]';
|
||||
exports.presenterClassName = 'presenter--';
|
||||
|
@ -110,7 +110,7 @@ class Page {
|
||||
async type(selector, text) {
|
||||
const handle = this.getLocator(selector);
|
||||
await handle.focus();
|
||||
await handle.type(text);
|
||||
await handle.type(text, { timeout: ELEMENT_WAIT_TIME });
|
||||
}
|
||||
|
||||
async waitAndClickElement(element, index = 0, timeout = ELEMENT_WAIT_TIME) {
|
||||
|
@ -8,10 +8,5 @@ function checkElementLengthEqualTo([element, count]) {
|
||||
return document.querySelectorAll(element).length == count;
|
||||
}
|
||||
|
||||
function checkIncludeClass([selector, className]) {
|
||||
return document.querySelectorAll(`${selector} > div`)[0].className.includes(className);
|
||||
}
|
||||
|
||||
exports.checkElement = checkElement;
|
||||
exports.checkElementLengthEqualTo = checkElementLengthEqualTo;
|
||||
exports.checkIncludeClass = checkIncludeClass;
|
||||
|
@ -9,7 +9,6 @@ class ScreenShare extends Page {
|
||||
|
||||
async startSharing() {
|
||||
await startScreenshare(this);
|
||||
await getScreenShareBreakoutContainer(this);
|
||||
await this.hasElement(e.isSharingScreen);
|
||||
}
|
||||
|
||||
|
@ -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 { checkPresenterClass } = require('../user/util');
|
||||
const { checkIsPresenter } = require('../user/util');
|
||||
|
||||
class Stress {
|
||||
constructor(browser, context, page) {
|
||||
@ -18,10 +18,10 @@ 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 checkPresenterClass(this.modPage);
|
||||
const isPresenter = await checkIsPresenter(this.modPage);
|
||||
await this.modPage.waitAndClick(e.actions);
|
||||
const canStartPoll = await this.modPage.checkElement(e.polling);
|
||||
if (!hasPresenterClass || !canStartPoll) {
|
||||
if (!isPresenter || !canStartPoll) {
|
||||
failureCount++;
|
||||
}
|
||||
|
||||
|
@ -87,7 +87,7 @@ class LockViewers extends MultiUsers {
|
||||
await this.userPage.waitForSelector(e.hideNotesLabel);
|
||||
const sharedNotesLocator = getNotesLocator(this.userPage);
|
||||
await sharedNotesLocator.type(e.message);
|
||||
expect(sharedNotesLocator).toContainText(e.message);
|
||||
expect(sharedNotesLocator).toContainText(e.message, { timeout: ELEMENT_WAIT_TIME });
|
||||
|
||||
await openLockViewers(this.modPage);
|
||||
await this.modPage.waitAndClickElement(e.lockEditSharedNotes);
|
||||
@ -95,8 +95,8 @@ class LockViewers extends MultiUsers {
|
||||
await this.userPage.waitAndClick(e.sharedNotes);
|
||||
await this.userPage.waitAndClick(e.sharedNotes);
|
||||
// tries to type, but the element is not editable
|
||||
await sharedNotesLocator.type(e.testMessage);
|
||||
await expect(sharedNotesLocator).not.toContainText(e.testMessage);
|
||||
await sharedNotesLocator.type(e.testMessage, { timeout: ELEMENT_WAIT_TIME });
|
||||
await expect(sharedNotesLocator).not.toContainText(e.testMessage, { timeout: ELEMENT_WAIT_TIME });
|
||||
}
|
||||
|
||||
async lockSeeOtherViewersUserList() {
|
||||
|
@ -8,7 +8,7 @@ class MobileDevices extends MultiUsers {
|
||||
|
||||
async mobileTagName() {
|
||||
await this.modPage.waitAndClick(e.userListToggleBtn);
|
||||
await this.modPage.waitForSelector(e.firstUser);
|
||||
await this.modPage.waitForSelector(e.currentUser);
|
||||
await this.modPage.hasElement(e.mobileUser);
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,7 @@ 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');
|
||||
const { checkAvatarIcon, checkIsPresenter } = require('./util');
|
||||
|
||||
class MultiUsers {
|
||||
constructor(browser, context) {
|
||||
@ -63,9 +63,9 @@ class MultiUsers {
|
||||
}
|
||||
|
||||
async userPresence() {
|
||||
const firstUserOnModPage = this.modPage.getLocator(e.firstUser);
|
||||
const firstUserOnModPage = this.modPage.getLocator(e.currentUser);
|
||||
const secondUserOnModPage = this.modPage.getLocator(e.userListItem);
|
||||
const firstUserOnUserPage = this.userPage.getLocator(e.firstUser);
|
||||
const firstUserOnUserPage = this.userPage.getLocator(e.currentUser);
|
||||
const secondUserOnUserPage = this.userPage.getLocator(e.userListItem);
|
||||
await expect(firstUserOnModPage).toHaveCount(1);
|
||||
await expect(secondUserOnModPage).toHaveCount(1);
|
||||
@ -81,19 +81,19 @@ class MultiUsers {
|
||||
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();
|
||||
const isPresenter = await checkIsPresenter(this.userPage);
|
||||
expect(isPresenter).toBeTruthy();
|
||||
}
|
||||
|
||||
async takePresenter() {
|
||||
await this.modPage2.waitAndClick(e.firstUser);
|
||||
await this.modPage2.waitAndClick(e.currentUser);
|
||||
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();
|
||||
const isPresenter = await checkIsPresenter(this.modPage2);
|
||||
expect(isPresenter).toBeTruthy();
|
||||
await this.modPage2.waitAndClick(e.actions);
|
||||
await this.modPage2.hasElement(e.managePresentations);
|
||||
await this.modPage2.hasElement(e.polling);
|
||||
|
@ -21,7 +21,7 @@ class Status extends Page {
|
||||
|
||||
async mobileTagName() {
|
||||
await this.waitAndClick(e.userListToggleBtn);
|
||||
await this.waitForSelector(e.firstUser);
|
||||
await this.waitForSelector(e.currentUser);
|
||||
await this.hasElement(e.mobileUser);
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,7 @@
|
||||
const e = require('../core/elements');
|
||||
const { checkIncludeClass } = require('../core/util');
|
||||
|
||||
async function setStatus(page, status) {
|
||||
await page.waitAndClick(e.firstUser);
|
||||
await page.waitAndClick(e.currentUser);
|
||||
await page.waitAndClick(e.setStatus);
|
||||
await page.waitAndClick(status);
|
||||
}
|
||||
@ -19,15 +18,17 @@ async function setGuestPolicyOption(test, option) {
|
||||
}
|
||||
|
||||
async function checkAvatarIcon(test, checkModIcon = true) {
|
||||
await test.hasElement(`${e.firstUser} ${checkModIcon ? e.moderatorAvatar : e.viewerAvatar}`);
|
||||
await test.hasElement(`${e.currentUser} ${checkModIcon ? e.moderatorAvatar : e.viewerAvatar}`);
|
||||
}
|
||||
|
||||
async function checkPresenterClass(test) {
|
||||
return test.page.evaluate(checkIncludeClass, [e.userAvatar, e.presenterClassName]);
|
||||
async function checkIsPresenter(test) {
|
||||
return test.page.evaluate(([currentAvatarSelector, userAvatarSelector]) => {
|
||||
return document.querySelectorAll(`${currentAvatarSelector} ${userAvatarSelector}`)[0].hasAttribute('data-test-presenter')
|
||||
}, [e.currentUser, e.userAvatar])
|
||||
}
|
||||
|
||||
exports.setStatus = setStatus;
|
||||
exports.openLockViewers = openLockViewers;
|
||||
exports.setGuestPolicyOption = setGuestPolicyOption;
|
||||
exports.checkAvatarIcon = checkAvatarIcon;
|
||||
exports.checkPresenterClass = checkPresenterClass;
|
||||
exports.checkIsPresenter = checkIsPresenter;
|
||||
|
Loading…
Reference in New Issue
Block a user