mirror of
https://github.com/grafana/grafana.git
synced 2025-07-31 01:42:13 +08:00
Fix failing tests
This commit is contained in:

committed by
renovate[bot]
![renovate[bot]](/assets/img/avatar_default.png)
parent
415b4b5782
commit
c602041f4a
@ -6,7 +6,13 @@ import { getGrafanaContextMock } from 'test/mocks/getGrafanaContextMock';
|
|||||||
|
|
||||||
import { PanelProps } from '@grafana/data';
|
import { PanelProps } from '@grafana/data';
|
||||||
import { getPanelPlugin } from '@grafana/data/test/__mocks__/pluginMocks';
|
import { getPanelPlugin } from '@grafana/data/test/__mocks__/pluginMocks';
|
||||||
import { config, getPluginLinkExtensions, locationService, setPluginImportUtils } from '@grafana/runtime';
|
import {
|
||||||
|
LocationServiceProvider,
|
||||||
|
config,
|
||||||
|
getPluginLinkExtensions,
|
||||||
|
locationService,
|
||||||
|
setPluginImportUtils,
|
||||||
|
} from '@grafana/runtime';
|
||||||
import { VizPanel } from '@grafana/scenes';
|
import { VizPanel } from '@grafana/scenes';
|
||||||
import { Dashboard } from '@grafana/schema';
|
import { Dashboard } from '@grafana/schema';
|
||||||
import { getRouteComponentProps } from 'app/core/navigation/__mocks__/routeProps';
|
import { getRouteComponentProps } from 'app/core/navigation/__mocks__/routeProps';
|
||||||
@ -60,14 +66,18 @@ function setup({ routeProps }: { routeProps?: Partial<GrafanaRouteComponentProps
|
|||||||
|
|
||||||
const renderResult = render(
|
const renderResult = render(
|
||||||
<TestProvider grafanaContext={context}>
|
<TestProvider grafanaContext={context}>
|
||||||
<DashboardScenePage {...props} />
|
<LocationServiceProvider service={locationService}>
|
||||||
|
<DashboardScenePage {...props} />
|
||||||
|
</LocationServiceProvider>
|
||||||
</TestProvider>
|
</TestProvider>
|
||||||
);
|
);
|
||||||
|
|
||||||
const rerender = (newProps: Props) => {
|
const rerender = (newProps: Props) => {
|
||||||
renderResult.rerender(
|
renderResult.rerender(
|
||||||
<TestProvider grafanaContext={context}>
|
<TestProvider grafanaContext={context}>
|
||||||
<DashboardScenePage {...newProps} />
|
<LocationServiceProvider service={locationService}>
|
||||||
|
<DashboardScenePage {...newProps} />
|
||||||
|
</LocationServiceProvider>
|
||||||
</TestProvider>
|
</TestProvider>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -6,7 +6,14 @@ import { getGrafanaContextMock } from 'test/mocks/getGrafanaContextMock';
|
|||||||
import { getDefaultTimeRange, LoadingState, PanelData, PanelProps } from '@grafana/data';
|
import { getDefaultTimeRange, LoadingState, PanelData, PanelProps } from '@grafana/data';
|
||||||
import { getPanelPlugin } from '@grafana/data/test/__mocks__/pluginMocks';
|
import { getPanelPlugin } from '@grafana/data/test/__mocks__/pluginMocks';
|
||||||
import { selectors as e2eSelectors } from '@grafana/e2e-selectors';
|
import { selectors as e2eSelectors } from '@grafana/e2e-selectors';
|
||||||
import { config, getPluginLinkExtensions, setPluginImportUtils, setRunRequest } from '@grafana/runtime';
|
import {
|
||||||
|
config,
|
||||||
|
getPluginLinkExtensions,
|
||||||
|
locationService,
|
||||||
|
LocationServiceProvider,
|
||||||
|
setPluginImportUtils,
|
||||||
|
setRunRequest,
|
||||||
|
} from '@grafana/runtime';
|
||||||
import { Dashboard } from '@grafana/schema';
|
import { Dashboard } from '@grafana/schema';
|
||||||
import { getRouteComponentProps } from 'app/core/navigation/__mocks__/routeProps';
|
import { getRouteComponentProps } from 'app/core/navigation/__mocks__/routeProps';
|
||||||
import { DashboardRoutes } from 'app/types/dashboard';
|
import { DashboardRoutes } from 'app/types/dashboard';
|
||||||
@ -47,7 +54,9 @@ function setup(props?: Partial<PublicDashboardSceneProps>) {
|
|||||||
|
|
||||||
return render(
|
return render(
|
||||||
<TestProvider grafanaContext={context}>
|
<TestProvider grafanaContext={context}>
|
||||||
<PublicDashboardScenePage {...pubdashProps} />
|
<LocationServiceProvider service={locationService}>
|
||||||
|
<PublicDashboardScenePage {...pubdashProps} />
|
||||||
|
</LocationServiceProvider>
|
||||||
</TestProvider>
|
</TestProvider>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@ import { TestProvider } from 'test/helpers/TestProvider';
|
|||||||
import { getGrafanaContextMock } from 'test/mocks/getGrafanaContextMock';
|
import { getGrafanaContextMock } from 'test/mocks/getGrafanaContextMock';
|
||||||
|
|
||||||
import { selectors } from '@grafana/e2e-selectors';
|
import { selectors } from '@grafana/e2e-selectors';
|
||||||
import { config, locationService } from '@grafana/runtime';
|
import { LocationServiceProvider, config, locationService } from '@grafana/runtime';
|
||||||
import { SceneGridLayout, SceneQueryRunner, SceneTimeRange, UrlSyncContextProvider, VizPanel } from '@grafana/scenes';
|
import { SceneGridLayout, SceneQueryRunner, SceneTimeRange, UrlSyncContextProvider, VizPanel } from '@grafana/scenes';
|
||||||
import { playlistSrv } from 'app/features/playlist/PlaylistSrv';
|
import { playlistSrv } from 'app/features/playlist/PlaylistSrv';
|
||||||
import { DashboardMeta } from 'app/types';
|
import { DashboardMeta } from 'app/types';
|
||||||
@ -236,9 +236,11 @@ function setup(meta?: DashboardMeta) {
|
|||||||
|
|
||||||
render(
|
render(
|
||||||
<TestProvider grafanaContext={context}>
|
<TestProvider grafanaContext={context}>
|
||||||
<UrlSyncContextProvider scene={dashboard}>
|
<LocationServiceProvider service={locationService}>
|
||||||
<ToolbarActions dashboard={dashboard} />
|
<UrlSyncContextProvider scene={dashboard}>
|
||||||
</UrlSyncContextProvider>
|
<ToolbarActions dashboard={dashboard} />
|
||||||
|
</UrlSyncContextProvider>
|
||||||
|
</LocationServiceProvider>
|
||||||
</TestProvider>
|
</TestProvider>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ import { Router } from 'react-router-dom';
|
|||||||
import { getGrafanaContextMock } from 'test/mocks/getGrafanaContextMock';
|
import { getGrafanaContextMock } from 'test/mocks/getGrafanaContextMock';
|
||||||
|
|
||||||
import { selectors as e2eSelectors } from '@grafana/e2e-selectors';
|
import { selectors as e2eSelectors } from '@grafana/e2e-selectors';
|
||||||
import { config, locationService } from '@grafana/runtime';
|
import { LocationServiceProvider, config, locationService } from '@grafana/runtime';
|
||||||
import { GrafanaContext } from 'app/core/context/GrafanaContext';
|
import { GrafanaContext } from 'app/core/context/GrafanaContext';
|
||||||
import { backendSrv } from 'app/core/services/backend_srv';
|
import { backendSrv } from 'app/core/services/backend_srv';
|
||||||
import { configureStore } from 'app/store/configureStore';
|
import { configureStore } from 'app/store/configureStore';
|
||||||
@ -32,16 +32,18 @@ function setup(props: Partial<PublicDashboardPageProxyProps>) {
|
|||||||
return render(
|
return render(
|
||||||
<GrafanaContext.Provider value={context}>
|
<GrafanaContext.Provider value={context}>
|
||||||
<Provider store={store}>
|
<Provider store={store}>
|
||||||
<Router history={locationService.getHistory()}>
|
<LocationServiceProvider service={locationService}>
|
||||||
<PublicDashboardPageProxy
|
<Router history={locationService.getHistory()}>
|
||||||
location={locationService.getLocation()}
|
<PublicDashboardPageProxy
|
||||||
history={locationService.getHistory()}
|
location={locationService.getLocation()}
|
||||||
queryParams={{}}
|
history={locationService.getHistory()}
|
||||||
route={{ routeName: DashboardRoutes.Public, component: () => null, path: '/:accessToken' }}
|
queryParams={{}}
|
||||||
match={{ params: { accessToken: 'an-access-token' }, isExact: true, path: '/', url: '/' }}
|
route={{ routeName: DashboardRoutes.Public, component: () => null, path: '/:accessToken' }}
|
||||||
{...props}
|
match={{ params: { accessToken: 'an-access-token' }, isExact: true, path: '/', url: '/' }}
|
||||||
/>
|
{...props}
|
||||||
</Router>
|
/>
|
||||||
|
</Router>
|
||||||
|
</LocationServiceProvider>
|
||||||
</Provider>
|
</Provider>
|
||||||
</GrafanaContext.Provider>
|
</GrafanaContext.Provider>
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user