From cccf8db790f0279818a60fc5e30c9795f959b07e Mon Sep 17 00:00:00 2001 From: Bohdan Zhemelinskyi Date: Tue, 26 Oct 2021 13:35:32 +0000 Subject: [PATCH 01/37] Implemented the fix regarding mongod error messages --- build/packages-template/bbb-html5/mongod_start_pre.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build/packages-template/bbb-html5/mongod_start_pre.sh b/build/packages-template/bbb-html5/mongod_start_pre.sh index d12dcd7626..fdc9c835bf 100644 --- a/build/packages-template/bbb-html5/mongod_start_pre.sh +++ b/build/packages-template/bbb-html5/mongod_start_pre.sh @@ -9,4 +9,8 @@ if [ ! -f /.dockerenv ]; then mount -t tmpfs -o size=512m tmpfs /mnt/mongo-ramdisk fi -chown -R mongodb:mongodb /mnt/mongo-ramdisk +if id mongod &> /dev/null; then + chown -R mongod:mongod /mnt/mongo-ramdisk +else + chown -R mongodb:mongodb /mnt/mongo-ramdisk +fi From e7690fe52e00dda27d4a3f2ddfdf0d2b1acaf32c Mon Sep 17 00:00:00 2001 From: Tainan Felipe Date: Tue, 18 Jan 2022 17:03:01 -0300 Subject: [PATCH 02/37] Remove guest attempts limit on guestWait endpoint --- .../private/static/guest-wait/guest-wait.html | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/bigbluebutton-html5/private/static/guest-wait/guest-wait.html b/bigbluebutton-html5/private/static/guest-wait/guest-wait.html index 5a3b6b0671..c129c5d7ac 100755 --- a/bigbluebutton-html5/private/static/guest-wait/guest-wait.html +++ b/bigbluebutton-html5/private/static/guest-wait/guest-wait.html @@ -247,7 +247,7 @@ return; } - pollGuestStatus(sessionToken, 0, ATTEMPT_LIMIT, ATTEMPT_EVERY_MS); + pollGuestStatus(sessionToken, ATTEMPT_EVERY_MS); } catch (e) { disableAnimation(); console.error(e); @@ -277,15 +277,9 @@ }, REDIRECT_TIMEOUT); }; - function pollGuestStatus(token, attempt, limit, everyMs) { + function pollGuestStatus(token, everyMs) { setTimeout(function () { - if (attempt >= limit) { - disableAnimation(); - updateMessage(_('app.guest.noModeratorResponse')); - return; - } - fetchGuestWait(token) .then(async (resp) => await resp.json()) .then((data) => { @@ -314,7 +308,7 @@ updateLobbyMessage(data.response.lobbyMessage); - return pollGuestStatus(token, attempt + 1, limit, everyMs); + return pollGuestStatus(token, everyMs); }); }, everyMs); }; From 21e79373f684e509dd026ce69ba7facd819ff4f5 Mon Sep 17 00:00:00 2001 From: Guilherme Leme Date: Fri, 28 Jan 2022 11:16:55 -0300 Subject: [PATCH 03/37] Refactored record-and-playback's deploy script to work properly --- record-and-playback/deploy.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/record-and-playback/deploy.sh b/record-and-playback/deploy.sh index a29d8c9d1a..b04b3d0d2a 100755 --- a/record-and-playback/deploy.sh +++ b/record-and-playback/deploy.sh @@ -24,7 +24,9 @@ sudo rm -rf /usr/local/bigbluebutton/core/lib sudo cp -r core/lib /usr/local/bigbluebutton/core/ sudo rm -rf /usr/local/bigbluebutton/core/scripts sudo cp -r core/scripts /usr/local/bigbluebutton/core/ -sudo rm -rf /var/bigbluebutton/playback/* +sudo rm -rf /var/bigbluebutton/playback/presentation/0.81/ +sudo rm -rf /var/bigbluebutton/playback/presentation/0.9.0/ +sudo rm -rf /var/bigbluebutton/playback/presentation/2.0/ function deploy_format() { local formats=$1 @@ -95,10 +97,10 @@ if [ ! -d "$REC_STATUS_SANITY_DIR" ]; then sudo mkdir -p $REC_STATUS_SANITY_DIR fi -sudo mv /usr/local/bigbluebutton/core/scripts/*.nginx /etc/bigbluebutton/nginx/ -sudo service nginx reload +#sudo mv /usr/local/bigbluebutton/core/scripts/*.nginx /etc/bigbluebutton/nginx/ +#sudo service nginx reload sudo chown -R bigbluebutton:bigbluebutton /var/bigbluebutton/ /var/log/bigbluebutton/ -sudo chown -R red5:red5 /var/bigbluebutton/screenshare/ +#sudo chown -R red5:red5 /var/bigbluebutton/screenshare/ #cd /usr/local/bigbluebutton/core/ -#sudo bundle install \ No newline at end of file +#sudo bundle install From 88277f587b7fb07708f657405af7014a6232f880 Mon Sep 17 00:00:00 2001 From: Anton Date: Thu, 3 Feb 2022 17:07:25 -0300 Subject: [PATCH 04/37] move lock viewers tests --- .../playwright/user/user.spec.js | 114 +++++++++--------- 1 file changed, 57 insertions(+), 57 deletions(-) diff --git a/bigbluebutton-tests/playwright/user/user.spec.js b/bigbluebutton-tests/playwright/user/user.spec.js index a3a1ce89d5..781af0e653 100644 --- a/bigbluebutton-tests/playwright/user/user.spec.js +++ b/bigbluebutton-tests/playwright/user/user.spec.js @@ -52,6 +52,63 @@ 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.describe.parallel('Mobile devices', () => { @@ -94,61 +151,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(); - }); - }); }); From 19070895ee30ef61a7032029959a1842aab93c77 Mon Sep 17 00:00:00 2001 From: Anton Date: Thu, 3 Feb 2022 17:10:26 -0300 Subject: [PATCH 05/37] fix guest policy tests --- .../playwright/user/guestPolicy.js | 16 +++++++--------- bigbluebutton-tests/playwright/user/util.js | 7 +++++++ 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/bigbluebutton-tests/playwright/user/guestPolicy.js b/bigbluebutton-tests/playwright/user/guestPolicy.js index cac1864311..eec862035f 100644 --- a/bigbluebutton-tests/playwright/user/guestPolicy.js +++ b/bigbluebutton-tests/playwright/user/guestPolicy.js @@ -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); diff --git a/bigbluebutton-tests/playwright/user/util.js b/bigbluebutton-tests/playwright/user/util.js index 1602facb51..ce7f24c72e 100644 --- a/bigbluebutton-tests/playwright/user/util.js +++ b/bigbluebutton-tests/playwright/user/util.js @@ -11,5 +11,12 @@ 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); +} + exports.setStatus = setStatus; exports.openLockViewers = openLockViewers; +exports.setGuestPolicyOption = setGuestPolicyOption; From 8aa473ca787662ec386961b3d9d8a34a4729b60c Mon Sep 17 00:00:00 2001 From: Anton Date: Fri, 4 Feb 2022 11:13:42 -0300 Subject: [PATCH 06/37] add select random user and fix data-test prop in list items --- .../actions-dropdown/component.jsx | 1 + .../imports/ui/components/menu/component.jsx | 2 +- .../modal/random-user/component.jsx | 7 ++-- .../user-dropdown/component.jsx | 2 ++ .../playwright/core/elements.js | 6 +++- .../playwright/user/lockViewers.js | 2 ++ .../playwright/user/multiusers.js | 33 +++++++++++++++++++ .../playwright/user/user.spec.js | 6 ++++ 8 files changed, 55 insertions(+), 4 deletions(-) diff --git a/bigbluebutton-html5/imports/ui/components/actions-bar/actions-dropdown/component.jsx b/bigbluebutton-html5/imports/ui/components/actions-bar/actions-dropdown/component.jsx index a3f19c4c3a..ca91793181 100755 --- a/bigbluebutton-html5/imports/ui/components/actions-bar/actions-dropdown/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/actions-bar/actions-dropdown/component.jsx @@ -199,6 +199,7 @@ class ActionsDropdown extends PureComponent { label: intl.formatMessage(intlMessages.selectRandUserLabel), key: this.selectUserRandId, onClick: () => mountModal(), + dataTest: "selectRandomUser", }) } diff --git a/bigbluebutton-html5/imports/ui/components/menu/component.jsx b/bigbluebutton-html5/imports/ui/components/menu/component.jsx index c74566a697..5004959191 100644 --- a/bigbluebutton-html5/imports/ui/components/menu/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/menu/component.jsx @@ -69,7 +69,7 @@ class BBBMenu extends React.Component { a.dividerTop && , {intl.formatMessage(messages.randUserTitle)} -
{intl.formatMessage(messages.noViewers)}
+
+ {intl.formatMessage(messages.noViewers)} +
); } else { // viewers are available @@ -164,7 +166,7 @@ class RandomUserSelect extends Component {
{selectedUser.name.slice(0, 2)}
-
+
{selectedUser.name}
{currentUser.presenter @@ -176,6 +178,7 @@ class RandomUserSelect extends Component { size="md" className={styles.selectBtn} onClick={() => this.reselect()} + data-test="selectAgainRadomUser" /> )}
diff --git a/bigbluebutton-html5/imports/ui/components/user-list/user-list-content/user-participants/user-list-item/user-dropdown/component.jsx b/bigbluebutton-html5/imports/ui/components/user-list/user-list-content/user-participants/user-list-item/user-dropdown/component.jsx index 4b71d8599f..59ca24d6d2 100755 --- a/bigbluebutton-html5/imports/ui/components/user-list/user-list-content/user-participants/user-list-item/user-dropdown/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/user-list/user-list-content/user-participants/user-list-item/user-dropdown/component.jsx @@ -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' }); } diff --git a/bigbluebutton-tests/playwright/core/elements.js b/bigbluebutton-tests/playwright/core/elements.js index 55cae35cca..2b89091d9e 100644 --- a/bigbluebutton-tests/playwright/core/elements.js +++ b/bigbluebutton-tests/playwright/core/elements.js @@ -186,7 +186,7 @@ exports.languageSelector = 'select[id="langSelector"]'; exports.userAvatar = 'div[data-test="userAvatar"]'; 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"]'; @@ -213,6 +213,10 @@ 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"]'; // Lock Viewers exports.lockViewersButton = 'li[data-test="lockViewersButton"]'; exports.unlockUserButton = 'li[data-test="unlockUserButton"]'; diff --git a/bigbluebutton-tests/playwright/user/lockViewers.js b/bigbluebutton-tests/playwright/user/lockViewers.js index 79802f55ea..49f31d84c1 100644 --- a/bigbluebutton-tests/playwright/user/lockViewers.js +++ b/bigbluebutton-tests/playwright/user/lockViewers.js @@ -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), diff --git a/bigbluebutton-tests/playwright/user/multiusers.js b/bigbluebutton-tests/playwright/user/multiusers.js index 5c18a38050..6184ab66ca 100644 --- a/bigbluebutton-tests/playwright/user/multiusers.js +++ b/bigbluebutton-tests/playwright/user/multiusers.js @@ -2,6 +2,7 @@ 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'); class MultiUsers { constructor(browser, context) { @@ -78,6 +79,38 @@ class MultiUsers { await this.userPage.hasElement(e.raiseHandBtn); } + 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); diff --git a/bigbluebutton-tests/playwright/user/user.spec.js b/bigbluebutton-tests/playwright/user/user.spec.js index 781af0e653..540d66db62 100644 --- a/bigbluebutton-tests/playwright/user/user.spec.js +++ b/bigbluebutton-tests/playwright/user/user.spec.js @@ -109,6 +109,12 @@ test.describe.parallel('User', () => { 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', () => { From a0dd5552aaf4fbeb0bce156618aca14b59e85377 Mon Sep 17 00:00:00 2001 From: Anton Date: Fri, 4 Feb 2022 16:26:35 -0300 Subject: [PATCH 07/37] add close private chat test --- .../imports/ui/components/chat/component.jsx | 1 + .../playwright/chat/chat.spec.js | 6 +++++ .../playwright/chat/privateChat.js | 26 ++++++++++++++----- .../playwright/core/elements.js | 1 + bigbluebutton-tests/playwright/core/page.js | 14 +++++++++- .../playwright/notifications/util.js | 8 +----- .../playwright/polling/poll.js | 8 +++--- .../playwright/user/lockViewers.js | 8 +++--- 8 files changed, 48 insertions(+), 24 deletions(-) diff --git a/bigbluebutton-html5/imports/ui/components/chat/component.jsx b/bigbluebutton-html5/imports/ui/components/chat/component.jsx index 2f3b60a714..a562f516c5 100755 --- a/bigbluebutton-html5/imports/ui/components/chat/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/chat/component.jsx @@ -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" /> ) : ( diff --git a/bigbluebutton-tests/playwright/chat/chat.spec.js b/bigbluebutton-tests/playwright/chat/chat.spec.js index 5c4ee0a371..8ffb84b491 100644 --- a/bigbluebutton-tests/playwright/chat/chat.spec.js +++ b/bigbluebutton-tests/playwright/chat/chat.spec.js @@ -46,4 +46,10 @@ 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(); + }); }); diff --git a/bigbluebutton-tests/playwright/chat/privateChat.js b/bigbluebutton-tests/playwright/chat/privateChat.js index 50144309b8..1ba0047b9a 100644 --- a/bigbluebutton-tests/playwright/chat/privateChat.js +++ b/bigbluebutton-tests/playwright/chat/privateChat.js @@ -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,23 @@ 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); + } } exports.PrivateChat = PrivateChat; diff --git a/bigbluebutton-tests/playwright/core/elements.js b/bigbluebutton-tests/playwright/core/elements.js index 2b89091d9e..206baf66f7 100644 --- a/bigbluebutton-tests/playwright/core/elements.js +++ b/bigbluebutton-tests/playwright/core/elements.js @@ -58,6 +58,7 @@ exports.startPrivateChat = 'li[data-test="startPrivateChat"]'; exports.publicChat = 'div[data-test="publicChat"]'; exports.privateChat = 'div[data-test="privateChat"]'; 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"]'; diff --git a/bigbluebutton-tests/playwright/core/page.js b/bigbluebutton-tests/playwright/core/page.js index 85ae9c1349..b2c5fa7d87 100644 --- a/bigbluebutton-tests/playwright/core/page.js +++ b/bigbluebutton-tests/playwright/core/page.js @@ -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(); diff --git a/bigbluebutton-tests/playwright/notifications/util.js b/bigbluebutton-tests/playwright/notifications/util.js index 695aa2637e..454d2c4eb1 100644 --- a/bigbluebutton-tests/playwright/notifications/util.js +++ b/bigbluebutton-tests/playwright/notifications/util.js @@ -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); diff --git a/bigbluebutton-tests/playwright/polling/poll.js b/bigbluebutton-tests/playwright/polling/poll.js index 0a82a8b50f..435b62da97 100644 --- a/bigbluebutton-tests/playwright/polling/poll.js +++ b/bigbluebutton-tests/playwright/polling/poll.js @@ -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); } } diff --git a/bigbluebutton-tests/playwright/user/lockViewers.js b/bigbluebutton-tests/playwright/user/lockViewers.js index 49f31d84c1..1f0b337da4 100644 --- a/bigbluebutton-tests/playwright/user/lockViewers.js +++ b/bigbluebutton-tests/playwright/user/lockViewers.js @@ -71,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); @@ -117,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); From 61e25770c94a4e86ae47fc5bae88caebac88bd15 Mon Sep 17 00:00:00 2001 From: Anton Date: Mon, 7 Feb 2022 15:01:47 -0300 Subject: [PATCH 08/37] add promote and demote user tests --- .../ui/components/user-avatar/component.jsx | 2 +- .../user-dropdown/component.jsx | 4 ++- .../playwright/core/elements.js | 4 +++ .../playwright/user/multiusers.js | 34 ++++++++++++++++++- .../playwright/user/user.spec.js | 13 +++++++ bigbluebutton-tests/playwright/user/util.js | 5 +++ 6 files changed, 59 insertions(+), 3 deletions(-) diff --git a/bigbluebutton-html5/imports/ui/components/user-avatar/component.jsx b/bigbluebutton-html5/imports/ui/components/user-avatar/component.jsx index 48eecc04f6..dcf3a55bd4 100755 --- a/bigbluebutton-html5/imports/ui/components/user-avatar/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/user-avatar/component.jsx @@ -51,7 +51,7 @@ const UserAvatar = ({