From 994a0054443c098b99099fcd30e37675f12ff59e Mon Sep 17 00:00:00 2001
From: Lyndsi Kay Williams <55605634+lyndsiWilliams@users.noreply.github.com>
Date: Thu, 8 Sep 2022 05:48:18 -0500
Subject: [PATCH] test: Fix act errors in PopoverDropdown test (#21361)
---
.../PopoverDropdown/PopoverDropdown.test.tsx | 20 +++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/superset-frontend/src/components/PopoverDropdown/PopoverDropdown.test.tsx b/superset-frontend/src/components/PopoverDropdown/PopoverDropdown.test.tsx
index 2704e11e0cd43..2c02eec91ab2f 100644
--- a/superset-frontend/src/components/PopoverDropdown/PopoverDropdown.test.tsx
+++ b/superset-frontend/src/components/PopoverDropdown/PopoverDropdown.test.tsx
@@ -36,19 +36,19 @@ const defaultProps: PopoverDropdownProps = {
onChange: jest.fn(),
};
-test('renders with default props', () => {
+test('renders with default props', async () => {
render();
- expect(screen.getByRole('button')).toBeInTheDocument();
+ expect(await screen.findByRole('button')).toBeInTheDocument();
expect(screen.getByRole('button')).toHaveTextContent('Option 1');
});
-test('renders the menu on click', () => {
+test('renders the menu on click', async () => {
render();
userEvent.click(screen.getByRole('button'));
- expect(screen.getByRole('menu')).toBeInTheDocument();
+ expect(await screen.findByRole('menu')).toBeInTheDocument();
});
-test('renders with custom button', () => {
+test('renders with custom button', async () => {
render(
{
)}
/>,
);
- expect(screen.getByText('Custom Option 1')).toBeInTheDocument();
+ expect(await screen.findByText('Custom Option 1')).toBeInTheDocument();
});
-test('renders with custom option', () => {
+test('renders with custom option', async () => {
render(
{
/>,
);
userEvent.click(screen.getByRole('button'));
- expect(screen.getByText('Custom Option 1')).toBeInTheDocument();
+ expect(await screen.findByText('Custom Option 1')).toBeInTheDocument();
});
-test('triggers onChange', () => {
+test('triggers onChange', async () => {
render();
userEvent.click(screen.getByRole('button'));
- expect(screen.getByText('Option 2')).toBeInTheDocument();
+ expect(await screen.findByText('Option 2')).toBeInTheDocument();
userEvent.click(screen.getByText('Option 2'));
expect(defaultProps.onChange).toHaveBeenCalled();
});