You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ru...@apache.org on 2026/05/11 22:48:17 UTC

(superset) branch master updated: test(sqllab): stabilize SaveDatasetModal overwrite-flow test helper (#40036)

This is an automated email from the ASF dual-hosted git repository.

rusackas pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/master by this push:
     new cfb704dbeb7 test(sqllab): stabilize SaveDatasetModal overwrite-flow test helper (#40036)
cfb704dbeb7 is described below

commit cfb704dbeb7379e62996e0cbb8f68061054148c9
Author: Evan Rusackas <ev...@preset.io>
AuthorDate: Mon May 11 15:48:10 2026 -0700

    test(sqllab): stabilize SaveDatasetModal overwrite-flow test helper (#40036)
    
    Co-authored-by: Superset Dev <de...@superset.apache.org>
    Co-authored-by: Claude Opus 4.7 <no...@anthropic.com>
---
 .../SaveDatasetModal/SaveDatasetModal.test.tsx     | 30 ++++++++++++++--------
 1 file changed, 20 insertions(+), 10 deletions(-)

diff --git a/superset-frontend/src/SqlLab/components/SaveDatasetModal/SaveDatasetModal.test.tsx b/superset-frontend/src/SqlLab/components/SaveDatasetModal/SaveDatasetModal.test.tsx
index 4aacf585743..b89f1ef9525 100644
--- a/superset-frontend/src/SqlLab/components/SaveDatasetModal/SaveDatasetModal.test.tsx
+++ b/superset-frontend/src/SqlLab/components/SaveDatasetModal/SaveDatasetModal.test.tsx
@@ -356,21 +356,31 @@ describe('SaveDatasetModal', () => {
 
   const setupOverwriteFlow = async () => {
     // Select the "Overwrite existing" radio
-    userEvent.click(screen.getByRole('radio', { name: /overwrite existing/i }));
-    // Open the select and pick an existing dataset
-    userEvent.click(
-      screen.getByRole('combobox', { name: /existing dataset/i }),
+    await userEvent.click(
+      screen.getByRole('radio', { name: /overwrite existing/i }),
     );
-    await waitFor(() =>
-      expect(screen.queryByText('Loading...')).not.toBeVisible(),
+    // Open the select to load existing-dataset options
+    await userEvent.click(
+      screen.getByRole('combobox', { name: /existing dataset/i }),
     );
-    userEvent.click(screen.getAllByText('coolest table 0')[1]);
+    // Advance timers to flush debounced fetches in AsyncSelect
+    await act(async () => {
+      jest.runAllTimers();
+    });
+    // Wait for the loading indicator to clear
+    await waitFor(() => {
+      const loading = screen.queryByText('Loading...');
+      expect(loading === null || !loading.checkVisibility()).toBe(true);
+    });
+    // Pick an existing dataset (use the listbox item, not the input mirror)
+    const options = await screen.findAllByText('coolest table 0');
+    await userEvent.click(options[1]);
     // First overwrite click → confirmation screen
-    userEvent.click(screen.getByRole('button', { name: /overwrite/i }));
+    await userEvent.click(screen.getByRole('button', { name: /overwrite/i }));
     // Wait for the confirmation screen to render
     await screen.findByText(/are you sure you want to overwrite this dataset/i);
     // Second overwrite click → triggers the PUT
-    userEvent.click(screen.getByRole('button', { name: /overwrite/i }));
+    await userEvent.click(screen.getByRole('button', { name: /overwrite/i }));
   };
 
   test('sends template_params when overwriting a dataset with include template parameters checked', async () => {
@@ -399,7 +409,7 @@ describe('SaveDatasetModal', () => {
     });
 
     // Check the "Include Template Parameters" checkbox
-    userEvent.click(screen.getByRole('checkbox'));
+    await userEvent.click(screen.getByRole('checkbox'));
 
     await setupOverwriteFlow();