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

hainenber 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 e93f8ce638c test(semantic-views): wait for views refetches to settle 
before selecting a view (#44792)
e93f8ce638c is described below

commit e93f8ce638c4ce4417e5e3c3ed59f1181604fbd7
Author: Sepuri Sai Krishna <[email protected]>
AuthorDate: Wed Sep 30 23:07:05 2026 +0530

    test(semantic-views): wait for views refetches to settle before selecting a 
view (#44792)
---
 .../semanticViews/AddSemanticViewModal.test.tsx    | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git 
a/superset-frontend/src/features/semanticViews/AddSemanticViewModal.test.tsx 
b/superset-frontend/src/features/semanticViews/AddSemanticViewModal.test.tsx
index 9d045dd82ca..1c85bb0ae78 100644
--- a/superset-frontend/src/features/semanticViews/AddSemanticViewModal.test.tsx
+++ b/superset-frontend/src/features/semanticViews/AddSemanticViewModal.test.tsx
@@ -458,6 +458,28 @@ test('the save payload carries every selected metric', 
async () => {
     },
     { timeout: 10000 },
   );
+  // Each metric pick schedules a debounced views refetch, and fetchViews()
+  // clears the current view selection before its response arrives. Waiting 
only
+  // for the combobox to enable leaves a later refetch in flight, which would
+  // drop the pick below and leave handleSave with nothing to create. Wait 
until
+  // the refetches have stopped before selecting.
+  const viewsFetchCount = () =>
+    mockedPost.mock.calls.filter(
+      ([{ endpoint }]) => endpoint === '/api/v1/semantic_layer/layer-1/views',
+    ).length;
+  let previousViewsFetches = -1;
+  await waitFor(
+    () => {
+      const current = viewsFetchCount();
+      const settled = current > 0 && current === previousViewsFetches;
+      previousViewsFetches = current;
+      if (!settled) {
+        throw new Error('views refetch still in flight');
+      }
+    },
+    { timeout: 15000, interval: 700 },
+  );
+
   await pickFromSelect(/semantic views/i, 'orders');
   await userEvent.click(
     screen.getByRole('button', { name: /add 1 view\(s\)/i }),

Reply via email to