Files
grafana-battery-visualisation/tests/panel.spec.ts
T

36 lines
1.4 KiB
TypeScript

import { test, expect } from '@grafana/plugin-e2e';
test('should display "No data" in case panel data is empty', async ({
gotoPanelEditPage,
readProvisionedDashboard,
}) => {
const dashboard = await readProvisionedDashboard({ fileName: 'dashboard.json' });
const panelEditPage = await gotoPanelEditPage({ dashboard, id: '2' });
await expect(panelEditPage.panel.locator).toContainText('No data');
});
test('should display circle when data is passed to the panel', async ({
panelEditPage,
readProvisionedDataSource,
page,
}) => {
const ds = await readProvisionedDataSource({ fileName: 'datasources.yml' });
await panelEditPage.datasource.set(ds.name);
await panelEditPage.setVisualization('ChargeViz Battery Panel');
await expect(page.getByTestId('simple-panel-circle')).toBeVisible();
});
test('should display series counter when "Show series counter" option is enabled', async ({
gotoPanelEditPage,
readProvisionedDashboard,
page,
}) => {
const dashboard = await readProvisionedDashboard({ fileName: 'dashboard.json' });
const panelEditPage = await gotoPanelEditPage({ dashboard, id: '1' });
const options = panelEditPage.getCustomOptions('ChargeViz Battery Panel');
const showSeriesCounter = options.getSwitch('Show series counter');
await showSeriesCounter.check();
await expect(page.getByTestId('simple-panel-series-counter')).toBeVisible();
});