rusackas opened a new pull request, #40036:
URL: https://github.com/apache/superset/pull/40036

   ### SUMMARY
   
   The two \`template_params\` overwrite tests in \`SaveDatasetModal.test.tsx\` 
(added in #39501) were flaky on CI. The stack pointed at 
\`setupOverwriteFlow()\` line:
   
   \`\`\`ts
   userEvent.click(screen.getAllByText('coolest table 0')[1]);
   \`\`\`
   
   That \`getAllByText\` lookup happens immediately after the AsyncSelect is 
opened, before the debounced fetch behind \`loadDatasetOverwriteOptions\` 
(which calls \`SupersetClient.get\` inside \`SaveDatasetModal/index.tsx\`) has 
resolved and the listbox has rendered. The same file already has earlier 
passing tests that use the correct async pattern; \`setupOverwriteFlow()\` just 
wasn't following it.
   
   This PR realigns the helper to match the existing async-safe pattern used 
elsewhere in the file:
   
   - \`await\` every \`userEvent.click\` (including the previously-unawaited 
\`checkbox\` click in the "include template parameters checked" test)
   - after opening the combobox, flush debounced fetches with \`await act(async 
() => { jest.runAllTimers(); })\`
   - wait for the \`Loading...\` indicator to clear using the same defensive 
\`null || !checkVisibility()\` check used by the other tests
   - replace the immediate \`getAllByText\` lookup with \`await 
screen.findAllByText('coolest table 0')\` — wait-based, retries until the 
listbox renders
   
   The test intent is unchanged: select an existing dataset, click overwrite 
once to reach the confirmation screen, wait for the confirmation text, then 
click overwrite again to trigger the PUT.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   N/A — test-only change.
   
   ### TESTING INSTRUCTIONS
   
   \`\`\`bash
   cd superset-frontend
   npx jest src/SqlLab/components/SaveDatasetModal/SaveDatasetModal.test.tsx
   \`\`\`
   
   The two overwrite/template-parameter tests should pass reliably:
   - \`sends template_params when overwriting a dataset with include template 
parameters checked\`
   - \`does not send template_params when overwriting a dataset with include 
template parameters unchecked\`
   
   No production code is touched — only \`SaveDatasetModal.test.tsx\`.
   
   ### ADDITIONAL INFORMATION
   
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API


-- 
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