Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
test(reactions): add E2E test suite for toolbar reactions and emojis (#17992)
Aarav Anandff51a3a996aa
diff --git a/tests/pageobjects/Toolbar.ts b/tests/pageobjects/Toolbar.tsindex 7e8633f1e1..c267480fdb 100644--- a/tests/pageobjects/Toolbar.ts+++ b/tests/pageobjects/Toolbar.ts@@ -19,7 +19,19 @@ const CLOSE_OVERFLOW = 'Close more actions menu';const PARTICIPANTS = 'Open participants pane';const PROFILE = 'Edit your profile';const RAISE_HAND = 'Raise your hand';+const LOWER_HAND = 'Lower your hand';+const REACTIONS_MENU = 'Reactions menu';const SECURITY = 'Security options';++const REACTION_LABELS: Record<string, string> = {+ boo: 'Boo',+ clap: 'Clap',+ laugh: 'Laugh',+ like: 'Thumbs Up',+ love: 'Heart',+ silence: 'Silence',+ surprised: 'Surprised'+};const SETTINGS = 'Open settings';const STOP_DESKTOP = 'Stop sharing your screen';const ENTER_TILE_VIEW_BUTTON = 'Enter tile view';@@ -236,6 +248,116 @@ export default class Toolbar extends BasePageObject {return this.getButton(RAISE_HAND).click();}+ /**+ * Clicks on the lower hand button that lowers participant's raised hand.+ */+ async clickLowerHandButton(): Promise<void> {+ await this.participant.log('Clicking on: Lower hand Button');++ return this.getButton(LOWER_HAND).click();+ }++ /**+ * Wakes the auto-hidden toolbar by hovering the local or large video container.+ * @private+ */+ private async wakeToolbar(): Promise<void> {+ const localVideoContainer = this.participant.driver.$('span[id="localVideoContainer"]');++ if (await localVideoContainer.isExisting()) {+ await localVideoContainer.moveTo();+ } else {+ await this.participant.driver.$('#largeVideoContainer').moveTo();+ }+ }++ /**+ * Returns whether the reactions menu is open and displayed.+ *+ * @returns {Promise<boolean>}+ */+ async isReactionsMenuOpen(): Promise<boolean> {+ return this.participant.driver.$('.reactions-menu-container .reactions-menu').isDisplayed();+ }++ /**+ * Returns the reaction button element for the given reaction key.+ *+ * @param {string} reaction - The reaction key or accessibility label.+ * @returns {WebdriverIO.Element}+ */+ getReactionButton(reaction: string) {+ const label = REACTION_LABELS[reaction] || reaction;++ return this.participant.driver.$(`.reactions-menu-container .reactions-menu [aria-label="${label}"]`);+ }++ /**+ * Ensures the reactions menu is displayed.+ *+ * @returns {Promise<void>}+ */+ async openReactionsMenu(): Promise<void> {+ if (await this.isReactionsMenuOpen()) {+ return;+ }++ await this.wakeToolbar();++ const trigger = this.getButton(REACTIONS_MENU);++ await trigger.waitForExist({ timeout: 2000 });+ await trigger.moveTo();++ await this.waitForReactionsMenu(true);+ }++ /**+ * Ensures the reactions menu is closed.+ *+ * @returns {Promise<void>}+ */+ async closeReactionsMenu(): Promise<void> {+ if (!await this.isReactionsMenuOpen()) {+ return;+ }++ await this.getButton(REACTIONS_MENU).click();++ await this.waitForReactionsMenu(false);+ }++ /**+ * Waits for the reactions menu to be visible or hidden.+ *+ * @param {boolean} visible - Whether the menu should be visible.+ * @returns {Promise<void>}+ */+ waitForReactionsMenu(visible: boolean) {+ return this.participant.driver.$('.reactions-menu-container .reactions-menu').waitForDisplayed({+ reverse: !visible,+ timeout: 5000,+ timeoutMsg: `Reactions menu is not ${visible ? 'visible' : 'hidden'}`+ });+ }++ /**+ * Clicks a reaction emoji in the reactions menu.+ *+ * @param {string} reaction - The reaction key or accessibility label.+ * @returns {Promise<void>}+ */+ async clickReaction(reaction: string): Promise<void> {+ await this.openReactionsMenu();++ const reactionBtn = this.getReactionButton(reaction);++ await reactionBtn.waitForDisplayed({ timeout: 2000 });+ await reactionBtn.click();++ await this.closeReactionsMenu();+ }+/*** Clicks on the chat button that opens chat panel.*/@@ -402,17 +524,7 @@ export default class Toolbar extends BasePageObject {return;}- // Wake the auto-hidden toolbar by hovering the local video tile; otherwise the overflow- // button click can fire on an invisible element and the menu never appears. When the- // self-view is hidden (e.g. via settings), localVideoContainer is not in the DOM, so fall- // back to the large video container which is always present while in conference.- const localVideoContainer = this.participant.driver.$('span[id="localVideoContainer"]');-- if (await localVideoContainer.isExisting()) {- await localVideoContainer.moveTo();- } else {- await this.participant.driver.$('#largeVideoContainer').moveTo();- }+ await this.wakeToolbar();await this.clickOverflowButton();diff --git a/tests/specs/misc/reactions.spec.ts b/tests/specs/misc/reactions.spec.tsnew file mode 100644index 0000000000..393522e293--- /dev/null+++ b/tests/specs/misc/reactions.spec.ts@@ -0,0 +1,170 @@+import { setTestProperties } from '../../helpers/TestProperties';+import { ensureTwoParticipants } from '../../helpers/participants';++setTestProperties(__filename, {+ usesBrowsers: [ 'p1', 'p2' ]+});++describe('Reactions and emojis', () => {+ it('joining the meeting', async () => {+ await ensureTwoParticipants({+ configOverwrite: {+ raisedHands: {+ disableRemoveRaisedHandOnFocus: true+ }+ }+ });+ });++ it('opens and closes the reactions menu', async () => {+ const { p1 } = ctx;+ const toolbar = p1.getToolbar();++ await toolbar.openReactionsMenu();+ expect(await toolbar.isReactionsMenuOpen()).toBe(true);++ const likeButton = toolbar.getReactionButton('like');+ const clapButton = toolbar.getReactionButton('clap');+ const laughButton = toolbar.getReactionButton('laugh');+ const loveButton = toolbar.getReactionButton('love');++ await likeButton.waitForDisplayed({ timeout: 2000 });+ await clapButton.waitForDisplayed({ timeout: 2000 });+ await laughButton.waitForDisplayed({ timeout: 2000 });+ await loveButton.waitForDisplayed({ timeout: 2000 });++ await toolbar.closeReactionsMenu();+ expect(await toolbar.isReactionsMenuOpen()).toBe(false);+ });++ it('sends reaction emoji from p1 and receives on p2', async () => {+ const { p1, p2 } = ctx;++ await p1.getToolbar().clickReaction('like');++ await p1.driver.waitUntil(+ async () => await p1.execute(() => {+ const buffer = APP?.store?.getState()['features/reactions']?.buffer;+ const queue = APP?.store?.getState()['features/reactions']?.queue;++ return buffer?.includes('like') || queue?.some((r: { reaction: string; }) => r.reaction === 'like');+ }),+ {+ timeout: 3000,+ timeoutMsg: 'Reaction "like" was not added to buffer or queue on p1'+ }+ );++ await p2.driver.waitUntil(+ async () => await p2.execute(() => {+ const queue = APP?.store?.getState()['features/reactions']?.queue;++ return queue?.some((r: { reaction: string; }) => r.reaction === 'like');+ }),+ {+ timeout: 5000,+ timeoutMsg: 'Remote participant p2 did not receive "like" reaction in queue'+ }+ );++ const p1LikeEmoji = p1.driver.$('//div[contains(@class, "reaction-emoji") and contains(text(), "π")]');++ await p1LikeEmoji.waitForExist({+ timeout: 5000,+ timeoutMsg: 'Local participant p1 did not display reaction animation'+ });++ const p2LikeEmoji = p2.driver.$('//div[contains(@class, "reaction-emoji") and contains(text(), "π")]');++ await p2LikeEmoji.waitForExist({+ timeout: 5000,+ timeoutMsg: 'Remote participant p2 did not display reaction animation'+ });+ });++ it('sends reaction emoji from p2 and receives on p1', async () => {+ const { p1, p2 } = ctx;++ await p2.getToolbar().clickReaction('clap');++ await p1.driver.waitUntil(+ async () => await p1.execute(() => {+ const queue = APP?.store?.getState()['features/reactions']?.queue;++ return queue?.some((r: { reaction: string; }) => r.reaction === 'clap');+ }),+ {+ timeout: 5000,+ timeoutMsg: 'Remote participant p1 did not receive "clap" reaction in queue'+ }+ );++ const p1ClapEmoji = p1.driver.$('//div[contains(@class, "reaction-emoji") and contains(text(), "π")]');++ await p1ClapEmoji.waitForExist({+ timeout: 5000,+ timeoutMsg: 'Remote participant p1 did not display "clap" reaction animation'+ });+ });++ it('raises and lowers hand', async () => {+ const { p1, p2 } = ctx;+ const p1EndpointId = await p1.getEndpointId();++ await p1.getToolbar().clickRaiseHandButton();++ await p1.driver.waitUntil(+ async () => await p1.execute(+ () => Boolean(APP?.store?.getState()['features/base/participants']?.local?.raisedHandTimestamp)+ ),+ {+ timeout: 5000,+ timeoutMsg: 'Local participant p1 did not set raisedHandTimestamp'+ }+ );++ await p2.driver.waitUntil(+ async () => await p2.execute(+ endpointId => {+ const remoteParticipant = APP?.store?.getState()['features/base/participants']?.remote?.get(endpointId);++ return Boolean(remoteParticipant?.raisedHandTimestamp);+ },+ p1EndpointId+ ),+ {+ timeout: 5000,+ timeoutMsg: 'Remote participant p2 did not reflect p1 raised hand in Redux state'+ }+ );++ await p2.getNotifications().waitForRaisedHandNotification();++ await p1.getToolbar().clickLowerHandButton();++ await p1.driver.waitUntil(+ async () => await p1.execute(+ () => !Boolean(APP?.store?.getState()['features/base/participants']?.local?.raisedHandTimestamp)+ ),+ {+ timeout: 5000,+ timeoutMsg: 'Local participant p1 did not lower hand'+ }+ );++ await p2.driver.waitUntil(+ async () => await p2.execute(+ endpointId => {+ const remoteParticipant = APP?.store?.getState()['features/base/participants']?.remote?.get(endpointId);++ return !Boolean(remoteParticipant?.raisedHandTimestamp);+ },+ p1EndpointId+ ),+ {+ timeout: 5000,+ timeoutMsg: 'Remote participant p2 did not reflect p1 lowered hand in Redux state'+ }+ );+ });+});