SEPURI-SAI-KRISHNA opened a new issue, #44798:
URL: https://github.com/apache/superset/issues/44798

   ### Bug description
   
   #43512 bumped `@testing-library/user-event` from 12.8.3 to 14.6.5, which 
made every `userEvent` API asynchronous. #44315, #44323 and #44335 awaited the 
calls that only needed a mechanical `await`, but deliberately left seven call 
sites alone because awaiting them in place would not have been correct. Those 
seven are still un-awaited on master, and each one means the interaction is not 
dispatched before the code that depends on it runs.
   
   **1. `src/components/RowCountLabel/RowCountLabel.test.tsx` — 4 sites.** Four 
synchronous tests hover and then immediately assert:
   
   ```tsx
   test('RowCountLabel renders singular result', () => {
     render(<RowCountLabel rowcount={1} limit={100} />);
     ...
     userEvent.hover(screen.getByText(expectedText));
     expect(screen.queryByRole('tooltip')).not.toBeInTheDocument();
   });
   ```
   
   Under v14 the assertion runs before the hover is dispatched, so it cannot 
observe the hover's effect at all — it would pass identically with the hover 
deleted. (The assertion's expectation is still correct: `RowCountLabel` only 
renders a `Tooltip` when `limitReached`, which is false in these four cases. 
The problem is that the hover is not exercised.)
   
   **2. `src/pages/Home/Home.test.tsx` and 
`src/features/datasets/AddDataset/Footer/Footer.test.tsx` — 1 site each.** Both 
put an un-awaited click inside a `waitFor` callback:
   
   ```tsx
   await waitFor(() => {
     const datasetOnlyOption = screen.getByText('Create dataset');
     userEvent.click(datasetOnlyOption);
   });
   ```
   
   `waitFor` retries its callback, so the click is both fire-and-forget and 
potentially dispatched more than once.
   
   **3. `src/SqlLab/components/SqlEditorTabHeader/SqlEditorTabHeader.test.tsx` 
— 1 site, 12 callers.** A synchronous helper opens the dropdown every test 
relies on:
   
   ```tsx
   const openTabDropdown = () => {
     const store = mockStore(initialState);
     const { getByTestId } = setup(defaultQueryEditor, store);
     userEvent.click(getByTestId('dropdown-trigger'));
     return store;
   };
   ```
   
   Every one of its 12 callers therefore starts asserting against a dropdown 
whose opening click has not been dispatched.
   
   None of these is currently failing CI, unlike #44314, #44322 and #44334 — 
but each is the same latent race those three turned out to be, and the 
`RowCountLabel` assertions currently verify nothing.
   
   ### Screenshots/recordings
   
   _No response_
   
   ### Superset version
   
   master / latest-dev
   
   ### Python version
   
   N/A (frontend tests)
   
   ### Node version
   
   18 or greater (CI: 24.16.0)
   
   ### Browser
   
   Not applicable
   
   ### Additional context
   
   Each case needs a different fix rather than a blanket `await`: the 
`RowCountLabel` tests must become `async`, the two `waitFor` callbacks need the 
click lifted out, and the SQL Lab helper has to become `async` with all 12 call 
sites awaiting it. That is why they were separated from the mechanical sweep in 
#44335.
   
   ### Checklist
   
   - [x] I have searched Superset docs and Slack and didn't find a solution to 
my problem.
   - [x] I have searched the GitHub issue tracker and didn't find a similar bug 
report.
   - [x] I have checked Superset's logs for errors and if I found a relevant 
Python stacktrace, I included it here as text in the "additional context" 
section.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to