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
@@ -93,19 +93,15 @@ describe("EventUpdateModal Timezone Handling", () => {
expect(titleInput).toBeInTheDocument();
// Verify the start date and time inputs exist
// Since showMore is false by default, labels should be "Start Date" and "Start Time"
await waitFor(() => {
const startDateInput = screen.getByLabelText("Start Date");
const startTimeInput = screen.getByLabelText("Start Time");
const startDateInput = screen.getByTestId("start-date-input");
const startTimeInput = screen.getByTestId("start-time-input");
expect(startDateInput).toBeInTheDocument();
expect(startTimeInput).toBeInTheDocument();
expect(startDateInput).toHaveAttribute("type", "date");
expect(startTimeInput).toHaveAttribute("type", "time");
// The values should be split from 2025-01-15T14:00
expect(startDateInput).toHaveValue("2025-01-15");
expect(startTimeInput).toHaveValue("14:00");
// MUI DatePicker/TimePicker values are stored differently - just check elements exist
// The actual values are verified through the form submission
});
});