diff --git a/public/app/plugins/datasource/cloudwatch/components/QueryEditor/QueryEditor.test.tsx b/public/app/plugins/datasource/cloudwatch/components/QueryEditor/QueryEditor.test.tsx index 47c4633df65..a8432ce42d4 100644 --- a/public/app/plugins/datasource/cloudwatch/components/QueryEditor/QueryEditor.test.tsx +++ b/public/app/plugins/datasource/cloudwatch/components/QueryEditor/QueryEditor.test.tsx @@ -1,4 +1,4 @@ -import { render, screen, waitFor } from '@testing-library/react'; +import { act, render, screen, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { selectOptionInTest } from 'test/helpers/selectOptionInTest'; @@ -347,7 +347,9 @@ describe('QueryEditor should render right editor', () => { it('should have an account selector when the feature is enabled', async () => { config.featureToggles.cloudWatchCrossAccountQuerying = true; props.datasource.resources.getAccounts = jest.fn().mockResolvedValue(['account123']); - render(); + // TODO investigate why we need act + // see https://github.com/testing-library/react-testing-library/issues/1375 + await act(async () => render()); await screen.findByText('Metric Insights'); expect(await screen.findByText('Account')).toBeInTheDocument(); });