Skip to content

Commit 0182f0c

Browse files
scttcperandrewshie-sentry
authored andcommitted
test(widgets): Increase timeout for widget loading (#91839)
1 parent 870b362 commit 0182f0c

File tree

1 file changed

+23
-21
lines changed

1 file changed

+23
-21
lines changed

static/app/components/charts/chartWidgetLoader-unmocked-imports.spec.tsx

Lines changed: 23 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -275,29 +275,31 @@ describe('ChartWidgetLoader - unmocked imports', () => {
275275
// - `id` must match the filename
276276
// - have a `default` export that is a React component (component name should be TitleCase of `id`)
277277
// - be mapped via `id` -> dynamic import in `chartWidgetLoader.tsx`
278-
it.each(widgetIds as ChartId[])('can load widget: %s', async widgetId => {
279-
render(<ChartWidgetLoader id={widgetId} />);
278+
it.each(widgetIds as ChartId[])(
279+
'can load widget: %s',
280+
async widgetId => {
281+
render(<ChartWidgetLoader id={widgetId} />);
280282

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

285-
await waitFor(
286-
() => {
287-
expect(screen.queryByTestId('loading-placeholder')).not.toBeInTheDocument();
288-
},
289-
{
290-
timeout: 2000,
291-
}
292-
);
293-
294-
expect(TimeSeriesWidgetVisualization).toHaveBeenCalledWith(
295-
expect.objectContaining({
296-
id: widgetId,
297-
}),
298-
undefined
299-
);
300-
});
294+
expect(TimeSeriesWidgetVisualization).toHaveBeenCalledWith(
295+
expect.objectContaining({
296+
id: widgetId,
297+
}),
298+
undefined
299+
);
300+
},
301+
15_000
302+
);
301303

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

0 commit comments

Comments
 (0)