diff --git a/.changeset/rare-emus-wait.md b/.changeset/rare-emus-wait.md
new file mode 100644
index 0000000..082342c
--- /dev/null
+++ b/.changeset/rare-emus-wait.md
@@ -0,0 +1,5 @@
+---
+"@openfun/cunningham-react": patch
+---
+
+Fix flaky tests on DateRangePicker
diff --git a/packages/react/src/components/Forms/DatePicker/DateRangePicker.spec.tsx b/packages/react/src/components/Forms/DatePicker/DateRangePicker.spec.tsx
index 797b5f9..9020993 100644
--- a/packages/react/src/components/Forms/DatePicker/DateRangePicker.spec.tsx
+++ b/packages/react/src/components/Forms/DatePicker/DateRangePicker.spec.tsx
@@ -241,7 +241,9 @@ describe("", () => {
).getByRole("button")!;
// Pick a start date.
- const gridCellStartDate = startGridCellButton.getAttribute("aria-label");
+ const gridCellStartDate = startGridCellButton
+ .getAttribute("aria-label")
+ ?.replace("Today, ", "");
await user.click(startGridCellButton);
expectCalendarToBeOpen();
@@ -254,7 +256,9 @@ describe("", () => {
).getByRole("button")!;
// Pick an end date.
- const gridCellEndDate = endGridCellButton.getAttribute("aria-label");
+ const gridCellEndDate = endGridCellButton
+ .getAttribute("aria-label")
+ ?.replace("Today, ", "");
await user.click(endGridCellButton);
// Calendar should close on range's selection.
@@ -273,7 +277,8 @@ describe("", () => {
const selectedRange = within(selectedCells[0])
.getByRole("button")!
.getAttribute("aria-label")
- ?.replace("selected", "");
+ ?.replace("selected", "")
+ ?.replace("Today, ", "");
// Make sure start and end dates are in the selected range,
// that describes the range with its start and end date.
@@ -311,7 +316,9 @@ describe("", () => {
).getByRole("button")!;
// Pick a start date.
- const gridCellDate = gridCellButton.getAttribute("aria-label");
+ const gridCellDate = gridCellButton
+ .getAttribute("aria-label")
+ ?.replace("Today, ", "");
await user.click(gridCellButton);
expectCalendarToBeOpen();
@@ -335,7 +342,8 @@ describe("", () => {
const selectedRange = within(selectedCells[0])
.getByRole("button")!
.getAttribute("aria-label")
- ?.replace("selected", "");
+ ?.replace("selected", "")
+ ?.replace("Today, ", "");
// Make sure start and end dates are in the selected range,
// that describes the range with its start and end date.