Skip to content

Commit

Permalink
Merge branch 'develop' into feat/update-contact-endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
tapiarafael authored Aug 29, 2024
2 parents 67f25b3 + bb7d721 commit 559340c
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/strong-rings-rush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Restored tooltips to the unit edit department field selected options
2 changes: 1 addition & 1 deletion apps/meteor/client/omnichannel/units/UnitEdit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
67 changes: 67 additions & 0 deletions apps/meteor/client/sidebar/RoomMenu.spec.tsx
Original file line number Diff line number Diff line change
@@ -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(<RoomMenu {...defaultProps} />, 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(<RoomMenu {...defaultProps} type='l' />, 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();
});
5 changes: 1 addition & 4 deletions apps/meteor/server/startup/cloudRegistration.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { Settings } from '@rocket.chat/models';

import { notifyOnSettingChangedById } from '../../app/lib/server/lib/notifyListener';

export async function ensureCloudWorkspaceRegistered(): Promise<void> {
const cloudWorkspaceClientId = await Settings.getValueById('Cloud_Workspace_Client_Id');
const cloudWorkspaceClientSecret = await Settings.getValueById('Cloud_Workspace_Client_Secret');
Expand All @@ -18,6 +16,5 @@ export async function ensureCloudWorkspaceRegistered(): Promise<void> {
}

// 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');
}
7 changes: 5 additions & 2 deletions apps/meteor/tests/e2e/omnichannel/omnichannel-units.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});

Expand Down
4 changes: 4 additions & 0 deletions apps/meteor/tests/e2e/page-objects/omnichannel-units.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion packages/ui-client/src/components/TooltipComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const TooltipComponent = ({ title, anchor }: TooltipComponentProps): Reac

return (
<PositionAnimated anchor={ref} placement='top-middle' margin={8} visible={AnimatedVisibility.UNHIDING}>
<Tooltip>{title}</Tooltip>
<Tooltip role='tooltip'>{title}</Tooltip>
</PositionAnimated>
);
};

0 comments on commit 559340c

Please sign in to comment.