Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions apps/meteor/client/components/UserInfo/UserInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
} from '@rocket.chat/ui-client';
import type { TranslationKey } from '@rocket.chat/ui-contexts';
import type { ReactElement, ReactNode } from 'react';
import { memo } from 'react';
import { memo, useId } from 'react';
import { useTranslation } from 'react-i18next';

import { useTimeAgo } from '../../hooks/useTimeAgo';
Expand Down Expand Up @@ -84,6 +84,8 @@ const UserInfo = ({
const userDisplayName = useUserDisplayName({ name, username });
const userCustomFields = useUserCustomFields(customFields);

const usernameId = useId();

return (
<ContextualbarScrollableContent p={24} {...props}>
<InfoPanel>
Expand Down Expand Up @@ -129,8 +131,12 @@ const UserInfo = ({

{username && username !== name && (
<InfoPanelField>
<InfoPanelLabel>{t('Username')}</InfoPanelLabel>
<InfoPanelText data-qa='UserInfoUserName'>{username}</InfoPanelText>
<InfoPanelLabel is='dt' id={usernameId}>
{t('Username')}
</InfoPanelLabel>
<InfoPanelText is='dd' aria-labelledby={usernameId}>
{username}
</InfoPanelText>
</InfoPanelField>
)}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ type AddExistingModalProps = {
reload?: () => void;
};

// TODO: Use GenericModal instead of Modal
const AddExistingModal = ({ teamId, onClose, reload }: AddExistingModalProps) => {
const { t } = useTranslation();
const dispatchToastMessage = useToastMessageDispatch();
Expand Down Expand Up @@ -61,7 +62,10 @@ const AddExistingModal = ({ teamId, onClose, reload }: AddExistingModalProps) =>
);

return (
<Modal wrapperFunction={(props) => <Box is='form' onSubmit={handleSubmit(handleAddChannels)} {...props} />}>
<Modal
aria-label={t('Team_Add_existing_channels')}
wrapperFunction={(props) => <Box is='form' onSubmit={handleSubmit(handleAddChannels)} {...props} />}
>
<ModalHeader>
<ModalTitle>{t('Team_Add_existing_channels')}</ModalTitle>
<ModalClose onClick={onClose} />
Expand Down
7 changes: 3 additions & 4 deletions apps/meteor/tests/e2e/account-profile.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@ test.describe.serial('settings-account-profile', () => {
poAccountProfile = new AccountProfile(page);
});

// FIXME: solve test intermitencies
test.describe('Profile', () => {
test.beforeEach(async ({ page }) => {
await page.goto('/account/profile');
});

test.skip('expect update profile with new name/username', async () => {
test('expect update profile with new name/username', async () => {
const newName = faker.person.fullName();
const newUsername = faker.internet.userName({ firstName: newName });

Expand All @@ -37,9 +36,9 @@ test.describe.serial('settings-account-profile', () => {
await expect(poHomeChannel.content.lastUserMessageNotSequential).toContainText(newUsername);

await poHomeChannel.content.lastUserMessageNotSequential.locator('figure').click();
await poHomeChannel.content.linkUserCard.click();
await poHomeChannel.userCard.openUserInfo();

await expect(poHomeChannel.tabs.userInfoUsername).toHaveText(newUsername);
await expect(poHomeChannel.tabs.userInfo.userName).toHaveText(newUsername);
});

test.describe('Avatar', () => {
Expand Down
2 changes: 1 addition & 1 deletion apps/meteor/tests/e2e/avatar-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ test.describe('avatar-settings', () => {

test('expect user card avatar to have provider prefix', async () => {
await poHomeChannel.content.lastUserMessage.locator('.rcx-message-header__name-container').click();
expect(poHomeChannel.content.userCard.locator('img').getAttribute('src')).toBe(avatarUrl);
expect(poHomeChannel.userCard.imgUserCard.getAttribute('src')).toBe(avatarUrl);
});
});
});
Expand Down
16 changes: 8 additions & 8 deletions apps/meteor/tests/e2e/channel-management.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ test.describe.serial('channel-management', () => {
await poHomeChannel.navbar.openChat(targetChannel);
await poHomeChannel.roomToolbar.openRoomInfo();
await poHomeChannel.tabs.room.btnEdit.click();
await poHomeChannel.tabs.room.inputTopic.fill('hello-topic-edited');
await poHomeChannel.tabs.room.btnSave.click();
await poHomeChannel.tabs.editRoom.inputTopic.fill('hello-topic-edited');
await poHomeChannel.tabs.editRoom.btnSave.click();

await poHomeChannel.toastMessage.dismissToast();
await poHomeChannel.roomToolbar.openRoomInfo();
Expand All @@ -75,8 +75,8 @@ test.describe.serial('channel-management', () => {
await poHomeChannel.navbar.openChat(targetChannel);
await poHomeChannel.roomToolbar.openRoomInfo();
await poHomeChannel.tabs.room.btnEdit.click();
await poHomeChannel.tabs.room.inputAnnouncement.fill('hello-announcement-edited');
await poHomeChannel.tabs.room.btnSave.click();
await poHomeChannel.tabs.editRoom.inputAnnouncement.fill('hello-announcement-edited');
await poHomeChannel.tabs.editRoom.btnSave.click();

await poHomeChannel.toastMessage.dismissToast();
await poHomeChannel.roomToolbar.openRoomInfo();
Expand All @@ -88,8 +88,8 @@ test.describe.serial('channel-management', () => {
await poHomeChannel.navbar.openChat(targetChannel);
await poHomeChannel.roomToolbar.openRoomInfo();
await poHomeChannel.tabs.room.btnEdit.click();
await poHomeChannel.tabs.room.inputDescription.fill('hello-description-edited');
await poHomeChannel.tabs.room.btnSave.click();
await poHomeChannel.tabs.editRoom.inputDescription.fill('hello-description-edited');
await poHomeChannel.tabs.editRoom.btnSave.click();

await poHomeChannel.toastMessage.dismissToast();
await poHomeChannel.roomToolbar.openRoomInfo();
Expand Down Expand Up @@ -165,8 +165,8 @@ test.describe.serial('channel-management', () => {

test('should edit notification preferences of targetChannel', async () => {
await poHomeChannel.navbar.openChat(targetChannel);
await poHomeChannel.tabs.kebab.click({ force: true });
await poHomeChannel.tabs.btnNotificationPreferences.click({ force: true });
await poHomeChannel.roomToolbar.openMoreOptions();
await poHomeChannel.roomToolbar.menuItemNotificationsPreferences.click();
await poHomeChannel.tabs.notificationPreferences.updateAllNotificationPreferences();
await poHomeChannel.tabs.notificationPreferences.btnSave.click();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ test.describe('E2EE Encrypted Channels', () => {
await expect(poHomeChannel.content.lastUserMessage.locator('.rcx-icon--name-key')).toBeVisible();
await toastMessages.dismissToast();

await poHomeChannel.tabs.kebab.click({ force: true });
await poHomeChannel.roomToolbar.openMoreOptions();

await expect(poHomeChannel.tabs.btnDisableE2E).toBeVisible();
await poHomeChannel.tabs.btnDisableE2E.click({ force: true });
await expect(poHomeChannel.roomToolbar.btnDisableE2EEncryption).toBeVisible();
await poHomeChannel.roomToolbar.btnDisableE2EEncryption.click({ force: true });
await expect(page.getByRole('dialog', { name: 'Disable encryption' })).toBeVisible();
await page.getByRole('button', { name: 'Disable encryption' }).click();
await poHomeChannel.toastMessage.dismissToast();
Expand All @@ -65,9 +65,9 @@ test.describe('E2EE Encrypted Channels', () => {
await expect(poHomeChannel.content.lastUserMessageBody).toHaveText('hello world not encrypted');
await expect(poHomeChannel.content.lastUserMessage.locator('.rcx-icon--name-key')).not.toBeVisible();

await poHomeChannel.tabs.kebab.click({ force: true });
await expect(poHomeChannel.tabs.btnEnableE2E).toBeVisible();
await poHomeChannel.tabs.btnEnableE2E.click({ force: true });
await poHomeChannel.roomToolbar.openMoreOptions();
await expect(poHomeChannel.roomToolbar.menuItemEnableE2EEncryption).toBeVisible();
await poHomeChannel.roomToolbar.menuItemEnableE2EEncryption.click();
await expect(page.getByRole('dialog', { name: 'Enable encryption' })).toBeVisible();
await page.getByRole('button', { name: 'Enable encryption' }).click();
await poHomeChannel.toastMessage.dismissToast();
Expand Down Expand Up @@ -144,12 +144,12 @@ test.describe('E2EE Encrypted Channels', () => {
await poHomeChannel.toastMessage.waitForDisplay();
await poHomeChannel.toastMessage.dismissToast();

await poHomeChannel.tabs.kebab.click();
await poHomeChannel.roomToolbar.openMoreOptions();
// TODO(@jessicaschelly/@dougfabris): fix this flaky behavior
if (!(await poHomeChannel.tabs.btnEnableE2E.isVisible())) {
await poHomeChannel.tabs.kebab.click();
if (!(await poHomeChannel.roomToolbar.menuItemEnableE2EEncryption.isVisible())) {
await poHomeChannel.roomToolbar.openMoreOptions();
}
await poHomeChannel.tabs.btnEnableE2E.click();
await poHomeChannel.roomToolbar.menuItemEnableE2EEncryption.click();
await expect(page.getByRole('dialog', { name: 'Enable encryption' })).toBeVisible();
await page.getByRole('button', { name: 'Enable encryption' }).click();
await page.waitForTimeout(1000);
Expand Down Expand Up @@ -245,9 +245,9 @@ test.describe('E2EE Encrypted Channels', () => {
await poHomeChannel.content.sendMessage('second unencrypted message');

// Encrypt channel
await poHomeChannel.tabs.kebab.click({ force: true });
await expect(poHomeChannel.tabs.btnEnableE2E).toBeVisible();
await poHomeChannel.tabs.btnEnableE2E.click({ force: true });
await poHomeChannel.roomToolbar.openMoreOptions();
await expect(poHomeChannel.roomToolbar.menuItemEnableE2EEncryption).toBeVisible();
await poHomeChannel.roomToolbar.menuItemEnableE2EEncryption.click();
await expect(page.getByRole('dialog', { name: 'Enable encryption' })).toBeVisible();
await page.getByRole('button', { name: 'Enable encryption' }).click();
await page.waitForTimeout(1000);
Expand Down Expand Up @@ -303,8 +303,8 @@ test.describe('E2EE Encrypted Channels', () => {
await poHomeChannel.toastMessage.waitForDisplay();
await poHomeChannel.toastMessage.dismissToast();

await poHomeChannel.tabs.kebab.click();
await poHomeChannel.tabs.btnPinnedMessagesList.click();
await poHomeChannel.roomToolbar.openMoreOptions();
await poHomeChannel.roomToolbar.menuItemPinnedMessages.click();

await expect(page.getByRole('dialog', { name: 'Pinned Messages' })).toBeVisible();

Expand All @@ -316,9 +316,8 @@ test.describe('E2EE Encrypted Channels', () => {
await expect(page.locator('role=menuitem[name="Copy link"]')).toHaveClass(/disabled/);

await poHomeChannel.btnContextualbarClose.click();

await poHomeChannel.tabs.kebab.click();
await poHomeChannel.tabs.btnStarredMessageList.click();
await poHomeChannel.roomToolbar.openMoreOptions();
await poHomeChannel.roomToolbar.menuItemStarredMessages.click();

const lastStarredMessage = page.getByRole('dialog', { name: 'Starred Messages' }).locator('[data-qa-type="message"]').last();
await expect(page.getByRole('dialog', { name: 'Starred Messages' })).toBeVisible();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { faker } from '@faker-js/faker';
import { Users } from '../fixtures/userStates';
import { EncryptedRoomPage } from '../page-objects/encrypted-room';
import { Navbar } from '../page-objects/fragments';
import { ExportMessagesTab } from '../page-objects/fragments/export-messages-tab';
import { ExportMessagesFlexTab } from '../page-objects/fragments/flextabs';
import { LoginPage } from '../page-objects/login';
import { preserveSettings } from '../utils/preserveSettings';
import { test, expect } from '../utils/test';
Expand Down Expand Up @@ -43,7 +43,7 @@ test.describe('E2EE PDF Export', () => {
test('should display only the download file method when exporting messages in an e2ee room', async ({ page }) => {
const navbar = new Navbar(page);
const encryptedRoomPage = new EncryptedRoomPage(page);
const exportMessagesTab = new ExportMessagesTab(page);
const exportMessagesTab = new ExportMessagesFlexTab(page);

const channelName = faker.string.uuid();

Expand All @@ -59,7 +59,7 @@ test.describe('E2EE PDF Export', () => {
test('should allow exporting messages as PDF in an encrypted room', async ({ page }) => {
const navbar = new Navbar(page);
const encryptedRoomPage = new EncryptedRoomPage(page);
const exportMessagesTab = new ExportMessagesTab(page);
const exportMessagesTab = new ExportMessagesFlexTab(page);

const channelName = faker.string.uuid();

Expand Down
Loading
Loading