From de2f974abe7e719290243fa5c0cf40d35662915f Mon Sep 17 00:00:00 2001 From: Kamil Gabryjelski Date: Thu, 1 Aug 2024 18:20:44 +0200 Subject: [PATCH] Fix ut --- .../TimezoneSelector.DaylightSavingTime.test.tsx | 8 +++++++- .../src/features/alerts/AlertReportModal.test.tsx | 9 ++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/superset-frontend/src/components/TimezoneSelector/TimezoneSelector.DaylightSavingTime.test.tsx b/superset-frontend/src/components/TimezoneSelector/TimezoneSelector.DaylightSavingTime.test.tsx index 81dbc6fdcd7e1..f30eeb2d52219 100644 --- a/superset-frontend/src/components/TimezoneSelector/TimezoneSelector.DaylightSavingTime.test.tsx +++ b/superset-frontend/src/components/TimezoneSelector/TimezoneSelector.DaylightSavingTime.test.tsx @@ -18,7 +18,12 @@ */ import { FC } from 'react'; -import { render, waitFor, screen } from 'spec/helpers/testing-library'; +import { + render, + waitFor, + screen, + waitForElementToBeRemoved, +} from 'spec/helpers/testing-library'; import userEvent from '@testing-library/user-event'; import type { TimezoneSelectorProps } from './index'; @@ -44,6 +49,7 @@ test('render timezones in correct order for daylight saving time', async () => { />, ); + await waitForElementToBeRemoved(() => screen.queryByLabelText('Loading')); const searchInput = screen.getByRole('combobox'); userEvent.click(searchInput); diff --git a/superset-frontend/src/features/alerts/AlertReportModal.test.tsx b/superset-frontend/src/features/alerts/AlertReportModal.test.tsx index dbd55841f4e2b..f9a2ad869540e 100644 --- a/superset-frontend/src/features/alerts/AlertReportModal.test.tsx +++ b/superset-frontend/src/features/alerts/AlertReportModal.test.tsx @@ -18,7 +18,13 @@ */ import userEvent from '@testing-library/user-event'; import fetchMock from 'fetch-mock'; -import { render, screen, waitFor, within } from 'spec/helpers/testing-library'; +import { + render, + screen, + waitFor, + within, + waitForElementToBeRemoved, +} from 'spec/helpers/testing-library'; import { buildErrorTooltipMessage } from './buildErrorTooltipMessage'; import AlertReportModal, { AlertReportModalProps } from './AlertReportModal'; import { AlertObject, NotificationMethodOption } from './types'; @@ -519,6 +525,7 @@ test('renders default Schedule fields', async () => { useRedux: true, }); userEvent.click(screen.getByTestId('schedule-panel')); + await waitForElementToBeRemoved(() => screen.queryByLabelText('Loading')); const scheduleType = screen.getByRole('combobox', { name: /schedule type/i, });