Files
grafana/public/app/features/dashboard-scene/scene/DashboardSceneRenderer.test.tsx
Torkel Ödegaard 43dba8c3f9 DashboardScene: Support bodyScrolling (#91888)
* Progress

* Fix dashboards pane

* almost working

* add hook to get scopesDashboardsScene state

* check whether it's enabled when considering opened state

* add height to container

* Update

* revert change

* Make it work when bodyScrolling is disabled

* Last tweaks

* Update scenes

* Updating

* Fix

* fix tests

* fix lint  issues

* fix lint  issues

---------

Co-authored-by: Ashley Harrison <ashley.harrison@grafana.com>
2024-08-19 15:42:45 +02:00

54 lines
1.5 KiB
TypeScript

import { screen } from '@testing-library/react';
import { render } from 'test/test-utils';
import { selectors } from '@grafana/e2e-selectors';
import { transformSaveModelToScene } from '../serialization/transformSaveModelToScene';
jest.mock('@grafana/runtime', () => ({
...jest.requireActual('@grafana/runtime'),
useChromeHeaderHeight: jest.fn(),
}));
describe('DashboardSceneRenderer', () => {
it('should render Not Found notice when dashboard is not found', async () => {
const scene = transformSaveModelToScene({
meta: {
isSnapshot: true,
dashboardNotFound: true,
canStar: false,
canDelete: false,
canSave: false,
canEdit: false,
canShare: false,
},
dashboard: {
title: 'Not found',
uid: 'uid',
schemaVersion: 0,
// Disabling build in annotations to avoid mocking Grafana data source
annotations: {
list: [
{
builtIn: 1,
datasource: {
type: 'grafana',
uid: '-- Grafana --',
},
enable: false,
hide: true,
iconColor: 'rgba(0, 211, 255, 1)',
name: 'Annotations & Alerts',
type: 'dashboard',
},
],
},
},
});
render(<scene.Component model={scene} />);
expect(await screen.findByTestId(selectors.components.EntityNotFound.container)).toBeInTheDocument();
});
});