mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Fix failing tests
This commit is contained in:
parent
415b4b5782
commit
c602041f4a
@ -6,7 +6,13 @@ import { getGrafanaContextMock } from 'test/mocks/getGrafanaContextMock';
|
||||
|
||||
import { PanelProps } from '@grafana/data';
|
||||
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 { Dashboard } from '@grafana/schema';
|
||||
import { getRouteComponentProps } from 'app/core/navigation/__mocks__/routeProps';
|
||||
@ -60,14 +66,18 @@ function setup({ routeProps }: { routeProps?: Partial<GrafanaRouteComponentProps
|
||||
|
||||
const renderResult = render(
|
||||
<TestProvider grafanaContext={context}>
|
||||
<DashboardScenePage {...props} />
|
||||
<LocationServiceProvider service={locationService}>
|
||||
<DashboardScenePage {...props} />
|
||||
</LocationServiceProvider>
|
||||
</TestProvider>
|
||||
);
|
||||
|
||||
const rerender = (newProps: Props) => {
|
||||
renderResult.rerender(
|
||||
<TestProvider grafanaContext={context}>
|
||||
<DashboardScenePage {...newProps} />
|
||||
<LocationServiceProvider service={locationService}>
|
||||
<DashboardScenePage {...newProps} />
|
||||
</LocationServiceProvider>
|
||||
</TestProvider>
|
||||
);
|
||||
};
|
||||
|
@ -6,7 +6,14 @@ import { getGrafanaContextMock } from 'test/mocks/getGrafanaContextMock';
|
||||
import { getDefaultTimeRange, LoadingState, PanelData, PanelProps } from '@grafana/data';
|
||||
import { getPanelPlugin } from '@grafana/data/test/__mocks__/pluginMocks';
|
||||
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 { getRouteComponentProps } from 'app/core/navigation/__mocks__/routeProps';
|
||||
import { DashboardRoutes } from 'app/types/dashboard';
|
||||
@ -47,7 +54,9 @@ function setup(props?: Partial<PublicDashboardSceneProps>) {
|
||||
|
||||
return render(
|
||||
<TestProvider grafanaContext={context}>
|
||||
<PublicDashboardScenePage {...pubdashProps} />
|
||||
<LocationServiceProvider service={locationService}>
|
||||
<PublicDashboardScenePage {...pubdashProps} />
|
||||
</LocationServiceProvider>
|
||||
</TestProvider>
|
||||
);
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import { TestProvider } from 'test/helpers/TestProvider';
|
||||
import { getGrafanaContextMock } from 'test/mocks/getGrafanaContextMock';
|
||||
|
||||
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 { playlistSrv } from 'app/features/playlist/PlaylistSrv';
|
||||
import { DashboardMeta } from 'app/types';
|
||||
@ -236,9 +236,11 @@ function setup(meta?: DashboardMeta) {
|
||||
|
||||
render(
|
||||
<TestProvider grafanaContext={context}>
|
||||
<UrlSyncContextProvider scene={dashboard}>
|
||||
<ToolbarActions dashboard={dashboard} />
|
||||
</UrlSyncContextProvider>
|
||||
<LocationServiceProvider service={locationService}>
|
||||
<UrlSyncContextProvider scene={dashboard}>
|
||||
<ToolbarActions dashboard={dashboard} />
|
||||
</UrlSyncContextProvider>
|
||||
</LocationServiceProvider>
|
||||
</TestProvider>
|
||||
);
|
||||
|
||||
|
@ -4,7 +4,7 @@ import { Router } from 'react-router-dom';
|
||||
import { getGrafanaContextMock } from 'test/mocks/getGrafanaContextMock';
|
||||
|
||||
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 { backendSrv } from 'app/core/services/backend_srv';
|
||||
import { configureStore } from 'app/store/configureStore';
|
||||
@ -32,16 +32,18 @@ function setup(props: Partial<PublicDashboardPageProxyProps>) {
|
||||
return render(
|
||||
<GrafanaContext.Provider value={context}>
|
||||
<Provider store={store}>
|
||||
<Router history={locationService.getHistory()}>
|
||||
<PublicDashboardPageProxy
|
||||
location={locationService.getLocation()}
|
||||
history={locationService.getHistory()}
|
||||
queryParams={{}}
|
||||
route={{ routeName: DashboardRoutes.Public, component: () => null, path: '/:accessToken' }}
|
||||
match={{ params: { accessToken: 'an-access-token' }, isExact: true, path: '/', url: '/' }}
|
||||
{...props}
|
||||
/>
|
||||
</Router>
|
||||
<LocationServiceProvider service={locationService}>
|
||||
<Router history={locationService.getHistory()}>
|
||||
<PublicDashboardPageProxy
|
||||
location={locationService.getLocation()}
|
||||
history={locationService.getHistory()}
|
||||
queryParams={{}}
|
||||
route={{ routeName: DashboardRoutes.Public, component: () => null, path: '/:accessToken' }}
|
||||
match={{ params: { accessToken: 'an-access-token' }, isExact: true, path: '/', url: '/' }}
|
||||
{...props}
|
||||
/>
|
||||
</Router>
|
||||
</LocationServiceProvider>
|
||||
</Provider>
|
||||
</GrafanaContext.Provider>
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user