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:
Ashley Harrison
2022-04-21 13:15:21 +01:00
committed by GitHub
parent 9ed7e48454
commit d832bde270
89 changed files with 900 additions and 912 deletions

View File

@@ -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');

View File

@@ -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);