diff --git a/packages/grafana-ui/src/components/Select/SelectBase.test.tsx b/packages/grafana-ui/src/components/Select/SelectBase.test.tsx index 7d9567a4aa9..bdfb164c6c0 100644 --- a/packages/grafana-ui/src/components/Select/SelectBase.test.tsx +++ b/packages/grafana-ui/src/components/Select/SelectBase.test.tsx @@ -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(); diff --git a/packages/grafana-ui/src/components/index.ts b/packages/grafana-ui/src/components/index.ts index 791514c31fd..947bce9964c 100644 --- a/packages/grafana-ui/src/components/index.ts +++ b/packages/grafana-ui/src/components/index.ts @@ -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'; diff --git a/public/app/features/alerting/unified/AmRoutes.test.tsx b/public/app/features/alerting/unified/AmRoutes.test.tsx index e5960e83aed..247fe95ab64 100644 --- a/public/app/features/alerting/unified/AmRoutes.test.tsx +++ b/public/app/features/alerting/unified/AmRoutes.test.tsx @@ -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, diff --git a/public/app/features/alerting/unified/Receivers.test.tsx b/public/app/features/alerting/unified/Receivers.test.tsx index e7c9e7bda3c..a58669d56f6 100644 --- a/public/app/features/alerting/unified/Receivers.test.tsx +++ b/public/app/features/alerting/unified/Receivers.test.tsx @@ -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'; diff --git a/public/app/features/alerting/unified/RuleEditor.test.tsx b/public/app/features/alerting/unified/RuleEditor.test.tsx index a140d9e7be4..e5dd5cf7959 100644 --- a/public/app/features/alerting/unified/RuleEditor.test.tsx +++ b/public/app/features/alerting/unified/RuleEditor.test.tsx @@ -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'; diff --git a/public/app/features/dashboard/components/DashboardSettings/GeneralSettings.test.tsx b/public/app/features/dashboard/components/DashboardSettings/GeneralSettings.test.tsx index c7f17b17dc0..bbbaa0eda35 100644 --- a/public/app/features/dashboard/components/DashboardSettings/GeneralSettings.test.tsx +++ b/public/app/features/dashboard/components/DashboardSettings/GeneralSettings.test.tsx @@ -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'; diff --git a/public/app/features/dimensions/editors/ValueMappingsEditor/ValueMappingsEditorModal.test.tsx b/public/app/features/dimensions/editors/ValueMappingsEditor/ValueMappingsEditorModal.test.tsx index 370e24f7f6b..09fcd9e701d 100644 --- a/public/app/features/dimensions/editors/ValueMappingsEditor/ValueMappingsEditorModal.test.tsx +++ b/public/app/features/dimensions/editors/ValueMappingsEditor/ValueMappingsEditorModal.test.tsx @@ -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'; diff --git a/public/app/features/search/components/DashboardSearch.test.tsx b/public/app/features/search/components/DashboardSearch.test.tsx index 7b20ba4b2dc..778bf68d419 100644 --- a/public/app/features/search/components/DashboardSearch.test.tsx +++ b/public/app/features/search/components/DashboardSearch.test.tsx @@ -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'; diff --git a/public/app/features/search/components/SearchResultsFilter.test.tsx b/public/app/features/search/components/SearchResultsFilter.test.tsx index 991e0d8bf53..878233f4e9d 100644 --- a/public/app/features/search/components/SearchResultsFilter.test.tsx +++ b/public/app/features/search/components/SearchResultsFilter.test.tsx @@ -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'; diff --git a/public/app/features/transformers/configFromQuery/ConfigFromQueryTransformerEditor.test.tsx b/public/app/features/transformers/configFromQuery/ConfigFromQueryTransformerEditor.test.tsx index d6c866c30d6..fd8e139d67f 100644 --- a/public/app/features/transformers/configFromQuery/ConfigFromQueryTransformerEditor.test.tsx +++ b/public/app/features/transformers/configFromQuery/ConfigFromQueryTransformerEditor.test.tsx @@ -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'; diff --git a/public/app/features/transformers/fieldToConfigMapping/FieldToConfigMappingEditor.test.tsx b/public/app/features/transformers/fieldToConfigMapping/FieldToConfigMappingEditor.test.tsx index c2ac51effb9..e1b04225761 100644 --- a/public/app/features/transformers/fieldToConfigMapping/FieldToConfigMappingEditor.test.tsx +++ b/public/app/features/transformers/fieldToConfigMapping/FieldToConfigMappingEditor.test.tsx @@ -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'; diff --git a/public/app/features/transformers/rowsToFields/RowsToFieldsTransformerEditor.test.tsx b/public/app/features/transformers/rowsToFields/RowsToFieldsTransformerEditor.test.tsx index f66f5748ae3..bb5746b3716 100644 --- a/public/app/features/transformers/rowsToFields/RowsToFieldsTransformerEditor.test.tsx +++ b/public/app/features/transformers/rowsToFields/RowsToFieldsTransformerEditor.test.tsx @@ -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'; diff --git a/public/app/features/variables/adhoc/AdHocVariableEditor.test.tsx b/public/app/features/variables/adhoc/AdHocVariableEditor.test.tsx index d27f1546daa..aefc96375a8 100644 --- a/public/app/features/variables/adhoc/AdHocVariableEditor.test.tsx +++ b/public/app/features/variables/adhoc/AdHocVariableEditor.test.tsx @@ -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'; diff --git a/public/app/features/variables/datasource/DataSourceVariableEditor.test.tsx b/public/app/features/variables/datasource/DataSourceVariableEditor.test.tsx index 68a58da3835..2c5cd3c3178 100644 --- a/public/app/features/variables/datasource/DataSourceVariableEditor.test.tsx +++ b/public/app/features/variables/datasource/DataSourceVariableEditor.test.tsx @@ -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'; diff --git a/public/app/plugins/datasource/cloudwatch/components/SQLBuilderEditor/SQLBuilderSelectRow.test.tsx b/public/app/plugins/datasource/cloudwatch/components/SQLBuilderEditor/SQLBuilderSelectRow.test.tsx index e8948a5be53..58021d5dd13 100644 --- a/public/app/plugins/datasource/cloudwatch/components/SQLBuilderEditor/SQLBuilderSelectRow.test.tsx +++ b/public/app/plugins/datasource/cloudwatch/components/SQLBuilderEditor/SQLBuilderSelectRow.test.tsx @@ -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'; diff --git a/public/app/plugins/datasource/grafana-azure-monitor-datasource/components/MetricsQueryEditor/DimensionFields.test.tsx b/public/app/plugins/datasource/grafana-azure-monitor-datasource/components/MetricsQueryEditor/DimensionFields.test.tsx index 13635a0d36c..702f806fa9e 100644 --- a/public/app/plugins/datasource/grafana-azure-monitor-datasource/components/MetricsQueryEditor/DimensionFields.test.tsx +++ b/public/app/plugins/datasource/grafana-azure-monitor-datasource/components/MetricsQueryEditor/DimensionFields.test.tsx @@ -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'; diff --git a/public/app/plugins/datasource/grafana-azure-monitor-datasource/components/MetricsQueryEditor/MetricsQueryEditor.test.tsx b/public/app/plugins/datasource/grafana-azure-monitor-datasource/components/MetricsQueryEditor/MetricsQueryEditor.test.tsx index 9ea91a6542d..f4c729c52b8 100644 --- a/public/app/plugins/datasource/grafana-azure-monitor-datasource/components/MetricsQueryEditor/MetricsQueryEditor.test.tsx +++ b/public/app/plugins/datasource/grafana-azure-monitor-datasource/components/MetricsQueryEditor/MetricsQueryEditor.test.tsx @@ -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'; diff --git a/public/app/plugins/datasource/grafana-azure-monitor-datasource/components/NewMetricsQueryEditor/MetricsQueryEditor.test.tsx b/public/app/plugins/datasource/grafana-azure-monitor-datasource/components/NewMetricsQueryEditor/MetricsQueryEditor.test.tsx index 42618608777..0a0f60ebaa2 100644 --- a/public/app/plugins/datasource/grafana-azure-monitor-datasource/components/NewMetricsQueryEditor/MetricsQueryEditor.test.tsx +++ b/public/app/plugins/datasource/grafana-azure-monitor-datasource/components/NewMetricsQueryEditor/MetricsQueryEditor.test.tsx @@ -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'; diff --git a/public/app/plugins/datasource/grafana-azure-monitor-datasource/components/QueryEditor/QueryEditor.test.tsx b/public/app/plugins/datasource/grafana-azure-monitor-datasource/components/QueryEditor/QueryEditor.test.tsx index d6684fbce04..19eb16cc16c 100644 --- a/public/app/plugins/datasource/grafana-azure-monitor-datasource/components/QueryEditor/QueryEditor.test.tsx +++ b/public/app/plugins/datasource/grafana-azure-monitor-datasource/components/QueryEditor/QueryEditor.test.tsx @@ -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, diff --git a/public/app/plugins/datasource/influxdb/components/RawInfluxQLEditor.test.tsx b/public/app/plugins/datasource/influxdb/components/RawInfluxQLEditor.test.tsx index 58b9a93e0f7..ef22e031641 100644 --- a/public/app/plugins/datasource/influxdb/components/RawInfluxQLEditor.test.tsx +++ b/public/app/plugins/datasource/influxdb/components/RawInfluxQLEditor.test.tsx @@ -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'; diff --git a/public/app/plugins/datasource/prometheus/querybuilder/components/PromQueryBuilderOptions.test.tsx b/public/app/plugins/datasource/prometheus/querybuilder/components/PromQueryBuilderOptions.test.tsx index 9fc5fe05d38..02a41792c26 100644 --- a/public/app/plugins/datasource/prometheus/querybuilder/components/PromQueryBuilderOptions.test.tsx +++ b/public/app/plugins/datasource/prometheus/querybuilder/components/PromQueryBuilderOptions.test.tsx @@ -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'; diff --git a/public/app/plugins/datasource/prometheus/querybuilder/shared/LabelFilters.test.tsx b/public/app/plugins/datasource/prometheus/querybuilder/shared/LabelFilters.test.tsx index 3ca21a0bfaf..62dc1a169e7 100644 --- a/public/app/plugins/datasource/prometheus/querybuilder/shared/LabelFilters.test.tsx +++ b/public/app/plugins/datasource/prometheus/querybuilder/shared/LabelFilters.test.tsx @@ -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'; diff --git a/packages/grafana-ui/src/components/Select/test-utils.ts b/public/test/helpers/selectOptionInTest.ts similarity index 100% rename from packages/grafana-ui/src/components/Select/test-utils.ts rename to public/test/helpers/selectOptionInTest.ts