mirror of
https://github.com/apache/superset.git
synced 2026-05-07 17:04:58 +00:00
test(DatasourceControl): await userEvent.click to deflake Edit dataset test
userEvent.click is asynchronous in @testing-library/user-event v14+; unawaited calls left the downstream getByTestId assertion to race the modal render. Awaits both clicks in the Edit-dataset test so the modal is guaranteed open before the assertion runs. Addresses codeant-ai review on PR #39461.
This commit is contained in:
@@ -283,10 +283,10 @@ test('Click on Edit dataset', async () => {
|
||||
useRedux: true,
|
||||
useRouter: true,
|
||||
});
|
||||
userEvent.click(screen.getByTestId('datasource-menu-trigger'));
|
||||
await userEvent.click(screen.getByTestId('datasource-menu-trigger'));
|
||||
|
||||
await act(async () => {
|
||||
userEvent.click(screen.getByText('Edit dataset'));
|
||||
await userEvent.click(screen.getByText('Edit dataset'));
|
||||
});
|
||||
|
||||
expect(screen.getByTestId('mock-datasource-editor')).toBeInTheDocument();
|
||||
|
||||
Reference in New Issue
Block a user