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

(superset) 01/01: fix(tests): resolve flakey SouthPane extension test caused by nwsapi

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

jli pushed a commit to branch fix-flakey-extension-tests
in repository https://gitbox.apache.org/repos/asf/superset.git

commit bf6940a7e9747e396dc22277678967e8abe0154f
Author: Joe Li <jo...@preset.io>
AuthorDate: Tue Mar 24 15:28:46 2026 -0700

    fix(tests): resolve flakey SouthPane extension test caused by nwsapi
    
    getByRole('button') triggers dom-accessibility-api to compute accessible
    names, which traverses the DOM and encounters antd Tabs' :focus-visible
    CSS selector that jsdom's nwsapi cannot parse, causing a SyntaxError.
    Switch to getByLabelText() which queries aria-label directly without
    triggering CSS selector evaluation. Also remove debug console.log.
    
    Co-Authored-By: Claude Opus 4.6 <no...@anthropic.com>
---
 .../src/SqlLab/components/SouthPane/SouthPane.test.tsx        | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/superset-frontend/src/SqlLab/components/SouthPane/SouthPane.test.tsx b/superset-frontend/src/SqlLab/components/SouthPane/SouthPane.test.tsx
index 02de9e44b82..42b15dfa8c0 100644
--- a/superset-frontend/src/SqlLab/components/SouthPane/SouthPane.test.tsx
+++ b/superset-frontend/src/SqlLab/components/SouthPane/SouthPane.test.tsx
@@ -172,8 +172,6 @@ test('should remove tab', async () => {
   const totalTabs = mockState.sqlLab.tables.length + 2;
   expect(tabs).toHaveLength(totalTabs);
 
-  console.log(tabs[2].parentElement?.innerHTML); // debug
-
   const removeButton = tabs[2].parentElement?.querySelector(
     'button[aria-label="remove"]',
   );
@@ -226,9 +224,7 @@ test('renders slot-wide toolbar actions via PanelToolbar', () => {
     initialState: mockState,
   });
 
-  expect(
-    screen.getByRole('button', { name: 'Panels Action' }),
-  ).toBeInTheDocument();
+  expect(screen.getByLabelText('Panels Action')).toBeInTheDocument();
 });
 
 test('renders per-view toolbar actions for contributed tab', () => {
@@ -251,8 +247,5 @@ test('renders per-view toolbar actions for contributed tab', () => {
   });
 
   // Content is rendered via forceRender: true even when tab is not active.
-  // Use { hidden: true } to find button in non-active tab pane.
-  expect(
-    screen.getByRole('button', { name: 'Per-View Action', hidden: true }),
-  ).toBeInTheDocument();
+  expect(screen.getByLabelText('Per-View Action')).toBeInTheDocument();
 });