Skip to content

test(widgets): Increase timeout for widget loading #91839

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 16, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -275,29 +275,31 @@ describe('ChartWidgetLoader - unmocked imports', () => {
// - `id` must match the filename
// - have a `default` export that is a React component (component name should be TitleCase of `id`)
// - be mapped via `id` -> dynamic import in `chartWidgetLoader.tsx`
it.each(widgetIds as ChartId[])('can load widget: %s', async widgetId => {
render(<ChartWidgetLoader id={widgetId} />);
it.each(widgetIds as ChartId[])(
'can load widget: %s',
async widgetId => {
render(<ChartWidgetLoader id={widgetId} />);

// Initially should show loading state from ChartWidgetLoader, it will disappear when dynamic import completes.
// We only need to check that the dynamic import completes for these tests as that means ChartWidgetLoader is able to load all widgets
expect(screen.getByTestId('loading-placeholder')).toBeInTheDocument();
// Initially should show loading state from ChartWidgetLoader, it will disappear when dynamic import completes.
// We only need to check that the dynamic import completes for these tests as that means ChartWidgetLoader is able to load all widgets
await waitFor(
() => {
expect(screen.queryByTestId('loading-placeholder')).not.toBeInTheDocument();
},
{
timeout: 10_000,
}
);

await waitFor(
() => {
expect(screen.queryByTestId('loading-placeholder')).not.toBeInTheDocument();
},
{
timeout: 2000,
}
);

expect(TimeSeriesWidgetVisualization).toHaveBeenCalledWith(
expect.objectContaining({
id: widgetId,
}),
undefined
);
});
expect(TimeSeriesWidgetVisualization).toHaveBeenCalledWith(
expect.objectContaining({
id: widgetId,
}),
undefined
);
},
15_000
);

it('shows error state for invalid widget id', async () => {
const consoleSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
Expand Down
Loading