From 347a37e868912b69790bde600e55466e13793d86 Mon Sep 17 00:00:00 2001 From: Ricardo Garim Date: Wed, 28 Aug 2024 16:44:50 -0300 Subject: [PATCH 1/3] chore: remove notifyListener call that was causing startup issues (#33154) --- apps/meteor/server/startup/cloudRegistration.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/apps/meteor/server/startup/cloudRegistration.ts b/apps/meteor/server/startup/cloudRegistration.ts index 65d870de4d89..e69d4446d6ec 100644 --- a/apps/meteor/server/startup/cloudRegistration.ts +++ b/apps/meteor/server/startup/cloudRegistration.ts @@ -1,7 +1,5 @@ import { Settings } from '@rocket.chat/models'; -import { notifyOnSettingChangedById } from '../../app/lib/server/lib/notifyListener'; - export async function ensureCloudWorkspaceRegistered(): Promise { const cloudWorkspaceClientId = await Settings.getValueById('Cloud_Workspace_Client_Id'); const cloudWorkspaceClientSecret = await Settings.getValueById('Cloud_Workspace_Client_Secret'); @@ -18,6 +16,5 @@ export async function ensureCloudWorkspaceRegistered(): Promise { } // otherwise, set the setup wizard to in_progress forcing admins to complete the registration - (await Settings.updateValueById('Show_Setup_Wizard', 'in_progress')).modifiedCount && - void notifyOnSettingChangedById('Show_Setup_Wizard'); + await Settings.updateValueById('Show_Setup_Wizard', 'in_progress'); } From 6a27d7b28723334170946ef282a291a4626a1424 Mon Sep 17 00:00:00 2001 From: csuadev <72958726+csuadev@users.noreply.github.com> Date: Thu, 29 Aug 2024 16:21:38 +0200 Subject: [PATCH 2/3] test: Add unit test for RoomMenu options (#32891) Co-authored-by: Douglas Fabris <27704687+dougfabris@users.noreply.github.com> --- apps/meteor/client/sidebar/RoomMenu.spec.tsx | 67 ++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 apps/meteor/client/sidebar/RoomMenu.spec.tsx diff --git a/apps/meteor/client/sidebar/RoomMenu.spec.tsx b/apps/meteor/client/sidebar/RoomMenu.spec.tsx new file mode 100644 index 000000000000..e12063c9cdb0 --- /dev/null +++ b/apps/meteor/client/sidebar/RoomMenu.spec.tsx @@ -0,0 +1,67 @@ +import type { RoomType } from '@rocket.chat/core-typings'; +import { mockAppRoot } from '@rocket.chat/mock-providers'; +import { render, screen } from '@testing-library/react'; +import '@testing-library/jest-dom'; +import userEvent from '@testing-library/user-event'; +import React from 'react'; + +import RoomMenu from './RoomMenu'; + +jest.mock('../../client/lib/rooms/roomCoordinator', () => ({ + roomCoordinator: { + getRoomDirectives: () => ({ + getUiText: () => 'leaveWarning', + }), + }, +})); + +jest.mock('../../app/ui-utils/client', () => ({ + LegacyRoomManager: { + close: jest.fn(), + }, +})); + +const defaultProps = { + rid: 'roomId', + type: 'c' as RoomType, + hideDefaultOptions: false, + placement: 'right-start', +}; + +const renderOptions = { + wrapper: mockAppRoot() + .withTranslations('en', 'core', { + Hide: 'Hide', + Mark_unread: 'Mark Unread', + Favorite: 'Favorite', + Leave_room: 'Leave', + }) + .withSetting('Favorite_Rooms', true) + .withPermission('leave-c') + .withPermission('leave-p') + .build(), + legacyRoot: true, +}; + +it('should display all the menu options for regular rooms', async () => { + render(, renderOptions); + + const menu = screen.queryByRole('button'); + await userEvent.click(menu as HTMLElement); + + expect(await screen.findByRole('option', { name: 'Hide' })).toBeInTheDocument(); + expect(await screen.findByRole('option', { name: 'Favorite' })).toBeInTheDocument(); + expect(await screen.findByRole('option', { name: 'Mark Unread' })).toBeInTheDocument(); + expect(await screen.findByRole('option', { name: 'Leave' })).toBeInTheDocument(); +}); + +it('should display only mark unread and favorite for omnichannel rooms', async () => { + render(, renderOptions); + + const menu = screen.queryByRole('button'); + await userEvent.click(menu as HTMLElement); + + expect(await screen.findAllByRole('option')).toHaveLength(2); + expect(screen.queryByRole('option', { name: 'Hide' })).not.toBeInTheDocument(); + expect(screen.queryByRole('option', { name: 'Leave' })).not.toBeInTheDocument(); +}); From bb7d7212558e4ac8aec3be9181c7e57613338a3e Mon Sep 17 00:00:00 2001 From: Martin Schoeler Date: Thu, 29 Aug 2024 14:49:17 -0300 Subject: [PATCH 3/3] fix: restore tooltips to units Multiselect (#33174) Co-authored-by: Douglas Fabris <27704687+dougfabris@users.noreply.github.com> --- .changeset/strong-rings-rush.md | 5 +++++ apps/meteor/client/omnichannel/units/UnitEdit.tsx | 2 +- .../meteor/tests/e2e/omnichannel/omnichannel-units.spec.ts | 7 +++++-- apps/meteor/tests/e2e/page-objects/omnichannel-units.ts | 4 ++++ packages/ui-client/src/components/TooltipComponent.tsx | 2 +- 5 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 .changeset/strong-rings-rush.md diff --git a/.changeset/strong-rings-rush.md b/.changeset/strong-rings-rush.md new file mode 100644 index 000000000000..5125f47dcb3b --- /dev/null +++ b/.changeset/strong-rings-rush.md @@ -0,0 +1,5 @@ +--- +"@rocket.chat/meteor": patch +--- + +Restored tooltips to the unit edit department field selected options diff --git a/apps/meteor/client/omnichannel/units/UnitEdit.tsx b/apps/meteor/client/omnichannel/units/UnitEdit.tsx index e4bc1c0efb50..e71e8e2a94d0 100644 --- a/apps/meteor/client/omnichannel/units/UnitEdit.tsx +++ b/apps/meteor/client/omnichannel/units/UnitEdit.tsx @@ -228,7 +228,7 @@ const UnitEdit = ({ unitData, unitMonitors, unitDepartments }: UnitEditProps) => value={value} onChange={onChange} onBlur={onBlur} - withTitle={false} + withTitle filter={departmentsFilter} setFilter={setDepartmentsFilter} options={departmentsOptions} diff --git a/apps/meteor/tests/e2e/omnichannel/omnichannel-units.spec.ts b/apps/meteor/tests/e2e/omnichannel/omnichannel-units.spec.ts index 9c1b5fdd5948..cd33a56caa04 100644 --- a/apps/meteor/tests/e2e/omnichannel/omnichannel-units.spec.ts +++ b/apps/meteor/tests/e2e/omnichannel/omnichannel-units.spec.ts @@ -185,11 +185,14 @@ test.describe('OC - Manage Units', () => { await poOmnichannelUnits.btnSave.click(); }); - await test.step('expect department to be in the chosen departments list', async () => { + await test.step('expect department to be in the chosen departments list and have title', async () => { await poOmnichannelUnits.search(unit.name); await poOmnichannelUnits.findRowByName(unit.name).click(); await expect(poOmnichannelUnits.contextualBar).toBeVisible(); - await expect(page.getByRole('option', { name: department2.data.name })).toBeVisible(); + await expect(poOmnichannelUnits.selectOptionChip(department2.data.name)).toBeVisible(); + await poOmnichannelUnits.selectOptionChip(department2.data.name).hover(); + + await expect(page.getByRole('tooltip', { name: department2.data.name })).toBeVisible(); await poOmnichannelUnits.btnContextualbarClose.click(); }); diff --git a/apps/meteor/tests/e2e/page-objects/omnichannel-units.ts b/apps/meteor/tests/e2e/page-objects/omnichannel-units.ts index abcd794f8efa..2d0e24073a45 100644 --- a/apps/meteor/tests/e2e/page-objects/omnichannel-units.ts +++ b/apps/meteor/tests/e2e/page-objects/omnichannel-units.ts @@ -43,6 +43,10 @@ export class OmnichannelUnits extends OmnichannelAdministration { return this.page.locator(`[role=option][value="${name}"]`); } + public selectOptionChip(name: string) { + return this.page.getByRole('option', { name }); + } + async selectDepartment({ name, _id }: { name: string; _id: string }) { await this.inputDepartments.click(); await this.inputDepartments.fill(name); diff --git a/packages/ui-client/src/components/TooltipComponent.tsx b/packages/ui-client/src/components/TooltipComponent.tsx index 137ec913ec78..4a46e5536a53 100644 --- a/packages/ui-client/src/components/TooltipComponent.tsx +++ b/packages/ui-client/src/components/TooltipComponent.tsx @@ -12,7 +12,7 @@ export const TooltipComponent = ({ title, anchor }: TooltipComponentProps): Reac return ( - {title} + {title} ); };