Skip to content

Commit 31e2061

Browse files
committed
refactor: replace data-cy with data-testid
1 parent a00e3db commit 31e2061

File tree

12 files changed

+26
-24
lines changed

12 files changed

+26
-24
lines changed

apps/web/src/components/LoginForm/LoginForm.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const LoginForm = ({ onSubmit }: LoginFormProps) => {
2525
variant: 'password'
2626
}
2727
}}
28-
data-cy="login-form"
28+
data-testid="login-form"
2929
submitBtnLabel={t('login')}
3030
validationSchema={z.object({
3131
username: z.string().min(1),

apps/web/src/components/SelectInstrument.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ export const SelectInstrument = ({ onSelect, options }: SelectInstrumentProps) =
1414
onSelect(id);
1515
}}
1616
>
17-
<Select.Trigger className="min-w-72" data-cy="select-instrument-dropdown-trigger">
17+
<Select.Trigger className="min-w-72" data-testid="select-instrument-dropdown-trigger">
1818
<Select.Value placeholder={t('datahub.visualization.selectInstrument')} />
1919
</Select.Trigger>
2020
<Select.Content>
2121
<Select.Group>
2222
{Object.entries(options).map(([id, label]) => (
23-
<Select.Item data-cy="select-instrument-dropdown-item" key={id} value={id}>
23+
<Select.Item data-testid="select-instrument-dropdown-item" key={id} value={id}>
2424
{label}
2525
</Select.Item>
2626
))}

apps/web/src/components/Sidebar/Sidebar.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export const Sidebar = () => {
8686
<h5 className="text-sm font-medium">{t('common.sessionInProgress')}</h5>
8787
<hr className="my-1.5 h-[1px] border-none bg-slate-700" />
8888
{isSubjectWithPersonalInfo(currentSession.subject) ? (
89-
<div data-cy="current-session-info">
89+
<div data-testid="current-session-info">
9090
<p>{`${t('core.fullName')}: ${currentSession.subject.firstName} ${currentSession.subject.lastName}`}</p>
9191
<p>
9292
{`${t('core.identificationData.dateOfBirth.label')}: ${toBasicISOString(currentSession.subject.dateOfBirth)}`}{' '}
@@ -96,7 +96,7 @@ export const Sidebar = () => {
9696
</p>
9797
</div>
9898
) : (
99-
<div data-cy="current-session-info">
99+
<div data-testid="current-session-info">
100100
<p>ID: {removeSubjectIdScope(currentSession.subject.id)}</p>
101101
</div>
102102
)}

apps/web/src/components/StartSessionForm/StartSessionForm.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ export const StartSessionForm = ({
155155
}
156156
}
157157
]}
158-
data-cy="start-session-form"
158+
data-testid="start-session-form"
159159
initialValues={initialValues}
160160
readOnly={readOnly}
161161
submitBtnLabel={t('core.submit')}

apps/web/src/components/TimeDropdown.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,18 @@ export const TimeDropdown = ({ disabled, setMinTime }: TimeDropdownProps) => {
2222
}
2323
}}
2424
>
25-
<Select.Trigger className="min-w-32" data-cy="time-dropdown-trigger" disabled={disabled}>
25+
<Select.Trigger className="min-w-32" data-testid="time-dropdown-trigger" disabled={disabled}>
2626
<Select.Value placeholder={t('visualization.timeframe')} />
2727
</Select.Trigger>
2828
<Select.Content>
2929
<Select.Group>
30-
<Select.Item data-cy="time-dropdown-item" value="all">
30+
<Select.Item data-testid="time-dropdown-item" value="all">
3131
{t('visualization.timeframeOptions.all')}
3232
</Select.Item>
33-
<Select.Item data-cy="time-dropdown-item" value="pastMonth">
33+
<Select.Item data-testid="time-dropdown-item" value="pastMonth">
3434
{t('visualization.timeframeOptions.month')}
3535
</Select.Item>
36-
<Select.Item data-cy="time-dropdown-item" value="pastYear">
36+
<Select.Item data-testid="time-dropdown-item" value="pastYear">
3737
{t('visualization.timeframeOptions.year')}
3838
</Select.Item>
3939
</Select.Group>

