mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Tempo: Add waitFor in flaky test (#86277)
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import { render, screen, waitFor } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import React from 'react';
|
||||
|
||||
@@ -56,6 +56,12 @@ describe('TempoVariableQueryEditor', () => {
|
||||
render(<TempoVariableQueryEditor {...props} onChange={onChange} />);
|
||||
|
||||
await selectOptionInTest(screen.getByLabelText('Query type'), 'Label values');
|
||||
await userEvent.click(document.body);
|
||||
|
||||
// The Label field is rendered only after the query type has been selected.
|
||||
// We wait for it to be displayed to avoid flakyness.
|
||||
await waitFor(() => expect(screen.getByLabelText('Label')).toBeInTheDocument());
|
||||
|
||||
await selectOptionInTest(screen.getByLabelText('Label'), 'luna');
|
||||
await userEvent.click(document.body);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user