bito-code-review[bot] commented on code in PR #38792:
URL: https://github.com/apache/superset/pull/38792#discussion_r2991381099
##########
superset-frontend/src/explore/components/controls/DateFilterControl/tests/CustomFrame.test.tsx:
##########
@@ -188,14 +188,32 @@ test('triggers onChange when the mode changes', async ()
=> {
store,
});
await waitForElementToBeRemoved(() => screen.queryByLabelText('Loading'));
- userEvent.click(screen.getByTitle('Midnight'));
- expect(await screen.findByTitle('Relative Date/Time')).toBeInTheDocument();
- userEvent.click(screen.getByTitle('Relative Date/Time'));
- userEvent.click(screen.getAllByTitle('Now')[1]);
+
+ const midnightOptions = await screen.findAllByTitle('Midnight');
+ userEvent.click(midnightOptions[0]);
+
+ const relativeOptions = await screen.findAllByTitle('Relative Date/Time');
+ userEvent.click(relativeOptions[0]);
+
+ const nowOptions = await screen.findAllByTitle('Now');
+ userEvent.click(nowOptions[0]);
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Incorrect test element selection</b></div>
<div id="fix">
The test originally clicked the second 'Now' element (index [1]), targeting
the 'until' mode's 'Now' option, which doesn't trigger a change since until is
already 'now'. Clicking the first 'Now' element (index [0]) targets the 'since'
mode's 'Now' option, changing since from 'relative' to 'now' and triggering an
extra onChange call. This alters the test's expected behavior and may cause it
to fail the assertion of exactly 2 calls.
</div>
<details>
<summary>
<b>Code suggestion</b>
</summary>
<blockquote>Check the AI-generated fix before applying</blockquote>
<div id="code">
````suggestion
userEvent.click(nowOptions[1]);
````
</div>
</details>
</div>
<small><i>Code Review Run #a10cc0</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]