test: fix test cases for MUI DatePicker and TimePicker migration

- Add data-testid attributes to DatePicker and TimePicker components in DateTimeFields
- Update test queries from getByLabelText to getByTestId for date/time inputs
- Fix assertions to use toHaveAttribute instead of toHaveValue for MUI pickers
- Add data-testid to occurrences-input in EventRepeat component
- Update RepeatEvent test to use data-testid for occurrences input
- Fix radio button queries using getAllByLabelText with type filter
This commit is contained in:
lenhanphung
2025-10-28 11:48:12 +07:00
committed by Benoit TELLIER
parent 3c75a7e82e
commit 5078128e10
5 changed files with 19 additions and 22 deletions
+1 -1
View File
@@ -192,7 +192,7 @@ export default function RepeatEvent({
})
}
style={{ width: 100 }}
inputProps={{ min: 1 }}
inputProps={{ min: 1, "data-testid": "occurrences-input" }}
disabled={!isOwn || endOption !== "after"}
/>
occurrences
@@ -68,6 +68,7 @@ export const DateTimeFields: React.FC<DateTimeFieldsProps> = ({
margin: "dense" as const,
fullWidth: true,
InputLabelProps: { shrink: true },
"data-testid": "start-date-input",
sx: { width: "100%" },
},
}}
@@ -94,6 +95,7 @@ export const DateTimeFields: React.FC<DateTimeFieldsProps> = ({
margin: "dense" as const,
fullWidth: true,
InputLabelProps: { shrink: true },
"data-testid": "start-time-input",
sx: { width: "100%" },
},
}}
@@ -121,6 +123,7 @@ export const DateTimeFields: React.FC<DateTimeFieldsProps> = ({
fullWidth: true,
InputLabelProps: { shrink: true },
error: !!validation.errors.dateTime,
"data-testid": "end-time-input",
sx: { width: "100%" },
},
}}
@@ -147,6 +150,7 @@ export const DateTimeFields: React.FC<DateTimeFieldsProps> = ({
fullWidth: true,
InputLabelProps: { shrink: true },
error: !!validation.errors.dateTime,
"data-testid": "end-date-input",
sx: { width: "100%" },
},
}}