mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
E2E: Fix configurePanel flow (#68487)
* Updates for new datasource picker * Correct typing to ensure datasource selection * Remove unused import * Update labels * Update labels and fix test * Fix another test
This commit is contained in:
@@ -4,6 +4,7 @@ import { AutoSizerProps } from 'react-virtualized-auto-sizer';
|
||||
import { TestProvider } from 'test/helpers/TestProvider';
|
||||
|
||||
import { DataSourceApi, LoadingState, CoreApp, createTheme, EventBusSrv } from '@grafana/data';
|
||||
import { selectors } from '@grafana/e2e-selectors';
|
||||
import { ExploreId } from 'app/types';
|
||||
|
||||
import { Explore, Props } from './Explore';
|
||||
@@ -132,7 +133,7 @@ describe('Explore', () => {
|
||||
setup();
|
||||
|
||||
// Wait for the Explore component to render
|
||||
await screen.findByLabelText('Data source picker select container');
|
||||
await screen.findByTestId(selectors.components.DataSourcePicker.container);
|
||||
|
||||
expect(screen.queryByTestId('explore-no-data')).not.toBeInTheDocument();
|
||||
});
|
||||
@@ -142,7 +143,7 @@ describe('Explore', () => {
|
||||
setup({ queryResponse: queryResp });
|
||||
|
||||
// Wait for the Explore component to render
|
||||
await screen.findByLabelText('Data source picker select container');
|
||||
await screen.findByTestId(selectors.components.DataSourcePicker.container);
|
||||
|
||||
expect(screen.getByTestId('explore-no-data')).toBeInTheDocument();
|
||||
});
|
||||
@@ -162,7 +163,7 @@ describe('Explore', () => {
|
||||
it('should render data source picker', async () => {
|
||||
setup();
|
||||
|
||||
const dataSourcePicker = await screen.findByLabelText('Data source picker select container');
|
||||
const dataSourcePicker = await screen.findByTestId(selectors.components.DataSourcePicker.container);
|
||||
|
||||
expect(dataSourcePicker).toBeInTheDocument();
|
||||
});
|
||||
|
||||
@@ -8,7 +8,7 @@ import { ExploreId } from '../../../../types';
|
||||
import { withinExplore } from './setup';
|
||||
|
||||
export const changeDatasource = async (name: string) => {
|
||||
const datasourcePicker = (await screen.findByLabelText(selectors.components.DataSourcePicker.container)).children[0];
|
||||
const datasourcePicker = (await screen.findByTestId(selectors.components.DataSourcePicker.container)).children[0];
|
||||
fireEvent.keyDown(datasourcePicker, { keyCode: 40 });
|
||||
const option = screen.getByText(name);
|
||||
fireEvent.click(option);
|
||||
|
||||
@@ -71,13 +71,13 @@ describe('QueryEditorRowHeader', () => {
|
||||
it('should show data source picker when callback is passed', async () => {
|
||||
renderScenario({ onChangeDataSource: () => {} });
|
||||
|
||||
expect(screen.queryByLabelText(selectors.components.DataSourcePicker.container)).not.toBeNull();
|
||||
expect(screen.queryByTestId(selectors.components.DataSourcePicker.container)).not.toBeNull();
|
||||
});
|
||||
|
||||
it('should not show data source picker when no callback is passed', async () => {
|
||||
renderScenario({ onChangeDataSource: undefined });
|
||||
|
||||
expect(screen.queryByLabelText(selectors.components.DataSourcePicker.container)).toBeNull();
|
||||
expect(screen.queryByTestId(selectors.components.DataSourcePicker.container)).toBeNull();
|
||||
});
|
||||
|
||||
it('should render variables in the data source picker', async () => {
|
||||
|
||||
Reference in New Issue
Block a user