mirror of
https://github.com/grafana/grafana.git
synced 2025-02-13 00:55:47 -06:00
9a85a2e441
* Feature Flags: introduce a flag for enabling the Data Connections page * Feature Flags: generate schemas * Navigation: add navigation weight for the Data Connections page * NavLink: add a comment pointing out where icon names can be looked up * NavTree: add a new page called Data Connections * fix(Api): prefix the navigation IDs with the parent ("data-connections") * feat(Frontend): add a basic page with four tabs * feat(Plugins): add a hook for importing an app plugin * feat(Plugins): add a component for loading app plugins anywhere * feat(Data Connections): load the cloud-onboarding app under the "Cloud onboarding" tab * feat(Data Connections): generate a proper nav model to highlight active tabs * test(Data Connections): add tests * refactor(Data Connections): update temporary text content This is only used as a placeholder until the tabs are under development. * refactor(Data Cnnnections): move /pages to /tabs * refactor(Data Connections): remove the `types.ts` file as it is not referenced by any module * feat(Data Connections): only register routes if feature is enabled
43 lines
1.4 KiB
TypeScript
43 lines
1.4 KiB
TypeScript
import { render, RenderResult, screen } from '@testing-library/react';
|
|
import React from 'react';
|
|
import { Provider } from 'react-redux';
|
|
import { Router } from 'react-router-dom';
|
|
|
|
import { locationService } from '@grafana/runtime';
|
|
import { configureStore } from 'app/store/configureStore';
|
|
|
|
import DataConnectionsPage from './DataConnectionsPage';
|
|
import navIndex from './__mocks__/store.navIndex.mock';
|
|
import { ROUTE_BASE_ID } from './constants';
|
|
|
|
const renderPage = (path = `/${ROUTE_BASE_ID}`): RenderResult => {
|
|
// @ts-ignore
|
|
const store = configureStore({ navIndex });
|
|
locationService.push(path);
|
|
|
|
return render(
|
|
<Provider store={store}>
|
|
<Router history={locationService.getHistory()}>
|
|
<DataConnectionsPage />
|
|
</Router>
|
|
</Provider>
|
|
);
|
|
};
|
|
|
|
describe('Data Connections Page', () => {
|
|
test('shows all the four tabs', async () => {
|
|
renderPage();
|
|
|
|
expect(await screen.findByLabelText('Tab Data sources')).toBeVisible();
|
|
expect(await screen.findByLabelText('Tab Plugins')).toBeVisible();
|
|
expect(await screen.findByLabelText('Tab Cloud integrations')).toBeVisible();
|
|
expect(await screen.findByLabelText('Tab Recorded queries')).toBeVisible();
|
|
});
|
|
|
|
test('shows the "Data sources" tab by default', async () => {
|
|
renderPage();
|
|
|
|
expect(await screen.findByText('The list of data sources is under development.')).toBeVisible();
|
|
});
|
|
});
|