@ -14,6 +14,7 @@ import { selectors } from '@grafana/e2e-selectors';
import { getRouteComponentProps } from 'app/core/navigation/__mocks__/routeProps' ;
import { createTheme } from '@grafana/data' ;
import { AutoSizerProps } from 'react-virtualized-auto-sizer' ;
import { setDashboardSrv } from '../services/DashboardSrv' ;
jest . mock ( 'app/features/dashboard/dashgrid/LazyLoader' , ( ) = > {
const LazyLoader = ( { children } : Pick < LazyLoaderProps , ' children ' > ) = > {
@ -52,6 +53,10 @@ jest.mock('react-virtualized-auto-sizer', () => {
return ( { children } : AutoSizerProps ) = > children ( { height : 1 , width : 1 } ) ;
} ) ;
// the mock below gets rid of this warning from recompose:
// Warning: React.createFactory() is deprecated and will be removed in a future major release. Consider using JSX or use React.createElement() directly instead.
jest . mock ( '@jaegertracing/jaeger-ui-components' , ( ) = > ( { } ) ) ;
interface ScenarioContext {
dashboard? : DashboardModel | null ;
container? : HTMLElement ;
@ -196,6 +201,15 @@ describe('DashboardPage', () => {
dashboardPageScenario ( 'When going into view mode' , ( ctx ) = > {
ctx . setup ( ( ) = > {
setDataSourceSrv ( {
get : jest . fn ( ) . mockResolvedValue ( { getRef : jest.fn ( ) , query : jest.fn ( ) . mockResolvedValue ( [ ] ) } ) ,
getInstanceSettings : jest.fn ( ) . mockReturnValue ( { meta : { } } ) ,
getList : jest.fn ( ) ,
reload : jest.fn ( ) ,
} ) ;
setDashboardSrv ( {
getCurrent : ( ) = > getTestDashboard ( ) ,
} as any ) ;
ctx . mount ( {
dashboard : getTestDashboard ( ) ,
queryParams : { viewPanel : '1' } ,
@ -216,13 +230,6 @@ describe('DashboardPage', () => {
} ) ;
dashboardPageScenario ( 'When going into edit mode' , ( ctx ) = > {
setDataSourceSrv ( {
get : jest . fn ( ) . mockResolvedValue ( { } ) ,
getInstanceSettings : jest.fn ( ) . mockReturnValue ( { meta : { } } ) ,
getList : jest.fn ( ) ,
reload : jest.fn ( ) ,
} ) ;
ctx . setup ( ( ) = > {
ctx . mount ( {
dashboard : getTestDashboard ( ) ,