bito-code-review[bot] commented on code in PR #41338:
URL: https://github.com/apache/superset/pull/41338#discussion_r3481093098
##########
superset-frontend/src/features/alerts/AlertReportModal.test.tsx:
##########
@@ -387,9 +389,33 @@ const comboboxSelect = async (
newElementQuery: Function,
) => {
expect(element).toBeInTheDocument();
- userEvent.type(element, `${value}{enter}`);
- const newElement = newElementQuery();
- expect(newElement).toBeInTheDocument();
+ await userEvent.type(element, `${value}{enter}`);
+ await waitFor(() => {
+ expect(newElementQuery()).toBeInTheDocument();
+ });
+};
+
+const addAsyncSelectValue = async (selectName: RegExp, value: string) => {
+ const select = await screen.findByRole('combobox', { name: selectName });
+ await userEvent.click(select);
+ fireEvent.paste(select, {
+ clipboardData: {
+ getData: () => value,
+ },
+ });
+ await waitFor(() => {
+ expect(
+ fetchMock.callHistory.calls(reportOwnersEndpoint).length,
+ ).toBeGreaterThan(0);
+ });
+};
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Hardcoded endpoint causes test hang</b></div>
<div id="fix">
Update `addAsyncSelectValue` to take an `endpoint` parameter instead of
hardcoding `reportOwnersEndpoint`, and pass `reportOwnersEndpoint` or
`ownersEndpoint` at each call site depending on test mode.
</div>
</div>
<small><i>Code Review Run #307bc3</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]