mirror of
https://github.com/grafana/grafana.git
synced 2025-01-05 13:45:16 -06:00
Chore: Remove react-testing-lib from bundles (#50442)
* refactor(selectoptiontest): move helper function out of grafana/ui so testing-lib isn't in bundle * test(selectoptionintest): update import location of helper function * test(amroutes): put back missing selectOptionInTest helper * test(selectoptionintest): clean up remaining file imports / exports * test(queryeditor): fix failing import * refactor(grafana-ui): reuse selectOptionInTest in SelectBase test
This commit is contained in:
parent
ab4171770e
commit
ccd75d72f8
@ -4,8 +4,9 @@ import React, { useState } from 'react';
|
||||
|
||||
import { SelectableValue } from '@grafana/data';
|
||||
|
||||
import { selectOptionInTest } from '../../../../../public/test/helpers/selectOptionInTest';
|
||||
|
||||
import { SelectBase } from './SelectBase';
|
||||
import { selectOptionInTest } from './test-utils';
|
||||
|
||||
describe('SelectBase', () => {
|
||||
const onChangeHandler = () => jest.fn();
|
||||
|
@ -205,7 +205,6 @@ export { FieldArray } from './Forms/FieldArray';
|
||||
|
||||
// Select
|
||||
export { default as resetSelectStyles } from './Select/resetSelectStyles';
|
||||
export { selectOptionInTest } from './Select/test-utils';
|
||||
export * from './Select/Select';
|
||||
export { DropdownIndicator } from './Select/DropdownIndicator';
|
||||
export { getSelectStyles } from './Select/getSelectStyles';
|
||||
|
@ -3,10 +3,10 @@ import userEvent from '@testing-library/user-event';
|
||||
import React from 'react';
|
||||
import { Provider } from 'react-redux';
|
||||
import { Router } from 'react-router-dom';
|
||||
import { selectOptionInTest } from 'test/helpers/selectOptionInTest';
|
||||
import { byLabelText, byRole, byTestId, byText } from 'testing-library-selector';
|
||||
|
||||
import { locationService, setDataSourceSrv } from '@grafana/runtime';
|
||||
import { selectOptionInTest } from '@grafana/ui';
|
||||
import { contextSrv } from 'app/core/services/context_srv';
|
||||
import {
|
||||
AlertManagerCortexConfig,
|
||||
|
@ -3,10 +3,10 @@ import userEvent from '@testing-library/user-event';
|
||||
import React from 'react';
|
||||
import { Provider } from 'react-redux';
|
||||
import { Router } from 'react-router-dom';
|
||||
import { selectOptionInTest } from 'test/helpers/selectOptionInTest';
|
||||
import { byLabelText, byPlaceholderText, byRole, byTestId, byText } from 'testing-library-selector';
|
||||
|
||||
import { locationService, setDataSourceSrv } from '@grafana/runtime';
|
||||
import { selectOptionInTest } from '@grafana/ui';
|
||||
import { interceptLinkClicks } from 'app/core/navigation/patch/interceptLinkClicks';
|
||||
import { contextSrv } from 'app/core/services/context_srv';
|
||||
import store from 'app/core/store';
|
||||
|
@ -3,11 +3,11 @@ import userEvent, { PointerEventsCheckLevel } from '@testing-library/user-event'
|
||||
import React from 'react';
|
||||
import { Provider } from 'react-redux';
|
||||
import { Route, Router } from 'react-router-dom';
|
||||
import { selectOptionInTest } from 'test/helpers/selectOptionInTest';
|
||||
import { byLabelText, byRole, byTestId, byText } from 'testing-library-selector';
|
||||
|
||||
import { DataSourceInstanceSettings } from '@grafana/data';
|
||||
import { BackendSrv, locationService, setBackendSrv, setDataSourceSrv } from '@grafana/runtime';
|
||||
import { selectOptionInTest } from '@grafana/ui';
|
||||
import { contextSrv } from 'app/core/services/context_srv';
|
||||
import { DashboardSearchHit } from 'app/features/search/types';
|
||||
import { configureStore } from 'app/store/configureStore';
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import React from 'react';
|
||||
import { selectOptionInTest } from 'test/helpers/selectOptionInTest';
|
||||
import { byRole } from 'testing-library-selector';
|
||||
|
||||
import { selectors } from '@grafana/e2e-selectors';
|
||||
import { selectOptionInTest } from '@grafana/ui';
|
||||
|
||||
import { DashboardModel } from '../../state';
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { fireEvent, render, screen } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
import { selectOptionInTest } from 'test/helpers/selectOptionInTest';
|
||||
|
||||
import { MappingType } from '@grafana/data';
|
||||
import { selectors } from '@grafana/e2e-selectors';
|
||||
import { selectOptionInTest } from '@grafana/ui';
|
||||
|
||||
import { ValueMappingsEditorModal, Props } from './ValueMappingsEditorModal';
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { act, fireEvent, render, screen, waitFor } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
import { selectOptionInTest } from 'test/helpers/selectOptionInTest';
|
||||
|
||||
import { selectors } from '@grafana/e2e-selectors';
|
||||
import { locationService, setEchoSrv } from '@grafana/runtime';
|
||||
import { selectOptionInTest } from '@grafana/ui';
|
||||
import * as MockSearchSrv from 'app/core/services/__mocks__/search_srv';
|
||||
import { Echo } from 'app/core/services/echo/Echo';
|
||||
import * as SearchSrv from 'app/core/services/search_srv';
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { fireEvent, render, screen } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
|
||||
import { selectOptionInTest } from '@grafana/ui';
|
||||
import { selectOptionInTest } from 'test/helpers/selectOptionInTest';
|
||||
|
||||
import { SearchLayout } from '../types';
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { fireEvent, render, screen } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
import { selectOptionInTest } from 'test/helpers/selectOptionInTest';
|
||||
|
||||
import { toDataFrame, FieldType } from '@grafana/data';
|
||||
import { selectOptionInTest } from '@grafana/ui';
|
||||
|
||||
import { Props, ConfigFromQueryTransformerEditor } from './ConfigFromQueryTransformerEditor';
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { fireEvent, render, screen, getByText, getByLabelText } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import React from 'react';
|
||||
import { selectOptionInTest } from 'test/helpers/selectOptionInTest';
|
||||
|
||||
import { toDataFrame, FieldType } from '@grafana/data';
|
||||
import { selectOptionInTest } from '@grafana/ui';
|
||||
|
||||
import { Props, FieldToConfigMappingEditor } from './FieldToConfigMappingEditor';
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { fireEvent, render, screen } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
import { selectOptionInTest } from 'test/helpers/selectOptionInTest';
|
||||
|
||||
import { toDataFrame, FieldType } from '@grafana/data';
|
||||
import { selectOptionInTest } from '@grafana/ui';
|
||||
|
||||
import { Props, RowsToFieldsTransformerEditor } from './RowsToFieldsTransformerEditor';
|
||||
|
||||
|
@ -1,8 +1,6 @@
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
|
||||
import { selectOptionInTest } from '@grafana/ui';
|
||||
import { getSelectParent } from '@grafana/ui/src/components/Select/test-utils';
|
||||
import { selectOptionInTest, getSelectParent } from 'test/helpers/selectOptionInTest';
|
||||
|
||||
import { adHocBuilder } from '../shared/testing/builders';
|
||||
|
||||
|
@ -1,8 +1,6 @@
|
||||
import { render, screen, fireEvent } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
|
||||
import { selectOptionInTest } from '@grafana/ui';
|
||||
import { getSelectParent } from '@grafana/ui/src/components/Select/test-utils';
|
||||
import { selectOptionInTest, getSelectParent } from 'test/helpers/selectOptionInTest';
|
||||
|
||||
import { DataSourceVariableEditorUnConnected as DataSourceVariableEditor } from './DataSourceVariableEditor';
|
||||
import { initialDataSourceVariableModelState } from './reducer';
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { act, render, screen } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
|
||||
import { selectOptionInTest } from '@grafana/ui';
|
||||
import { selectOptionInTest } from 'test/helpers/selectOptionInTest';
|
||||
|
||||
import { setupMockedDataSource } from '../../__mocks__/CloudWatchDataSource';
|
||||
import { QueryEditorExpressionType, QueryEditorPropertyType } from '../../expressions';
|
||||
|
@ -2,8 +2,7 @@ import { render, screen } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import React from 'react';
|
||||
import { openMenu } from 'react-select-event';
|
||||
|
||||
import { selectOptionInTest } from '@grafana/ui';
|
||||
import { selectOptionInTest } from 'test/helpers/selectOptionInTest';
|
||||
|
||||
import createMockDatasource from '../../__mocks__/datasource';
|
||||
import createMockPanelData from '../../__mocks__/panelData';
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { render, screen, waitFor } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
|
||||
import { selectOptionInTest } from '@grafana/ui';
|
||||
import { selectOptionInTest } from 'test/helpers/selectOptionInTest';
|
||||
|
||||
import createMockDatasource from '../../__mocks__/datasource';
|
||||
import createMockPanelData from '../../__mocks__/panelData';
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import React from 'react';
|
||||
import { selectOptionInTest } from 'test/helpers/selectOptionInTest';
|
||||
|
||||
import { config } from '@grafana/runtime';
|
||||
import { selectOptionInTest } from '@grafana/ui';
|
||||
|
||||
import createMockDatasource from '../../__mocks__/datasource';
|
||||
import { createMockInstanceSetttings } from '../../__mocks__/instanceSettings';
|
||||
|
@ -1,5 +1,6 @@
|
||||
import { render, screen, waitFor } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
import { selectOptionInTest } from 'test/helpers/selectOptionInTest';
|
||||
|
||||
import { config } from '@grafana/runtime';
|
||||
import * as ui from '@grafana/ui';
|
||||
@ -52,7 +53,7 @@ describe('Azure Monitor QueryEditor', () => {
|
||||
await waitFor(() => expect(screen.getByTestId('azure-monitor-query-editor')).toBeInTheDocument());
|
||||
|
||||
const metrics = await screen.findByLabelText('Service');
|
||||
await ui.selectOptionInTest(metrics, 'Logs');
|
||||
await selectOptionInTest(metrics, 'Logs');
|
||||
|
||||
expect(onChange).toHaveBeenCalledWith({
|
||||
...mockQuery,
|
||||
|
@ -1,8 +1,7 @@
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import React from 'react';
|
||||
|
||||
import { selectOptionInTest } from '@grafana/ui';
|
||||
import { selectOptionInTest } from 'test/helpers/selectOptionInTest';
|
||||
|
||||
import { InfluxQuery } from '../types';
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import React from 'react';
|
||||
import { selectOptionInTest } from 'test/helpers/selectOptionInTest';
|
||||
|
||||
import { CoreApp } from '@grafana/data';
|
||||
import { selectOptionInTest } from '@grafana/ui';
|
||||
|
||||
import { PromQuery } from '../../types';
|
||||
import { getQueryWithDefaults } from '../state';
|
||||
|
@ -1,8 +1,8 @@
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import userEvent from '@testing-library/user-event';
|
||||
import React from 'react';
|
||||
import { selectOptionInTest } from 'test/helpers/selectOptionInTest';
|
||||
|
||||
import { selectOptionInTest } from '../../../../../../../packages/grafana-ui';
|
||||
import { getLabelSelects } from '../testUtils';
|
||||
|
||||
import { LabelFilters } from './LabelFilters';
|
||||
|
Loading…
Reference in New Issue
Block a user