Skip to content

The open alternative to Salesforce, designed for AI.

fix: increase findByText timeout for lazy-loaded DateTimePicker tests (#17672)

Félix Malfaita1f26cda0d57
diff --git a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/__stories__/DateTimeFieldInput.stories.tsx b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/__stories__/DateTimeFieldInput.stories.tsx
index 84960e5c03e..9bb129eba6e 100644
--- a/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/__stories__/DateTimeFieldInput.stories.tsx
+++ b/packages/twenty-front/src/modules/object-record/record-field/ui/meta-types/input/components/__stories__/DateTimeFieldInput.stories.tsx
@@ -135,7 +135,8 @@ type Story = StoryObj<typeof DateFieldInputWithContext>;
export const Default: Story = {
play: async ({ canvasElement }) => {
const canvas = within(canvasElement);
- const div = await canvas.findByText('January');
+ // Increased timeout to account for lazy-loaded react-datepicker on slower CI runners
+ const div = await canvas.findByText('January', {}, { timeout: 10000 });
await expect(div.innerText).toContain('January');
},
@@ -147,7 +148,8 @@ export const ClickOutside: Story = {
await expect(handleClickoutsideMocked).toHaveBeenCalledTimes(0);
- await canvas.findByText('January');
+ // Increased timeout to account for lazy-loaded react-datepicker on slower CI runners
+ await canvas.findByText('January', {}, { timeout: 10000 });
const emptyDiv = canvas.getByTestId('data-field-input-click-outside-div');
await userEvent.click(emptyDiv);
@@ -160,7 +162,8 @@ export const Escape: Story = {
await expect(handleEscapeMocked).toHaveBeenCalledTimes(0);
const canvas = within(canvasElement);
- await canvas.findByText('January');
+ // Increased timeout to account for lazy-loaded react-datepicker on slower CI runners
+ await canvas.findByText('January', {}, { timeout: 10000 });
await userEvent.keyboard('{escape}');
await expect(handleEscapeMocked).toHaveBeenCalledTimes(1);
@@ -172,7 +175,8 @@ export const Enter: Story = {
await expect(handleEnterMocked).toHaveBeenCalledTimes(0);
const canvas = within(canvasElement);
- await canvas.findByText('January');
+ // Increased timeout to account for lazy-loaded react-datepicker on slower CI runners
+ await canvas.findByText('January', {}, { timeout: 10000 });
await userEvent.keyboard('{enter}');
await expect(handleEnterMocked).toHaveBeenCalledTimes(1);
diff --git a/packages/twenty-front/src/modules/ui/input/components/internal/date/components/__stories__/InternalDatePicker.stories.tsx b/packages/twenty-front/src/modules/ui/input/components/internal/date/components/__stories__/InternalDatePicker.stories.tsx
index 9be674195ff..598702c0127 100644
--- a/packages/twenty-front/src/modules/ui/input/components/internal/date/components/__stories__/InternalDatePicker.stories.tsx
+++ b/packages/twenty-front/src/modules/ui/input/components/internal/date/components/__stories__/InternalDatePicker.stories.tsx
@@ -38,7 +38,12 @@ export const WithOpenMonthSelect: Story = {
const canvas = within(canvasElement);
const body = within(canvasElement.ownerDocument.body);
- const monthSelect = await canvas.findByText('January');
+ // Increased timeout to account for lazy-loaded react-datepicker on slower CI runners
+ const monthSelect = await canvas.findByText(
+ 'January',
+ {},
+ { timeout: 10000 },
+ );
await userEvent.click(monthSelect);
@@ -69,7 +74,8 @@ export const WithOpenYearSelect: Story = {
const canvas = within(canvasElement);
const body = within(canvasElement.ownerDocument.body);
- const yearSelect = await canvas.findByText('2023');
+ // Increased timeout to account for lazy-loaded react-datepicker on slower CI runners
+ const yearSelect = await canvas.findByText('2023', {}, { timeout: 10000 });
await userEvent.click(yearSelect);