mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Upgrade @testing-library/user-event to v14 (#47898)
* Update dependency @testing-library/user-event to v14
* everything is async...
* everything is async pt.2
* Fix cascader tests
* hack the yarn.lock file to remove the old version of @testing-library/dom
* some more fixes!
* MOAR FIXES
* more fixes
* remove a bunch of places where we're wrapping in act()
* down to 7 failing tests...
* Fix arrow tests
* Fix rest of NavBarItem tests
* Fix last tests
* Use {Enter} instead of {enter}
* Revert "Use {Enter} instead of {enter}"
This reverts commit e72453bb52.
* remove some unused act imports
* Fix LibraryPanelsSearch tests
* more stable test
* More consistent test...
Co-authored-by: Renovate Bot <bot@renovateapp.com>
This commit is contained in:
@@ -74,7 +74,7 @@ describe('RawInfluxQLEditor', () => {
|
||||
// value before
|
||||
expect(queryTextarea).toHaveValue('test query 1');
|
||||
|
||||
userEvent.type(queryTextarea, 'new changes');
|
||||
await userEvent.type(queryTextarea, 'new changes');
|
||||
|
||||
// the field should have a new value, but no onChange yet.
|
||||
expect(queryTextarea).toHaveValue('test query 1new changes');
|
||||
@@ -97,7 +97,7 @@ describe('RawInfluxQLEditor', () => {
|
||||
// value before
|
||||
expect(aliasInput).toHaveValue('alias42');
|
||||
|
||||
userEvent.type(aliasInput, 'new changes');
|
||||
await userEvent.type(aliasInput, 'new changes');
|
||||
|
||||
// the field should have a new value, but no onChange yet.
|
||||
expect(aliasInput).toHaveValue('alias42new changes');
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import React from 'react';
|
||||
import { InfluxQuery } from '../../types';
|
||||
import InfluxDatasource from '../../datasource';
|
||||
import { render, screen, act } from '@testing-library/react';
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import { Editor } from './Editor';
|
||||
import * as mockedMeta from '../../influxQLMetadataQuery';
|
||||
@@ -95,9 +95,7 @@ describe('InfluxDB InfluxQL Visual Editor field-filtering', () => {
|
||||
expect(mockedMeta.getTagKeysForMeasurementAndTags).toHaveBeenCalledTimes(1);
|
||||
|
||||
// we click the WHERE/cpu button
|
||||
await act(async () => {
|
||||
userEvent.click(screen.getByRole('button', { name: 'cpu' }));
|
||||
});
|
||||
await userEvent.click(screen.getByRole('button', { name: 'cpu' }));
|
||||
|
||||
// and verify getTagKeysForMeasurementAndTags was called again,
|
||||
// and in the tags-param we did not receive the `field1` part.
|
||||
@@ -105,18 +103,14 @@ describe('InfluxDB InfluxQL Visual Editor field-filtering', () => {
|
||||
expect((mockedMeta.getTagKeysForMeasurementAndTags as jest.Mock).mock.calls[1][2]).toStrictEqual(ONLY_TAGS);
|
||||
|
||||
// now we click on the WHERE/host2 button
|
||||
await act(async () => {
|
||||
userEvent.click(screen.getByRole('button', { name: 'host2' }));
|
||||
});
|
||||
await userEvent.click(screen.getByRole('button', { name: 'host2' }));
|
||||
|
||||
// verify `getTagValues` was called once, and in the tags-param we did not receive `field1`
|
||||
expect(mockedMeta.getTagValues).toHaveBeenCalledTimes(1);
|
||||
expect((mockedMeta.getTagValues as jest.Mock).mock.calls[0][3]).toStrictEqual(ONLY_TAGS);
|
||||
|
||||
// now we click on the FROM/cpudata button
|
||||
await act(async () => {
|
||||
userEvent.click(screen.getByRole('button', { name: 'cpudata' }));
|
||||
});
|
||||
await userEvent.click(screen.getByRole('button', { name: 'cpudata' }));
|
||||
|
||||
// verify `getTagValues` was called once, and in the tags-param we did not receive `field1`
|
||||
expect(mockedMeta.getAllMeasurementsForTags).toHaveBeenCalledTimes(1);
|
||||
|
||||
Reference in New Issue
Block a user