test: Fix act errors in SamplesPane test (#21406)

This commit is contained in:
Lyndsi Kay Williams 2022-09-09 06:33:14 -05:00 committed by GitHub
parent 295de2d098
commit bd1abd3b6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -22,9 +22,9 @@ import userEvent from '@testing-library/user-event';
import { import {
render, render,
waitForElementToBeRemoved, waitForElementToBeRemoved,
waitFor,
} from 'spec/helpers/testing-library'; } from 'spec/helpers/testing-library';
import { exploreActions } from 'src/explore/actions/exploreActions'; import { exploreActions } from 'src/explore/actions/exploreActions';
import { promiseTimeout } from '@superset-ui/core';
import { SamplesPane } from '../components'; import { SamplesPane } from '../components';
import { createSamplesPaneProps } from './fixture'; import { createSamplesPaneProps } from './fixture';
@ -72,9 +72,9 @@ describe('SamplesPane', () => {
expect( expect(
await findByText('No samples were returned for this dataset'), await findByText('No samples were returned for this dataset'),
).toBeVisible(); ).toBeVisible();
await promiseTimeout(() => { await waitFor(() => {
expect(setForceQuery).toHaveBeenCalledTimes(0); expect(setForceQuery).toHaveBeenCalledTimes(0);
}, 10); });
}); });
test('error response', async () => { test('error response', async () => {
@ -100,9 +100,9 @@ describe('SamplesPane', () => {
}, },
); );
await promiseTimeout(() => { await waitFor(() => {
expect(setForceQuery).toHaveBeenCalledTimes(1); expect(setForceQuery).toHaveBeenCalledTimes(1);
}, 10); });
expect(queryByText('2 rows')).toBeVisible(); expect(queryByText('2 rows')).toBeVisible();
expect(queryByText('Action')).toBeVisible(); expect(queryByText('Action')).toBeVisible();
expect(queryByText('Horror')).toBeVisible(); expect(queryByText('Horror')).toBeVisible();