bito-code-review[bot] commented on code in PR #36486:
URL: https://github.com/apache/superset/pull/36486#discussion_r2644298754
##########
superset-frontend/packages/superset-ui-core/src/components/TimezoneSelector/TimezoneSelector.DaylightSavingTime.test.tsx:
##########
@@ -46,12 +47,15 @@ test('render timezones in correct order for daylight saving
time', async () => {
/>,
);
+ // Wait for loading to complete by waiting for expected timezone text
+ await screen.findByText('GMT -04:00 (Eastern Daylight Time)');
+
const searchInput = screen.getByRole('combobox');
await userEvent.click(searchInput);
- const options = await waitFor(() =>
- document.querySelectorAll('.ant-select-item-option-content'),
- );
+ // Wait for options to appear by finding one of the expected timezone texts
+ await screen.findByText('GMT -11:00 (Pacific/Midway)');
+ const options = document.querySelectorAll('.ant-select-item-option-content');
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Fix async test waiting</b></div>
<div id="fix">
The old waitFor(() => document.querySelectorAll(...)) was incorrect—it
didn't assert or throw on failure, so it wouldn't actually wait for options to
load, potentially making the test flaky. The new approach uses findByText to
properly wait for async DOM updates, aligning with React Testing Library best
practices.
</div>
</div>
<details>
<summary><b>Citations</b></summary>
<ul>
<li>
Rule Violated: <a
href="https://github.com/apache/superset/blob/a9ff796/.cursor/rules/dev-standard.mdc#L38">dev-standard.mdc:38</a>
</li>
<li>
Rule Violated: <a
href="https://github.com/apache/superset/blob/a9ff796/AGENTS.md#L21">AGENTS.md:21</a>
</li>
</ul>
</details>
<small><i>Code Review Run #420f57</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a
href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
--
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]