[testing] replace testing-library/dom package with testing-library/react (#170594)

## Summary

Removes `testing-library/dom` from dependencies. As all the utilities
from`dom` are available already in `testing-library/react`, there's no
need to have both `dom` and `react` libraries available in our
package.json.

Following the [@testing-library/react
documentation:](https://testing-library.com/docs/react-testing-library/intro)

> [React Testing
Library](https://github.com/testing-library/react-testing-library)
builds on top of DOM Testing Library by adding APIs for working with
React components.

Let's just import everything from `testing-library/react`, this way we
won't need to worry about inconsistencies between `testing-library/dom`
we have in our `package.json` and the one that is
`testing-library/react` dependency.
This commit is contained in:
Marta Bondyra 2023-11-08 15:53:48 +01:00 committed by GitHub
parent c72d4d3372
commit 3a784106df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
97 changed files with 108 additions and 130 deletions

View file

@ -1276,7 +1276,6 @@
"@storybook/react-docgen-typescript-plugin": "^1.0.1",
"@storybook/testing-react": "^1.3.0",
"@storybook/theming": "^6.5.16",
"@testing-library/dom": "^8.19.0",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^12.1.5",
"@testing-library/react-hooks": "^8.0.1",

View file

@ -13,8 +13,8 @@ import {
EuiDataGridRefProps,
type EuiDataGridColumnCellAction,
} from '@elastic/eui';
import { render, waitFor } from '@testing-library/react';
import { act, renderHook } from '@testing-library/react-hooks';
import { render, waitFor, act } from '@testing-library/react';
import { renderHook } from '@testing-library/react-hooks';
import { makeAction } from '../mocks/helpers';
import {
useDataGridColumnsCellActions,

View file

@ -24,7 +24,7 @@ jest.mock('@elastic/eui', () => ({
}));
import * as eui from '@elastic/eui';
import { waitFor } from '@testing-library/dom';
import { waitFor } from '@testing-library/react';
import { ResizableLayoutDirection } from '../types';
describe('Panels resizable', () => {

View file

@ -5,7 +5,7 @@
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { waitFor } from '@testing-library/dom';
import { waitFor } from '@testing-library/react';
import { act, renderHook } from '@testing-library/react-hooks';
import { useExceptionListHeader } from './use_list_header';

View file

@ -7,7 +7,7 @@
*/
import React from 'react';
import { waitFor } from '@testing-library/dom';
import { waitFor } from '@testing-library/react';
import { render } from '@testing-library/react';
import { renderHook } from '@testing-library/react-hooks';
import {

View file

@ -7,7 +7,7 @@
*/
import { createInteractionPositionTracker } from './open_context_menu';
import { fireEvent } from '@testing-library/dom';
import { fireEvent } from '@testing-library/react';
let targetEl: Element;
const top = 100;

View file

@ -10,7 +10,7 @@ import { ActionDefinition } from '../actions';
import { openContextMenu } from '../context_menu';
import { uiActionsPluginMock } from '../mocks';
import type { Trigger } from '@kbn/ui-actions-browser';
import { waitFor } from '@testing-library/dom';
import { waitFor } from '@testing-library/react';
jest.mock('../context_menu');

View file

@ -15,7 +15,7 @@ import { renderHook } from '@testing-library/react-hooks';
import { dataPluginMock } from '@kbn/data-plugin/public/mocks';
import { searchSourceInstanceMock } from '@kbn/data-plugin/common/search/search_source/mocks';
import { of, Subject, throwError } from 'rxjs';
import { waitFor } from '@testing-library/dom';
import { waitFor } from '@testing-library/react';
import { RequestAdapter } from '@kbn/inspector-plugin/common';
import { DataViewType, SearchSourceSearchOptions } from '@kbn/data-plugin/common';
import { expressionsPluginMock } from '@kbn/expressions-plugin/public/mocks';

View file

@ -15,8 +15,7 @@ import {
import React from 'react';
import { I18nProvider } from '@kbn/i18n-react';
import { mount } from 'enzyme';
import { waitFor } from '@testing-library/dom';
import { render } from '@testing-library/react';
import { waitFor, render } from '@testing-library/react';
import { EuiTextArea, EuiIcon } from '@elastic/eui';

View file

@ -7,7 +7,7 @@
import { useGetAppUrl, useNavigateTo } from './navigation';
import { mockGetUrlForApp, mockNavigateToApp, mockNavigateToUrl } from '../mocks/context';
import { renderHook } from '@testing-library/react-hooks';
import { fireEvent } from '@testing-library/dom';
import { fireEvent } from '@testing-library/react';
jest.mock('./context');

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { act, renderHook } from '@testing-library/react-hooks/dom';
import { waitFor } from '@testing-library/dom';
import { waitFor } from '@testing-library/react';
import { MaintenanceWindow } from '../pages/maintenance_windows/types';
import { AppMockRenderer, createAppMockRenderer } from '../lib/test_utils';

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { act, renderHook } from '@testing-library/react-hooks/dom';
import { waitFor } from '@testing-library/dom';
import { waitFor } from '@testing-library/react';
import { MaintenanceWindow } from '../pages/maintenance_windows/types';
import { AppMockRenderer, createAppMockRenderer } from '../lib/test_utils';

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { renderHook } from '@testing-library/react-hooks/dom';
import { waitFor } from '@testing-library/dom';
import { waitFor } from '@testing-library/react';
import { AppMockRenderer, createAppMockRenderer } from '../lib/test_utils';
import { useFindMaintenanceWindows } from './use_find_maintenance_windows';

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { act, renderHook } from '@testing-library/react-hooks/dom';
import { waitFor } from '@testing-library/dom';
import { waitFor } from '@testing-library/react';
import { MaintenanceWindow } from '../pages/maintenance_windows/types';
import { AppMockRenderer, createAppMockRenderer } from '../lib/test_utils';

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { act, renderHook } from '@testing-library/react-hooks/dom';
import { waitFor } from '@testing-library/dom';
import { waitFor } from '@testing-library/react';
import { MaintenanceWindow } from '../pages/maintenance_windows/types';
import { AppMockRenderer, createAppMockRenderer } from '../lib/test_utils';

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { renderHook } from '@testing-library/react-hooks/dom';
import { waitFor } from '@testing-library/dom';
import { waitFor } from '@testing-library/react';
import { AppMockRenderer, createAppMockRenderer } from '../lib/test_utils';
import { useGetMaintenanceWindow } from './use_get_maintenance_window';

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { act, renderHook } from '@testing-library/react-hooks/dom';
import { waitFor } from '@testing-library/dom';
import { waitFor } from '@testing-library/react';
import { MaintenanceWindow } from '../pages/maintenance_windows/types';
import { AppMockRenderer, createAppMockRenderer } from '../lib/test_utils';

View file

@ -6,7 +6,7 @@
*/
import { Query } from '@elastic/eui';
import { fireEvent } from '@testing-library/dom';
import { fireEvent } from '@testing-library/react';
import React from 'react';
import { AppMockRenderer, createAppMockRenderer } from '../../../lib/test_utils';

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { fireEvent } from '@testing-library/dom';
import { fireEvent } from '@testing-library/react';
import React from 'react';
import { AppMockRenderer, createAppMockRenderer } from '../../../lib/test_utils';

View file

@ -11,6 +11,7 @@ import React from 'react';
import { MemoryRouter } from 'react-router-dom';
import { ThemeProvider } from 'styled-components';
import { render as reactRender } from '@testing-library/react';
import type { RenderOptions, RenderResult } from '@testing-library/react';
import type { ILicense } from '@kbn/licensing-plugin/public';
import type { ScopedFilesClient } from '@kbn/files-plugin/public';
@ -20,7 +21,6 @@ import { I18nProvider } from '@kbn/i18n-react';
import { createMockFilesClient } from '@kbn/shared-ux-file-mocks';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { render as reactRender } from '@testing-library/react';
import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public';
import { FilesContext } from '@kbn/shared-ux-file-context';

View file

@ -14,7 +14,7 @@ import { alertComment, basicComment, mockCase } from '../containers/mock';
import React from 'react';
import userEvent from '@testing-library/user-event';
import type { SupportedCaseAttachment } from '../types';
import { getByTestId } from '@testing-library/dom';
import { getByTestId } from '@testing-library/react';
import { OWNER_INFO } from '../../common/constants';
jest.mock('./lib/kibana');

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { waitFor } from '@testing-library/dom';
import { waitFor } from '@testing-library/react';
import { act, renderHook } from '@testing-library/react-hooks';
import userEvent from '@testing-library/user-event';
import React from 'react';

View file

@ -10,7 +10,7 @@ import React from 'react';
import type { AppMockRenderer } from '../../common/mock';
import { createAppMockRenderer } from '../../common/mock';
import userEvent from '@testing-library/user-event';
import { waitFor } from '@testing-library/dom';
import { waitFor } from '@testing-library/react';
import { waitForEuiPopoverOpen } from '@elastic/eui/lib/test/rtl';
import { SeverityFilter } from './severity_filter';

View file

@ -6,7 +6,7 @@
*/
import userEvent from '@testing-library/user-event';
import { waitFor } from '@testing-library/dom';
import { waitFor } from '@testing-library/react';
import { renderHook } from '@testing-library/react-hooks/dom';
import { useActions } from './use_actions';

View file

@ -13,7 +13,7 @@ import { basicCase, basicPush } from '../../containers/mock';
import { Actions } from './actions';
import * as i18n from '../case_view/translations';
import * as api from '../../containers/api';
import { waitFor } from '@testing-library/dom';
import { waitFor } from '@testing-library/react';
jest.mock('../../containers/api');

View file

@ -6,7 +6,7 @@
*/
import React from 'react';
import { waitFor } from '@testing-library/dom';
import { waitFor } from '@testing-library/react';
import { OBSERVABILITY_OWNER } from '../../../../common/constants';
import { alertCommentWithIndices, basicCase } from '../../../containers/mock';
import type { AppMockRenderer } from '../../../common/mock';

View file

@ -30,7 +30,7 @@ import { useGetSupportedActionConnectors } from '../../containers/configure/use_
import type { AppMockRenderer } from '../../common/mock';
import { createAppMockRenderer } from '../../common/mock';
import CaseView from '.';
import { waitFor } from '@testing-library/dom';
import { waitFor } from '@testing-library/react';
import { useGetTags } from '../../containers/use_get_tags';
import { casesQueriesKeys } from '../../containers/constants';
import {

View file

@ -7,8 +7,7 @@
import React from 'react';
import { mount } from 'enzyme';
import { act, render, within, fireEvent } from '@testing-library/react';
import { waitFor } from '@testing-library/dom';
import { act, render, within, fireEvent, waitFor } from '@testing-library/react';
import { licensingMock } from '@kbn/licensing-plugin/public/mocks';
import { NONE_CONNECTOR_ID } from '../../../common/constants';

View file

@ -15,7 +15,7 @@ import { Severity } from './severity';
import type { FormProps } from './schema';
import { schema } from './schema';
import userEvent from '@testing-library/user-event';
import { waitFor } from '@testing-library/dom';
import { waitFor } from '@testing-library/react';
import { waitForEuiPopoverOpen } from '@elastic/eui/lib/test/rtl';
let globalForm: FormHook;

View file

@ -7,7 +7,7 @@
import React from 'react';
import userEvent from '@testing-library/user-event';
import { screen, waitFor } from '@testing-library/dom';
import { screen, waitFor } from '@testing-library/react';
import type { AppMockRenderer } from '../../common/mock';
import { createAppMockRenderer } from '../../common/mock';

View file

@ -6,7 +6,7 @@
*/
import React from 'react';
import { screen } from '@testing-library/dom';
import { screen } from '@testing-library/react';
import type { AppMockRenderer } from '../../common/mock';
import { createAppMockRenderer } from '../../common/mock';

View file

@ -24,7 +24,7 @@ import {
mockTimeRange,
} from './mocks';
import { useKibana } from '../../../common/lib/kibana';
import { waitFor } from '@testing-library/dom';
import { waitFor } from '@testing-library/react';
import { canUseCases } from '../../../client/helpers/can_use_cases';
import { getCaseOwnerByAppId } from '../../../../common/utils/owner';

View file

@ -8,7 +8,7 @@
import { LENS_EMBEDDABLE_TYPE, type Embeddable as LensEmbeddable } from '@kbn/lens-plugin/public';
import { ErrorEmbeddable } from '@kbn/embeddable-plugin/public';
import type { Action } from '@kbn/ui-actions-plugin/public';
import { waitFor } from '@testing-library/dom';
import { waitFor } from '@testing-library/react';
import { createAddToNewCaseLensAction } from './add_to_new_case';
import type { ActionContext } from './types';

View file

@ -8,7 +8,7 @@
import { renderHook } from '@testing-library/react-hooks';
import { useGetCaseConfiguration } from './use_get_case_configuration';
import * as api from './api';
import { waitFor } from '@testing-library/dom';
import { waitFor } from '@testing-library/react';
import { useToasts } from '../../common/lib/kibana';
import type { AppMockRenderer } from '../../common/mock';
import { createAppMockRenderer } from '../../common/mock';

View file

@ -8,7 +8,7 @@
import { renderHook } from '@testing-library/react-hooks';
import { useGetCase } from './use_get_case';
import * as api from './api';
import { waitFor } from '@testing-library/dom';
import { waitFor } from '@testing-library/react';
import React from 'react';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { useToasts } from '../common/lib/kibana';

View file

@ -6,7 +6,7 @@
*/
import { renderHook } from '@testing-library/react-hooks';
import { waitFor } from '@testing-library/dom';
import { waitFor } from '@testing-library/react';
import { useToasts } from '../common/lib/kibana';
import type { AppMockRenderer } from '../common/mock';
import { createAppMockRenderer } from '../common/mock';

View file

@ -6,7 +6,7 @@
*/
import { mockCases } from '../../../../mocks';
import { getByText } from '@testing-library/dom';
import { getByText } from '@testing-library/react';
import { assigneesTemplateRenderer } from './renderer';
import type { CaseSavedObjectTransformed } from '../../../../common/types/case';

View file

@ -6,7 +6,7 @@
*/
import { mockCases } from '../../../../mocks';
import { getByText } from '@testing-library/dom';
import { getByText } from '@testing-library/react';
import { assigneesTemplateRenderer } from './renderer';
import type { CaseSavedObjectTransformed } from '../../../../common/types/case';

View file

@ -6,13 +6,12 @@
*/
import React from 'react';
import { render } from '@testing-library/react';
import { render, screen } from '@testing-library/react';
import { expectIdsInDoc } from '../../../test/utils';
import { DASHBOARD_COUNTER_CARDS } from '../test_subjects';
import { SummarySection } from './summary_section';
import { mockDashboardData } from '../mock';
import { TestProvider } from '../../../test/test_provider';
import { screen } from '@testing-library/react';
import { KSPM_POLICY_TEMPLATE } from '../../../../common/constants';
describe('<CloudSummarySection />', () => {

View file

@ -13,7 +13,7 @@ import { engines } from '../../__mocks__/engines.mock';
import React from 'react';
import { waitFor } from '@testing-library/dom';
import { waitFor } from '@testing-library/react';
import { shallow } from 'enzyme';
import { EuiComboBox, EuiComboBoxOptionOption, EuiRadioGroup } from '@elastic/eui';

View file

@ -11,7 +11,7 @@ import { setMockActions, setMockValues } from '../../../__mocks__/kea_logic';
import React from 'react';
import { waitFor } from '@testing-library/dom';
import { waitFor } from '@testing-library/react';
import { shallow } from 'enzyme';
import { EuiComboBox, EuiComboBoxOptionOption, EuiRadioGroup } from '@elastic/eui';

View file

@ -6,7 +6,7 @@
*/
import { render } from '../../rtl_helpers';
import { fireEvent, screen } from '@testing-library/dom';
import { fireEvent, screen } from '@testing-library/react';
import React from 'react';
import { sampleAttribute } from '../../configurations/test_data/sample_attribute';
import * as pluginHook from '../../../../../hooks/use_plugin_context';

View file

@ -6,7 +6,7 @@
*/
import React from 'react';
import { screen } from '@testing-library/dom';
import { screen } from '@testing-library/react';
import { render, mockAppDataView } from './rtl_helpers';
import { ExploratoryView } from './exploratory_view';
import * as obsvDataViews from '../../../utils/observability_data_views/observability_data_views';

View file

@ -7,7 +7,7 @@
import React from 'react';
import { render, forNearestButton } from '../rtl_helpers';
import { fireEvent } from '@testing-library/dom';
import { fireEvent } from '@testing-library/react';
import { AddToCaseAction } from './add_to_case_action';
import * as useCaseHook from '../hooks/use_add_to_case';
import * as datePicker from '../components/date_range_picker';

View file

@ -6,7 +6,7 @@
*/
import React from 'react';
import { screen } from '@testing-library/dom';
import { screen } from '@testing-library/react';
import { render } from '../rtl_helpers';
import { ChartCreationInfo } from './chart_creation_info';

View file

@ -9,7 +9,7 @@ import { useAddToCase } from './use_add_to_case';
import React, { useEffect } from 'react';
import { render } from '../rtl_helpers';
import { EuiButton } from '@elastic/eui';
import { fireEvent } from '@testing-library/dom';
import { fireEvent } from '@testing-library/react';
import { act } from '@testing-library/react';
describe('useAddToCase', function () {

View file

@ -6,7 +6,7 @@
*/
import React from 'react';
import { screen, waitFor, fireEvent } from '@testing-library/dom';
import { screen, waitFor, fireEvent } from '@testing-library/react';
import { render } from '../rtl_helpers';
import { AddSeriesButton } from './add_series_button';
import { DEFAULT_TIME, ReportTypes } from '../configurations/constants';

View file

@ -6,7 +6,7 @@
*/
import React from 'react';
import { screen, waitFor, fireEvent } from '@testing-library/dom';
import { screen, waitFor, fireEvent } from '@testing-library/react';
import { render } from '../rtl_helpers';
import * as hooks from '../hooks/use_series_storage';
import { ViewActions } from './view_actions';

View file

@ -6,7 +6,7 @@
*/
import React from 'react';
import { fireEvent } from '@testing-library/dom';
import { fireEvent } from '@testing-library/react';
import { createFleetTestRendererMock } from '../../../../../../mock';
import type { Agent, AgentPolicy } from '../../../../types';

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { fireEvent, waitFor } from '@testing-library/dom';
import { fireEvent, waitFor } from '@testing-library/react';
import React from 'react';
import { createFleetTestRendererMock } from '../../../../../../mock';

View file

@ -6,7 +6,7 @@
*/
import React from 'react';
import { fireEvent } from '@testing-library/dom';
import { fireEvent } from '@testing-library/react';
import { createFleetTestRendererMock } from '../../../../../../mock';
import type { Agent, AgentPolicy } from '../../../../types';

View file

@ -10,7 +10,7 @@ import { AppContextTestRender, createAppRootMockRenderer } from '../../test';
import { GlobalFilter } from '../../types';
import { CountWidget, LOADING_TEST_ID, TOOLTIP_TEST_ID, VALUE_TEST_ID } from '.';
import { useFetchCountWidgetData } from './hooks';
import { fireEvent, waitFor } from '@testing-library/dom';
import { fireEvent, waitFor } from '@testing-library/react';
const TITLE = 'Count Widget Title';
const GLOBAL_FILTER: GlobalFilter = {

View file

@ -13,26 +13,14 @@ import { act } from 'react-dom/test-utils';
import { PreloadedState } from '@reduxjs/toolkit';
import { RenderOptions, render } from '@testing-library/react';
import { I18nProvider } from '@kbn/i18n-react';
// imported to prevent a type error from testing library https://github.com/testing-library/react-testing-library/issues/587
import * as ___ from '@testing-library/dom';
import { LensAppServices } from '../app_plugin/types';
import {
makeConfigureStore,
LensAppState,
LensState,
LensStoreDeps,
LensRootStore,
} from '../state_management';
import { makeConfigureStore, LensAppState, LensState, LensStoreDeps } from '../state_management';
import { getResolvedDateRange } from '../utils';
import { DatasourceMap, VisualizationMap } from '../types';
import { mockVisualizationMap } from './visualization_mock';
import { mockDatasourceMap } from './datasource_mock';
import { makeDefaultServices } from './services_mock';
// preventing a type error from testing library https://github.com/testing-library/react-testing-library/issues/587
export const unusedFn = () => ___;
export const mockStoreDeps = (deps?: {
lensServices?: LensAppServices;
datasourceMap?: DatasourceMap;
@ -85,7 +73,8 @@ export const renderWithReduxStore = (
preloadedState: {},
storeDeps: mockStoreDeps(),
}
): ReturnType<typeof render> & { store: LensRootStore } => {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
): any => {
const { store } = makeLensStore({ preloadedState, storeDeps });
const Wrapper: React.FC<{

View file

@ -25,7 +25,7 @@ import { useFindListsBySize } from '@kbn/securitysolution-list-hooks';
import type { FieldSpec } from '@kbn/data-plugin/common';
import { fields, getField } from '@kbn/data-plugin/common/mocks';
import { unifiedSearchPluginMock } from '@kbn/unified-search-plugin/public/mocks';
import { waitFor } from '@testing-library/dom';
import { waitFor } from '@testing-library/react';
import { ReactWrapper, mount } from 'enzyme';
import { getFoundListsBySizeSchemaMock } from '../../../../common/schemas/response/found_lists_by_size_schema.mock';

View file

@ -5,8 +5,7 @@
* 2.0.
*/
import { fireEvent, waitFor } from '@testing-library/dom';
import { cleanup } from '@testing-library/react';
import { fireEvent, waitFor, cleanup } from '@testing-library/react';
import { createBrowserHistory } from 'history';
import React from 'react';
import Router from 'react-router-dom';

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { waitFor } from '@testing-library/dom';
import { waitFor } from '@testing-library/react';
import { mount } from 'enzyme';
import type { ReactWrapper } from 'enzyme';
import React from 'react';

View file

@ -15,7 +15,7 @@ import { mockAnomalies } from '../mock';
import { TestProviders } from '../../../mock/test_providers';
import { useMountAppended } from '../../../utils/use_mount_appended';
import type { Anomalies } from '../types';
import { waitFor } from '@testing-library/dom';
import { waitFor } from '@testing-library/react';
jest.mock('../../../lib/kibana');

View file

@ -16,7 +16,7 @@ import { TestProviders } from '../../../mock/test_providers';
import { getEmptyValue } from '../../empty_value';
import type { Anomalies } from '../types';
import { useMountAppended } from '../../../utils/use_mount_appended';
import { waitFor } from '@testing-library/dom';
import { waitFor } from '@testing-library/react';
jest.mock('../../../lib/kibana');

View file

@ -11,7 +11,7 @@ import { mockAnomalies } from '../mock';
import { createDescriptionList } from './create_description_list';
import { EuiDescriptionList } from '@elastic/eui';
import type { Anomaly } from '../types';
import { waitFor } from '@testing-library/dom';
import { waitFor } from '@testing-library/react';
jest.mock('../../../lib/kibana');

View file

@ -10,8 +10,7 @@ import React from 'react';
import type { PopoverItemsProps } from '.';
import { PopoverItems } from '.';
import { TestProviders } from '../../mock';
import { render, screen } from '@testing-library/react';
import { within } from '@testing-library/dom';
import { render, screen, within } from '@testing-library/react';
import { waitForEuiPopoverOpen } from '@elastic/eui/lib/test/rtl';
const mockTags = ['Elastic', 'Endpoint', 'Data Protection', 'ML', 'Continuous Monitoring'];

View file

@ -22,7 +22,7 @@ import {
} from '../../mock';
import { createStore } from '../../store';
import type { EuiSuperSelectOption } from '@elastic/eui/src/components/form/super_select/super_select_control';
import { waitFor } from '@testing-library/dom';
import { waitFor } from '@testing-library/react';
import { useSourcererDataView } from '../../containers/sourcerer';
import { useSignalHelpers } from '../../containers/sourcerer/use_signal_helpers';
import { TimelineId } from '../../../../common/types/timeline';

View file

@ -6,9 +6,8 @@
*/
import React from 'react';
import { fireEvent, render as rTLRender } from '@testing-library/react';
import { waitFor } from '@testing-library/dom';
import { act, renderHook } from '@testing-library/react-hooks';
import { fireEvent, render as rTLRender, waitFor, act } from '@testing-library/react';
import { renderHook } from '@testing-library/react-hooks';
import type { EuiTableFieldDataColumnType } from '@elastic/eui';
import type { Rule } from '../../../../rule_management/logic/types';
import { getRulesSchemaMock } from '../../../../../../common/api/detection_engine/model/rule_schema/mocks';

View file

@ -10,8 +10,7 @@
import React, { memo, useEffect } from 'react';
import { EuiCode } from '@elastic/eui';
import userEvent from '@testing-library/user-event';
import { act } from '@testing-library/react';
import { within } from '@testing-library/dom';
import { act, within } from '@testing-library/react';
import { convertToTestId } from './components/command_list';
import { Console } from './console';
import type {

View file

@ -9,10 +9,9 @@ import React from 'react';
import type { AppContextTestRender } from '../../../../../../common/mock/endpoint';
import { createAppRootMockRenderer } from '../../../../../../common/mock/endpoint';
import { endpointPageHttpMock } from '../../../mocks';
import { act, waitFor, cleanup } from '@testing-library/react';
import { act, waitFor, cleanup, fireEvent } from '@testing-library/react';
import { getEndpointListPath } from '../../../../../common/routing';
import { AdminSearchBar } from '../search_bar';
import { fireEvent } from '@testing-library/dom';
import { uiQueryParams } from '../../../store/selectors';
import type { EndpointIndexUIQueryParams } from '../../../types';

View file

@ -10,7 +10,7 @@ import { PolicyArtifactsAssignableList } from './policy_artifacts_assignable_lis
import * as reactTestingLibrary from '@testing-library/react';
import type { AppContextTestRender } from '../../../../../../common/mock/endpoint';
import { createAppRootMockRenderer } from '../../../../../../common/mock/endpoint';
import { fireEvent } from '@testing-library/dom';
import { fireEvent } from '@testing-library/react';
import { getMockListResponse } from '../../../test_utils';
describe('Policy artifacts list', () => {

View file

@ -17,7 +17,7 @@ import type { AdvancedSectionProps } from './advanced_section';
import { AdvancedSection } from './advanced_section';
import userEvent from '@testing-library/user-event';
import { AdvancedPolicySchema } from '../../../models/advanced_policy_schema';
import { within } from '@testing-library/dom';
import { within } from '@testing-library/react';
import { set } from 'lodash';
jest.mock('../../../../../../common/hooks/use_license');

View file

@ -18,7 +18,7 @@ import { OperatingSystem } from '@kbn/securitysolution-utils';
import { expectIsViewOnly, exactMatchText } from '../mocks';
import userEvent from '@testing-library/user-event';
import { cloneDeep, set } from 'lodash';
import { within } from '@testing-library/dom';
import { within } from '@testing-library/react';
describe('Policy Event Collection Card common component', () => {
let formProps: EventCollectionCardProps<OperatingSystem.WINDOWS>;

View file

@ -21,7 +21,7 @@ import { buildGlobalQuery } from '../helpers';
import type { QueryBarTimelineComponentProps } from '.';
import { QueryBarTimeline, getDataProviderFilter, TIMELINE_FILTER_DROP_AREA } from '.';
import { waitFor } from '@testing-library/dom';
import { waitFor } from '@testing-library/react';
const mockUiSettingsForFilterManager = coreMock.createStart().uiSettings;

View file

@ -10,7 +10,7 @@ import React from 'react';
import { AppContextTestRender, createAppRootMockRenderer } from '../../test';
import { DetailPanelAlertTab } from '.';
import { mockAlerts } from '../../../common/mocks/constants/session_view_process.mock';
import { fireEvent } from '@testing-library/dom';
import { fireEvent } from '@testing-library/react';
import { INVESTIGATED_ALERT_TEST_ID, VIEW_MODE_TOGGLE, ALERTS_TAB_EMPTY_STATE_TEST_ID } from '.';
import {
ALERT_LIST_ITEM_TEST_ID,

View file

@ -10,7 +10,7 @@ import { processMock } from '../../../common/mocks/constants/session_view_proces
import { AppContextTestRender, createAppRootMockRenderer } from '../../test';
import { SessionViewSearchBar } from '.';
import userEvent from '@testing-library/user-event';
import { fireEvent } from '@testing-library/dom';
import { fireEvent } from '@testing-library/react';
describe('SessionViewSearchBar component', () => {
let render: () => ReturnType<AppContextTestRender['render']>;

View file

@ -7,14 +7,12 @@
import React from 'react';
import { mountWithIntl, nextTick } from '@kbn/test-jest-helpers';
import { act } from 'react-dom/test-utils';
import SwimlaneActionConnectorFields from './swimlane_connectors';
import { useGetApplication } from './use_get_application';
import { applicationFields, mappings } from './mocks';
import { ConnectorFormTestProvider } from '../lib/test_utils';
import { waitFor } from '@testing-library/dom';
import { waitFor, render, act } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { render } from '@testing-library/react';
jest.mock('@kbn/triggers-actions-ui-plugin/public/common/lib/kibana');
jest.mock('./use_get_application');

View file

@ -10,7 +10,7 @@ import { SyntheticsDatePicker } from './synthetics_date_picker';
import { startPlugins } from '../../../utils/testing/__mocks__/synthetics_plugin_start_mock';
import { createMemoryHistory } from 'history';
import { render } from '../../../utils/testing';
import { fireEvent } from '@testing-library/dom';
import { fireEvent } from '@testing-library/react';
describe('SyntheticsDatePicker component', () => {
jest.setTimeout(10_000);

View file

@ -12,10 +12,9 @@ import {
WEBSITE_URL_HELP_TEXT,
WEBSITE_URL_LABEL,
} from './simple_monitor_form';
import { screen } from '@testing-library/react';
import { render } from '../../utils/testing';
import React from 'react';
import { act, fireEvent, waitFor } from '@testing-library/react';
import { act, fireEvent, waitFor, screen } from '@testing-library/react';
import { syntheticsTestSubjects } from '../../../../../common/constants/data_test_subjects';
import { apiService } from '../../../../utils/api_service';
import * as reduxHooks from 'react-redux';

View file

@ -6,7 +6,7 @@
*/
import React from 'react';
import { fireEvent, waitFor } from '@testing-library/dom';
import { fireEvent, waitFor } from '@testing-library/react';
import { WaterfallMarkerIcon } from './waterfall_marker_icon';
import { TestWrapper } from './waterfall_marker_test_helper';
import { render } from '../../../../../utils/testing';

View file

@ -6,12 +6,14 @@
*/
import React, { ReactElement, ReactNode } from 'react';
import { i18n } from '@kbn/i18n';
import { of } from 'rxjs';
// eslint-disable-next-line import/no-extraneous-dependencies
import {
render as reactTestLibRender,
MatcherFunction,
RenderOptions,
configure,
} from '@testing-library/react';
import { Router } from '@kbn/shared-ux-router';
import { Route } from '@kbn/shared-ux-router';
@ -21,8 +23,6 @@ import { createMemoryHistory, History } from 'history';
import { CoreStart } from '@kbn/core/public';
import { I18nProvider } from '@kbn/i18n-react';
import { coreMock } from '@kbn/core/public/mocks';
// eslint-disable-next-line import/no-extraneous-dependencies
import { configure } from '@testing-library/dom';
import { EuiThemeProvider } from '@kbn/kibana-react-plugin/common';
import { IStorageWrapper } from '@kbn/kibana-utils-plugin/public';
import { KibanaContextProvider, KibanaServices } from '@kbn/kibana-react-plugin/public';
@ -161,7 +161,13 @@ export const mockCore: () => Partial<CoreStart> = () => {
exploratoryView: {
createExploratoryViewUrl: jest.fn(),
getAppDataView: jest.fn(),
ExploratoryViewEmbeddable: () => <div>Embeddable exploratory view</div>,
ExploratoryViewEmbeddable: () => (
<div>
{i18n.translate('xpack.synthetics.core.div.embeddableExploratoryViewLabel', {
defaultMessage: 'Embeddable exploratory view',
})}
</div>
),
},
};

View file

@ -5,14 +5,13 @@
* 2.0.
*/
import { render, fireEvent, screen, waitFor } from '@testing-library/react';
import { render, fireEvent, screen, waitFor, within } from '@testing-library/react';
import React from 'react';
import moment from 'moment-timezone';
import { TransformListRow } from '../../../../common';
import { ExpandedRow } from './expanded_row';
import transformListRow from '../../../../common/__mocks__/transform_list_row.json';
import { within } from '@testing-library/dom';
jest.mock('../../../../../shared_imports');
jest.mock('../../../../app_dependencies');

View file

@ -6,7 +6,7 @@
*/
import React from 'react';
import { renderHook } from '@testing-library/react-hooks/dom';
import { waitFor } from '@testing-library/dom';
import { waitFor } from '@testing-library/react';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { useGetQueryDelaySettings } from './use_get_query_delay_settings';

View file

@ -11,7 +11,7 @@ import { RuleStatus } from '../../types';
import { useKibana } from '../../common/lib/kibana';
import { IToasts } from '@kbn/core-notifications-browser';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { waitFor } from '@testing-library/dom';
import { waitFor } from '@testing-library/react';
jest.mock('../../common/lib/kibana');
jest.mock('../lib/rule_api/aggregate_kuery_filter', () => ({

View file

@ -15,7 +15,7 @@ import { RuleStatus } from '../../types';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { useKibana } from '../../common/lib/kibana';
import { IToasts } from '@kbn/core-notifications-browser';
import { waitFor } from '@testing-library/dom';
import { waitFor } from '@testing-library/react';
jest.mock('../../common/lib/kibana');
jest.mock('../lib/rule_api/rules_kuery_filter', () => ({

View file

@ -10,7 +10,7 @@ import { useLoadTagsQuery } from './use_load_tags_query';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { useKibana } from '../../common/lib/kibana';
import { IToasts } from '@kbn/core-notifications-browser';
import { waitFor } from '@testing-library/dom';
import { waitFor } from '@testing-library/react';
const MOCK_TAGS = ['a', 'b', 'c'];

View file

@ -7,7 +7,7 @@
import React from 'react';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { act, renderHook } from '@testing-library/react-hooks/dom';
import { waitFor } from '@testing-library/dom';
import { waitFor } from '@testing-library/react';
import { useUpdateRuleSettings } from './use_update_rules_settings';
const mockAddDanger = jest.fn();

View file

@ -9,7 +9,7 @@ import React, { lazy } from 'react';
import { ConnectorForm } from './connector_form';
import { actionTypeRegistryMock } from '../../action_type_registry.mock';
import userEvent from '@testing-library/user-event';
import { waitFor } from '@testing-library/dom';
import { waitFor } from '@testing-library/react';
import { act } from '@testing-library/react';
import { AppMockRenderer, createAppMockRenderer } from '../test_utils';

View file

@ -10,7 +10,7 @@ import { coreMock } from '@kbn/core/public/mocks';
import { FormTestProvider } from '../../components/test_utils';
import { ConnectorFormFields } from './connector_form_fields';
import { actionTypeRegistryMock } from '../../action_type_registry.mock';
import { waitFor } from '@testing-library/dom';
import { waitFor } from '@testing-library/react';
import { AppMockRenderer, createAppMockRenderer } from '../test_utils';
describe('ConnectorFormFields', () => {

View file

@ -9,8 +9,7 @@ import React, { lazy } from 'react';
import { actionTypeRegistryMock } from '../../../action_type_registry.mock';
import userEvent from '@testing-library/user-event';
import { waitFor } from '@testing-library/dom';
import { act } from '@testing-library/react';
import { waitFor, act } from '@testing-library/react';
import CreateConnectorFlyout from '.';
import { betaBadgeProps } from '../beta_badge_props';
import { AppMockRenderer, createAppMockRenderer } from '../../test_utils';

View file

@ -9,8 +9,7 @@ import React, { lazy } from 'react';
import { actionTypeRegistryMock } from '../../../action_type_registry.mock';
import userEvent from '@testing-library/user-event';
import { waitFor } from '@testing-library/dom';
import { act } from '@testing-library/react';
import { waitFor, act } from '@testing-library/react';
import EditConnectorFlyout from '.';
import { ActionConnector, EditConnectorTabs, GenericValidationResult } from '../../../../types';
import { betaBadgeProps } from '../beta_badge_props';

View file

@ -7,7 +7,7 @@
import { renderHook } from '@testing-library/react-hooks';
import * as api from './apis/bulk_get_cases';
import { waitFor } from '@testing-library/dom';
import { waitFor } from '@testing-library/react';
import { useKibana } from '../../../../common/lib/kibana';
import { useBulkGetCases } from './use_bulk_get_cases';
import { AppMockRenderer, createAppMockRenderer } from '../../test_utils';

View file

@ -6,7 +6,7 @@
*/
import { renderHook } from '@testing-library/react-hooks';
import { waitFor } from '@testing-library/dom';
import { waitFor } from '@testing-library/react';
import { MaintenanceWindowStatus } from '@kbn/alerting-plugin/common';
import * as api from './apis/bulk_get_maintenance_windows';
import { coreMock } from '@kbn/core/public/mocks';

View file

@ -10,7 +10,7 @@ import { UptimeDatePicker } from './uptime_date_picker';
import { startPlugins } from '../../lib/__mocks__/uptime_plugin_start_mock';
import { createMemoryHistory } from 'history';
import { render } from '../../lib/helper/rtl_helpers';
import { fireEvent } from '@testing-library/dom';
import { fireEvent } from '@testing-library/react';
describe('UptimeDatePicker component', () => {
jest.setTimeout(10_000);

View file

@ -11,7 +11,7 @@ import { renderLegendItem } from '../../step_detail/waterfall/waterfall_chart_wr
import { render } from '../../../../../lib/helper/rtl_helpers';
import 'jest-canvas-mock';
import { waitFor } from '@testing-library/dom';
import { waitFor } from '@testing-library/react';
describe('waterfall', () => {
it('sets the correct height in case of full height', () => {

View file

@ -6,7 +6,7 @@
*/
import React from 'react';
import { fireEvent, waitFor } from '@testing-library/dom';
import { fireEvent, waitFor } from '@testing-library/react';
import { render } from '../../../../../lib/helper/rtl_helpers';
import { WaterfallMarkerIcon } from './waterfall_marker_icon';
import { TestWrapper } from './waterfall_marker_test_helper';

View file

@ -6,7 +6,7 @@
*/
import React from 'react';
import { screen } from '@testing-library/dom';
import { screen } from '@testing-library/react';
import {
AlertMonitorStatusComponent,
AlertMonitorStatusProps,

View file

@ -7,8 +7,7 @@
import React from 'react';
import { DefineAlertConnectors } from './define_connectors';
import { screen } from '@testing-library/react';
import { fireEvent } from '@testing-library/dom';
import { screen, fireEvent } from '@testing-library/react';
import { ENABLE_STATUS_ALERT } from './translations';
import { render } from '../../../../lib/helper/rtl_helpers';

View file

@ -7,7 +7,7 @@
import React from 'react';
import { EnableMonitorAlert } from './enable_alert';
import { fireEvent } from '@testing-library/dom';
import { fireEvent } from '@testing-library/react';
import { DYNAMIC_SETTINGS_DEFAULTS } from '../../../../../../common/constants';
import { makePing } from '../../../../../../common/runtime_types/ping';

View file

@ -8,7 +8,7 @@
import React from 'react';
import ReactRouterDom from 'react-router-dom';
import { Route } from '@kbn/shared-ux-router';
import { fireEvent, screen } from '@testing-library/dom';
import { fireEvent, screen } from '@testing-library/react';
import { renderHook, act as hooksAct } from '@testing-library/react-hooks';
import { createMemoryHistory } from 'history';
import { EuiButtonIcon } from '@elastic/eui';

View file

@ -12,6 +12,7 @@ import {
render as reactTestLibRender,
MatcherFunction,
RenderOptions,
configure,
} from '@testing-library/react';
import { Router } from '@kbn/shared-ux-router';
import { Route } from '@kbn/shared-ux-router';
@ -21,8 +22,6 @@ import { createMemoryHistory, History } from 'history';
import { CoreStart } from '@kbn/core/public';
import { I18nProvider } from '@kbn/i18n-react';
import { coreMock } from '@kbn/core/public/mocks';
// eslint-disable-next-line import/no-extraneous-dependencies
import { configure } from '@testing-library/dom';
import { EuiThemeProvider } from '@kbn/kibana-react-plugin/common';
import { IStorageWrapper } from '@kbn/kibana-utils-plugin/public';
import { KibanaContextProvider, KibanaServices } from '@kbn/kibana-react-plugin/public';

View file

@ -8,7 +8,7 @@ import React from 'react';
import { isValidCertVal, SettingsPage } from './settings';
import { render } from '../lib/helper/rtl_helpers';
import { fireEvent, waitFor } from '@testing-library/dom';
import { fireEvent, waitFor } from '@testing-library/react';
import * as alertApi from '../state/api/alerts';
import { DYNAMIC_SETTINGS_DEFAULTS } from '../../../common/constants';

View file

@ -8251,7 +8251,7 @@
resolved "https://registry.yarnpkg.com/@testim/chrome-version/-/chrome-version-1.1.3.tgz#fbb68696899d7b8c1b9b891eded9c04fe2cd5529"
integrity sha512-g697J3WxV/Zytemz8aTuKjTGYtta9+02kva3C1xc7KXB8GdbfE1akGJIsZLyY/FSh2QrnE+fiB7vmWU3XNcb6A==
"@testing-library/dom@^8.0.0", "@testing-library/dom@^8.19.0":
"@testing-library/dom@^8.0.0":
version "8.19.0"
resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-8.19.0.tgz#bd3f83c217ebac16694329e413d9ad5fdcfd785f"
integrity sha512-6YWYPPpxG3e/xOo6HIWwB/58HukkwIVTOaZ0VwdMVjhRUX/01E4FtQbck9GazOOj7MXHc5RBzMrU86iBJHbI+A==