apps/web/src/routes/_app/datahub/$subjectId/graph.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ const RouteComponent = () => {
105105
<div className="mb-2">
106106
<div className="flex flex-col gap-2 lg:flex-row lg:justify-between">
107107
<div className="flex flex-col gap-2 lg:flex-row">
108-
<div data-cy="instrument-select-dropdown-container">
108+
<div data-testid="instrument-select-dropdown-container">
109109
<SelectInstrument
110110
options={instrumentOptions}
111111
onSelect={(id) => {
@@ -116,7 +116,7 @@ const RouteComponent = () => {
116116
</div>
117117
</div>
118118
<div className="flex flex-col gap-2 lg:flex-row">
119-
<div data-cy="measure-select-dropdown-container">
119+
<div data-testid="measure-select-dropdown-container">
120120
<ListboxDropdown
121121
widthFull
122122
checkPosition="right"
@@ -129,10 +129,10 @@ const RouteComponent = () => {
129129
variant="secondary"
130130
/>
131131
</div>
132-
<div data-cy="time-select-dropdown-container">
132+
<div data-testid="time-select-dropdown-container">
133133
<TimeDropdown disabled={!instrumentId} setMinTime={setMinDate} />
134134
</div>
135-
<div className="relative w-full whitespace-nowrap" data-cy="download-button-container">
135+
<div className="relative w-full whitespace-nowrap" data-testid="download-button-container">
136136
<ActionDropdown
137137
widthFull
138138
disabled={!instrumentId}

apps/web/src/routes/_app/datahub/$subjectId/route.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { PageHeader } from '@/components/PageHeader';
1111
import { config } from '@/config';
1212
import { useAppStore } from '@/store';
1313

14-
const TabLink = ({ dataCy, label, pathname }: { dataCy?: string; label: string; pathname: string }) => {
14+
const TabLink = ({ label, pathname, testId }: { label: string; pathname: string; testId?: string }) => {
1515
const location = useLocation();
1616
const isActive = location.pathname === pathname;
1717
return (
@@ -20,9 +20,9 @@ const TabLink = ({ dataCy, label, pathname }: { dataCy?: string; label: string;
2020
'grow border-b px-1 py-3 text-center font-medium',
2121
isActive ? 'border-sky-500 text-slate-900 dark:text-slate-100' : 'border-slate-300 dark:border-slate-700'
2222
)}
23-
data-cy={dataCy}
2423
data-nav-url={pathname}
2524
data-spotlight-type="tab-link"
25+
data-testid={testId}
2626
to={pathname}
2727
>
2828
{label}
@@ -55,13 +55,13 @@ const RouteComponent = () => {
5555
<div className="mb-5 flex">
5656
{config.setup.isGatewayEnabled && (
5757
<TabLink
58-
dataCy="subject-assignment"
5958
label={t('layout.tabs.assignments')}
6059
pathname={`${basePathname}/assignments`}
60+
testId="subject-assignment"
6161
/>
6262
)}
63-
<TabLink dataCy="subject-table" label={t('layout.tabs.table')} pathname={`${basePathname}/table`} />
64-
<TabLink dataCy="subject-graph" label={t('layout.tabs.graph')} pathname={`${basePathname}/graph`} />
63+
<TabLink label={t('layout.tabs.table')} pathname={`${basePathname}/table`} testId="subject-table" />
64+
<TabLink label={t('layout.tabs.graph')} pathname={`${basePathname}/graph`} testId="subject-graph" />
6565
</div>
6666
<React.Suspense fallback={<LoadingFallback />}>
6767
<Outlet />

apps/web/src/routes/_app/datahub/$subjectId/table.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const RouteComponent = () => {
5757
...fields
5858
]}
5959
data={records}
60-
data-cy="subject-table"
60+
data-testid="subject-table"
6161
entriesPerPage={15}
6262
minRows={15}
6363
/>

apps/web/src/routes/_app/datahub/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ const MasterDataTable = ({ data, onSelect }: MasterDataTableProps) => {
5151
}
5252
]}
5353
data={data}
54-
data-cy="master-data-table"
54+
data-testid="master-data-table"
5555
entriesPerPage={15}
5656
minRows={15}
5757
onEntryClick={onSelect}

apps/web/src/routes/setup.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ const RouteComponent = () => {
114114
title: t('setup.demo.title')
115115
}
116116
]}
117-
data-cy="setup-form"
117+
data-testid="setup-form"
118118
initialValues={{
119119
enableExperimentalFeatures: false
120120
}}

0 commit comments

Comments
 (0)