You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by ms...@apache.org on 2026/07/01 16:34:54 UTC

(superset) branch master updated: test(sqllab): repair broken TablePreview and SavedQueryList jest tests (#41628)

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

msyavuz 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 438d4d569f8 test(sqllab): repair broken TablePreview and SavedQueryList jest tests (#41628)
438d4d569f8 is described below

commit 438d4d569f84de3fab5442da886973dcf13b0913
Author: Mehmet Salih Yavuz <sa...@proton.me>
AuthorDate: Wed Jul 1 19:34:48 2026 +0300

    test(sqllab): repair broken TablePreview and SavedQueryList jest tests (#41628)
---
 .../src/SqlLab/components/TablePreview/TablePreview.test.tsx        | 6 ++++--
 superset-frontend/src/pages/SavedQueryList/SavedQueryList.test.tsx  | 6 +++---
 superset-frontend/src/pages/SavedQueryList/index.tsx                | 1 +
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/superset-frontend/src/SqlLab/components/TablePreview/TablePreview.test.tsx b/superset-frontend/src/SqlLab/components/TablePreview/TablePreview.test.tsx
index 28e36060e6c..07787441f68 100644
--- a/superset-frontend/src/SqlLab/components/TablePreview/TablePreview.test.tsx
+++ b/superset-frontend/src/SqlLab/components/TablePreview/TablePreview.test.tsx
@@ -151,7 +151,7 @@ describe('table actions', () => {
         fetchMock.callHistory.calls(getTableMetadataEndpoint),
       ).toHaveLength(1),
     );
-    const refreshButton = getByRole('button', { name: 'sync' });
+    const refreshButton = getByRole('button', { name: 'Refresh table schema' });
     fireEvent.click(refreshButton);
     await waitFor(() =>
       expect(
@@ -170,7 +170,9 @@ describe('table actions', () => {
         fetchMock.callHistory.calls(getTableMetadataEndpoint),
       ).toHaveLength(1),
     );
-    const viewButton = getByRole('button', { name: 'eye' });
+    const viewButton = getByRole('button', {
+      name: 'Show CREATE VIEW statement',
+    });
     fireEvent.click(viewButton);
     await waitFor(() =>
       expect(
diff --git a/superset-frontend/src/pages/SavedQueryList/SavedQueryList.test.tsx b/superset-frontend/src/pages/SavedQueryList/SavedQueryList.test.tsx
index 9fcb399e7e2..192062f2998 100644
--- a/superset-frontend/src/pages/SavedQueryList/SavedQueryList.test.tsx
+++ b/superset-frontend/src/pages/SavedQueryList/SavedQueryList.test.tsx
@@ -270,9 +270,9 @@ describe('SavedQueryList', () => {
 
       await screen.findByTestId('saved_query-list-view');
 
-      const queryButton = await screen.findByRole('button', {
-        name: /query/i,
-      });
+      // Scope to the create button's stable data-test: /query/i also matches the
+      // per-row "Query preview" and "Copy query URL" action buttons.
+      const queryButton = await screen.findByTestId('add-saved-query-button');
       fireEvent.click(queryButton);
 
       await waitFor(() => {
diff --git a/superset-frontend/src/pages/SavedQueryList/index.tsx b/superset-frontend/src/pages/SavedQueryList/index.tsx
index dd72c2de4c1..92dde1d21bd 100644
--- a/superset-frontend/src/pages/SavedQueryList/index.tsx
+++ b/superset-frontend/src/pages/SavedQueryList/index.tsx
@@ -232,6 +232,7 @@ function SavedQueryList({
     icon: <Icons.PlusOutlined iconSize="m" />,
     name: t('Query'),
     buttonStyle: 'primary',
+    'data-test': 'add-saved-query-button',
     onClick: () => {
       // React Router's basename already includes the application root; passing
       // a relative path ensures correct navigation under subdirectory deployments.