From c602041f4a9ed426b76ea0df8ef24c8380c33d20 Mon Sep 17 00:00:00 2001 From: kay delaney Date: Thu, 26 Sep 2024 11:27:14 +0100 Subject: [PATCH] Fix failing tests --- .../pages/DashboardScenePage.test.tsx | 16 ++++++++++--- .../pages/PublicDashboardScenePage.test.tsx | 13 ++++++++-- .../scene/NavToolbarActions.test.tsx | 10 ++++---- .../PublicDashboardPageProxy.test.tsx | 24 ++++++++++--------- 4 files changed, 43 insertions(+), 20 deletions(-) diff --git a/public/app/features/dashboard-scene/pages/DashboardScenePage.test.tsx b/public/app/features/dashboard-scene/pages/DashboardScenePage.test.tsx index 11146de7f4d..2dd6ebcba26 100644 --- a/public/app/features/dashboard-scene/pages/DashboardScenePage.test.tsx +++ b/public/app/features/dashboard-scene/pages/DashboardScenePage.test.tsx @@ -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 - + + + ); const rerender = (newProps: Props) => { renderResult.rerender( - + + + ); }; diff --git a/public/app/features/dashboard-scene/pages/PublicDashboardScenePage.test.tsx b/public/app/features/dashboard-scene/pages/PublicDashboardScenePage.test.tsx index 2824025d1e6..bd7e7b4fc64 100644 --- a/public/app/features/dashboard-scene/pages/PublicDashboardScenePage.test.tsx +++ b/public/app/features/dashboard-scene/pages/PublicDashboardScenePage.test.tsx @@ -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) { return render( - + + + ); } diff --git a/public/app/features/dashboard-scene/scene/NavToolbarActions.test.tsx b/public/app/features/dashboard-scene/scene/NavToolbarActions.test.tsx index 22c2acde4fa..39048ed5724 100644 --- a/public/app/features/dashboard-scene/scene/NavToolbarActions.test.tsx +++ b/public/app/features/dashboard-scene/scene/NavToolbarActions.test.tsx @@ -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( - - - + + + + + ); diff --git a/public/app/features/dashboard/containers/PublicDashboardPageProxy.test.tsx b/public/app/features/dashboard/containers/PublicDashboardPageProxy.test.tsx index 6da46204b9a..49193505061 100644 --- a/public/app/features/dashboard/containers/PublicDashboardPageProxy.test.tsx +++ b/public/app/features/dashboard/containers/PublicDashboardPageProxy.test.tsx @@ -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) { return render( - - null, path: '/:accessToken' }} - match={{ params: { accessToken: 'an-access-token' }, isExact: true, path: '/', url: '/' }} - {...props} - /> - + + + null, path: '/:accessToken' }} + match={{ params: { accessToken: 'an-access-token' }, isExact: true, path: '/', url: '/' }} + {...props} + /> + + );