From 6fad3f9a357c59d3c1d34615fdf0debdebd71aed Mon Sep 17 00:00:00 2001
From: Lyndsi Kay Williams <55605634+lyndsiWilliams@users.noreply.github.com>
Date: Fri, 9 Sep 2022 06:30:46 -0500
Subject: [PATCH] test: Fix act error in ExportToCVSDropdown test (#21401)
---
.../ExportToCSVDropdown.test.tsx | 42 ++++++++-----------
1 file changed, 17 insertions(+), 25 deletions(-)
diff --git a/superset-frontend/src/explore/components/ExportToCSVDropdown/ExportToCSVDropdown.test.tsx b/superset-frontend/src/explore/components/ExportToCSVDropdown/ExportToCSVDropdown.test.tsx
index 5207b5f5ffbb4..144f03aa6f165 100644
--- a/superset-frontend/src/explore/components/ExportToCSVDropdown/ExportToCSVDropdown.test.tsx
+++ b/superset-frontend/src/explore/components/ExportToCSVDropdown/ExportToCSVDropdown.test.tsx
@@ -18,21 +18,27 @@
*/
import React from 'react';
import userEvent from '@testing-library/user-event';
-import { render, screen } from 'spec/helpers/testing-library';
+import { render, screen, waitFor } from 'spec/helpers/testing-library';
import { ExportToCSVDropdown } from './index';
const exportCSVOriginal = jest.fn();
const exportCSVPivoted = jest.fn();
-test('Dropdown button with menu renders', () => {
- render(
-
- .CSV
- ,
+const waitForRender = () => {
+ waitFor(() =>
+ render(
+
+ .CSV
+ ,
+ ),
);
+};
+
+test('Dropdown button with menu renders', () => {
+ waitForRender();
expect(screen.getByText('.CSV')).toBeVisible();
@@ -43,14 +49,7 @@ test('Dropdown button with menu renders', () => {
});
test('Call export csv original on click', () => {
- render(
-
- .CSV
- ,
- );
+ waitForRender();
userEvent.click(screen.getByText('.CSV'));
userEvent.click(screen.getByText('Original'));
@@ -59,14 +58,7 @@ test('Call export csv original on click', () => {
});
test('Call export csv pivoted on click', () => {
- render(
-
- .CSV
- ,
- );
+ waitForRender();
userEvent.click(screen.getByText('.CSV'));
userEvent.click(screen.getByText('Pivoted'));