mirror of
https://github.com/grafana/grafana.git
synced 2024-11-21 16:38:03 -06:00
Loki: Fix failing test waiting for Loading...
copy (#83547)
fix monaco tests
This commit is contained in:
parent
de75813d8d
commit
d8b7992c0c
@ -1,4 +1,4 @@
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import { render, screen, waitFor } from '@testing-library/react';
|
||||
import React, { ComponentProps } from 'react';
|
||||
|
||||
import { dateTime } from '@grafana/data';
|
||||
@ -33,7 +33,9 @@ describe('LokiQueryField', () => {
|
||||
it('refreshes metrics when time range changes over 1 minute', async () => {
|
||||
const { rerender } = render(<LokiQueryField {...props} />);
|
||||
|
||||
expect(await screen.findByText('Loading...')).toBeInTheDocument();
|
||||
await waitFor(async () => {
|
||||
expect(await screen.findByText('Loading...')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
expect(props.datasource.languageProvider.fetchLabels).not.toHaveBeenCalled();
|
||||
|
||||
@ -55,7 +57,9 @@ describe('LokiQueryField', () => {
|
||||
it('does not refreshes metrics when time range change by less than 1 minute', async () => {
|
||||
const { rerender } = render(<LokiQueryField {...props} />);
|
||||
|
||||
expect(await screen.findByText('Loading...')).toBeInTheDocument();
|
||||
await waitFor(async () => {
|
||||
expect(await screen.findByText('Loading...')).toBeInTheDocument();
|
||||
});
|
||||
|
||||
expect(props.datasource.languageProvider.fetchLabels).not.toHaveBeenCalled();
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import { render, screen, waitFor } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
|
||||
import { createLokiDatasource } from '../../__mocks__/datasource';
|
||||
@ -24,6 +24,8 @@ describe('MonacoFieldWrapper', () => {
|
||||
test('Renders with no errors', async () => {
|
||||
renderComponent();
|
||||
|
||||
expect(await screen.findByText('Loading...')).toBeInTheDocument();
|
||||
await waitFor(async () => {
|
||||
expect(await screen.findByText('Loading...')).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user