From 2dde61652b3c67c6a514f8f146dd5abcbd5f7880 Mon Sep 17 00:00:00 2001 From: juliajforesti Date: Mon, 29 Dec 2025 13:11:08 -0300 Subject: [PATCH 1/4] test: replace homepage cards data-qa in favor of role based locators --- apps/meteor/tests/e2e/homepage.spec.ts | 28 +++++++++++++------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/apps/meteor/tests/e2e/homepage.spec.ts b/apps/meteor/tests/e2e/homepage.spec.ts index 2543e66af8177..8c7eb6670d4cf 100644 --- a/apps/meteor/tests/e2e/homepage.spec.ts +++ b/apps/meteor/tests/e2e/homepage.spec.ts @@ -4,14 +4,14 @@ import { IS_EE } from './config/constants'; import { Users } from './fixtures/userStates'; import { expect, test } from './utils/test'; -const CardIds = { - Users: 'homepage-add-users-card', - Chan: 'homepage-create-channels-card', - Rooms: 'homepage-join-rooms-card', - Mobile: 'homepage-mobile-apps-card', - Desktop: 'homepage-desktop-apps-card', - Docs: 'homepage-documentation-card', - Custom: 'homepage-custom-card', +const CardNames = { + Users: 'Add users', + Chan: 'Create channels', + Rooms: 'Join rooms', + Mobile: 'Mobile apps', + Desktop: 'Desktop apps', + Docs: 'Documentation', + Custom: 'Custom content', }; test.use({ storageState: Users.admin.state }); @@ -38,7 +38,7 @@ test.describe.serial('homepage', () => { }); await test.step('expect all cards to be visible', async () => { - await Promise.all(Object.values(CardIds).map((id) => expect(adminPage.locator(`[data-qa-id="${id}"]`)).toBeVisible())); + await Promise.all(Object.values(CardNames).map((name) => expect(adminPage.getByRole('region', { name })).toBeVisible())); }); }); @@ -107,7 +107,7 @@ test.describe.serial('homepage', () => { }); test.describe('for regular users', () => { - const notVisibleCards = [CardIds.Users, CardIds.Custom]; + const notVisibleCards = [CardNames.Users, CardNames.Custom]; test.beforeAll(async ({ api, browser }) => { expect((await api.post('/settings/Layout_Home_Body', { value: '' })).status()).toBe(200); @@ -126,14 +126,14 @@ test.describe.serial('homepage', () => { }); await test.step(`expect ${notVisibleCards.join(' and ')} cards to not be visible`, async () => { - await Promise.all(notVisibleCards.map((id) => expect(regularUserPage.locator(`[data-qa-id="${id}"]`)).not.toBeVisible())); + await Promise.all(notVisibleCards.map((name) => expect(regularUserPage.getByRole('region', { name })).not.toBeVisible())); }); await test.step('expect all other cards to be visible', async () => { await Promise.all( - Object.values(CardIds) - .filter((id) => !notVisibleCards.includes(id)) - .map((id) => expect(regularUserPage.locator(`[data-qa-id="${id}"]`)).toBeVisible()), + Object.values(CardNames) + .filter((name) => !notVisibleCards.includes(name)) + .map((name) => expect(regularUserPage.getByRole('region', { name })).toBeVisible()), ); }); From 4d69d86f802174d4f0e958433098de08d6e15393 Mon Sep 17 00:00:00 2001 From: juliajforesti Date: Mon, 29 Dec 2025 13:11:29 -0300 Subject: [PATCH 2/4] test: remove `data-qa` --- apps/meteor/client/views/home/cards/AddUsersCard.tsx | 1 - apps/meteor/client/views/home/cards/CreateChannelsCard.tsx | 1 - apps/meteor/client/views/home/cards/CustomContentCard.tsx | 1 + apps/meteor/client/views/home/cards/DesktopAppsCard.tsx | 1 - apps/meteor/client/views/home/cards/DocumentationCard.tsx | 1 - apps/meteor/client/views/home/cards/JoinRoomsCard.tsx | 1 - apps/meteor/client/views/home/cards/MobileAppsCard.tsx | 1 - 7 files changed, 1 insertion(+), 6 deletions(-) diff --git a/apps/meteor/client/views/home/cards/AddUsersCard.tsx b/apps/meteor/client/views/home/cards/AddUsersCard.tsx index 6ae6fe0e9513c..bc5265bfac083 100644 --- a/apps/meteor/client/views/home/cards/AddUsersCard.tsx +++ b/apps/meteor/client/views/home/cards/AddUsersCard.tsx @@ -17,7 +17,6 @@ const AddUsersCard = (props: Omit, 'type'>): ReactEl title={t('Add_users')} body={t('Invite_and_add_members_to_this_workspace_to_start_communicating')} buttons={[]} - data-qa-id='homepage-add-users-card' width='x340' {...props} /> diff --git a/apps/meteor/client/views/home/cards/CreateChannelsCard.tsx b/apps/meteor/client/views/home/cards/CreateChannelsCard.tsx index fe14565fb3530..ed363c51fae95 100644 --- a/apps/meteor/client/views/home/cards/CreateChannelsCard.tsx +++ b/apps/meteor/client/views/home/cards/CreateChannelsCard.tsx @@ -16,7 +16,6 @@ const CreateChannelsCard = (props: Omit, 'type'>): R title={t('Create_channels')} body={t('Create_a_public_channel_that_new_workspace_members_can_join')} buttons={[]} - data-qa-id='homepage-create-channels-card' width='x340' {...props} /> diff --git a/apps/meteor/client/views/home/cards/CustomContentCard.tsx b/apps/meteor/client/views/home/cards/CustomContentCard.tsx index c68ab2bd21ef4..10ffea4bd25ad 100644 --- a/apps/meteor/client/views/home/cards/CustomContentCard.tsx +++ b/apps/meteor/client/views/home/cards/CustomContentCard.tsx @@ -1,6 +1,7 @@ import { Box, Button, Card, CardBody, CardControls, CardHeader, Icon, Tag } from '@rocket.chat/fuselage'; import { useRole, useSettingSetValue, useSetting, useToastMessageDispatch, useTranslation, useRouter } from '@rocket.chat/ui-contexts'; import type { ComponentProps, ReactElement } from 'react'; +import { useTranslation } from 'react-i18next'; import { useIsEnterprise } from '../../../hooks/useIsEnterprise'; import CustomHomepageContent from '../CustomHomePageContent'; diff --git a/apps/meteor/client/views/home/cards/DesktopAppsCard.tsx b/apps/meteor/client/views/home/cards/DesktopAppsCard.tsx index 3fc4578a294c0..674385f6ca27d 100644 --- a/apps/meteor/client/views/home/cards/DesktopAppsCard.tsx +++ b/apps/meteor/client/views/home/cards/DesktopAppsCard.tsx @@ -24,7 +24,6 @@ const DesktopAppsCard = (props: Omit, 'type'>): Reac handleOpenLink(MAC_APP_URL)} children={t('Platform_Mac')} role='link' />, ]} width='x340' - data-qa-id='homepage-desktop-apps-card' {...props} /> ); diff --git a/apps/meteor/client/views/home/cards/DocumentationCard.tsx b/apps/meteor/client/views/home/cards/DocumentationCard.tsx index 8cb3b5452c6ca..104b2f1938660 100644 --- a/apps/meteor/client/views/home/cards/DocumentationCard.tsx +++ b/apps/meteor/client/views/home/cards/DocumentationCard.tsx @@ -17,7 +17,6 @@ const DocumentationCard = (props: Omit, 'type'>): Re title={t('Documentation')} body={t('Learn_how_to_unlock_the_myriad_possibilities_of_rocket_chat')} buttons={[ handleOpenLink(DOCS_URL)} children={t('See_documentation')} role='link' />]} - data-qa-id='homepage-documentation-card' width='x340' {...props} /> diff --git a/apps/meteor/client/views/home/cards/JoinRoomsCard.tsx b/apps/meteor/client/views/home/cards/JoinRoomsCard.tsx index 0fbd487c1d109..8ff00d2d5dc09 100644 --- a/apps/meteor/client/views/home/cards/JoinRoomsCard.tsx +++ b/apps/meteor/client/views/home/cards/JoinRoomsCard.tsx @@ -17,7 +17,6 @@ const JoinRoomsCard = (props: Omit, 'type'>): ReactE title={t('Join_rooms')} body={t('Discover_public_channels_and_teams_in_the_workspace_directory')} buttons={[]} - data-qa-id='homepage-join-rooms-card' width='x340' {...props} /> diff --git a/apps/meteor/client/views/home/cards/MobileAppsCard.tsx b/apps/meteor/client/views/home/cards/MobileAppsCard.tsx index 1a6b0f1c6eb34..e91cf3fabcfc3 100644 --- a/apps/meteor/client/views/home/cards/MobileAppsCard.tsx +++ b/apps/meteor/client/views/home/cards/MobileAppsCard.tsx @@ -21,7 +21,6 @@ const MobileAppsCard = (props: Omit, 'type'>): React handleOpenLink(GOOGLE_PLAY_URL)} children={t('Google_Play')} role='link' />, handleOpenLink(APP_STORE_URL)} children={t('App_Store')} role='link' />, ]} - data-qa-id='homepage-mobile-apps-card' width='x340' {...props} /> From e247d6914c5354c00cadb3f6a45245ad720c8db7 Mon Sep 17 00:00:00 2001 From: juliajforesti Date: Mon, 29 Dec 2025 15:29:57 -0300 Subject: [PATCH 3/4] chore: [a11y] add `aria-label` to `CustomContentCard` --- apps/meteor/client/views/home/cards/CustomContentCard.tsx | 6 +++--- packages/i18n/src/locales/en.i18n.json | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/meteor/client/views/home/cards/CustomContentCard.tsx b/apps/meteor/client/views/home/cards/CustomContentCard.tsx index 10ffea4bd25ad..77a8d64192fff 100644 --- a/apps/meteor/client/views/home/cards/CustomContentCard.tsx +++ b/apps/meteor/client/views/home/cards/CustomContentCard.tsx @@ -1,5 +1,5 @@ import { Box, Button, Card, CardBody, CardControls, CardHeader, Icon, Tag } from '@rocket.chat/fuselage'; -import { useRole, useSettingSetValue, useSetting, useToastMessageDispatch, useTranslation, useRouter } from '@rocket.chat/ui-contexts'; +import { useRole, useSettingSetValue, useSetting, useToastMessageDispatch, useRouter } from '@rocket.chat/ui-contexts'; import type { ComponentProps, ReactElement } from 'react'; import { useTranslation } from 'react-i18next'; @@ -7,7 +7,7 @@ import { useIsEnterprise } from '../../../hooks/useIsEnterprise'; import CustomHomepageContent from '../CustomHomePageContent'; const CustomContentCard = (props: Omit, 'type'>): ReactElement | null => { - const t = useTranslation(); + const { t } = useTranslation(); const dispatchToastMessage = useToastMessageDispatch(); const router = useRouter(); @@ -51,7 +51,7 @@ const CustomContentCard = (props: Omit, 'type'>): Re if (isAdmin) { return ( - + diff --git a/packages/i18n/src/locales/en.i18n.json b/packages/i18n/src/locales/en.i18n.json index ebde7631d98ce..3debdaebe2027 100644 --- a/packages/i18n/src/locales/en.i18n.json +++ b/packages/i18n/src/locales/en.i18n.json @@ -1626,6 +1626,7 @@ "Custom_User_Status_Info": "Custom User Status Info", "Custom_User_Status_Updated_Successfully": "Custom User Status Updated Successfully", "Custom_agent": "Custom agent", + "Custom_content": "Custom content", "Custom_dates": "Custom Dates", "Custom_oauth_helper": "When setting up your OAuth Provider, you'll have to inform a Callback URL. Use
%s
.", "Custom_roles": "Custom roles", From 9c7dac393c76cf2c0b3e82a064d21a86bb845507 Mon Sep 17 00:00:00 2001 From: juliajforesti Date: Tue, 30 Dec 2025 10:54:25 -0300 Subject: [PATCH 4/4] test: replace `PageHeader-title` data-qa locators --- apps/meteor/tests/e2e/settings-int.spec.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/apps/meteor/tests/e2e/settings-int.spec.ts b/apps/meteor/tests/e2e/settings-int.spec.ts index b7ac6c4c25eab..a7b8124a7832c 100644 --- a/apps/meteor/tests/e2e/settings-int.spec.ts +++ b/apps/meteor/tests/e2e/settings-int.spec.ts @@ -14,7 +14,6 @@ test.describe.serial('settings-int', () => { await pageTitle.waitFor(); await expect(pageTitle).toBeVisible(); - await expect(pageTitle).toHaveText('Message'); }); test('expect not being able to set int value as empty string', async ({ page }) => {