Skip to content

Commit eac8cbc

Browse files
committed
added system summar test
1 parent 6c68794 commit eac8cbc

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import { test, expect } from '@playwright/test';
2+
import { GRAFANA_URL } from '../../../../config/environment';
3+
import { DashboardPage } from '../../../../page-objects/dashboard/dashboard.pageobject';
4+
import { DataSourcesPage } from '../../../../page-objects/data-sources/data-sources.pageobject';
5+
import { interceptApiRoute } from '../../../../utils/intercept-api-route';
6+
import { SystemSummary } from '../../../../../src/datasources/system/types.ts';
7+
import { timeOutPeriod } from '../../../../constants/global.constant';
8+
9+
test.describe('System Summary Table', () => {
10+
let dashboard: DashboardPage;
11+
let dataSources: DataSourcesPage;
12+
let createdDataSourceName = 'Systemlink System Summary Table';
13+
14+
test.beforeAll(async ({ browser }) => {
15+
const context = await browser.newContext();
16+
const page = await context.newPage();
17+
dataSources = new DataSourcesPage(page);
18+
dashboard = new DashboardPage(page);
19+
await dataSources.addDataSource('SystemLink Systems', createdDataSourceName);
20+
});
21+
22+
test.afterAll(async () => {
23+
await dataSources.deleteDataSource(createdDataSourceName);
24+
});
25+
26+
test.describe.serial('System Summary query', () => {
27+
test('should create a Systemlink Systems visualization', async () => {
28+
await dashboard.page.goto(`${GRAFANA_URL}/dashboard/new`);
29+
await dashboard.addVisualizationButton.waitFor();
30+
await dashboard.addVisualization();
31+
await dashboard.selectDataSource(createdDataSourceName);
32+
await dashboard.panel.systemsQueryEditor.switchToTableView();
33+
34+
await expect(dashboard.dataSourcePicker).toHaveAttribute('placeholder', createdDataSourceName);
35+
});
36+
37+
test('should display correct system summary values', async () => {
38+
const [systemSummaryResponse] = await Promise.all([
39+
interceptApiRoute<SystemSummary>(dashboard.page, '**/nisysmgmt/v1/get-systems-summary'),
40+
dashboard.panel.toolbar.refreshButton.click()
41+
]);
42+
43+
await dashboard.panel.table.getTable.waitFor({ timeout: timeOutPeriod });
44+
45+
expect(systemSummaryResponse).toBeDefined();
46+
expect(await dashboard.panel.table.getTableRowCount()).toBe(1);
47+
expect(await dashboard.panel.table.checkColumnValue('Connected', systemSummaryResponse.connectedCount.toString())).toBeTruthy();
48+
expect(await dashboard.panel.table.checkColumnValue('Disconnected', systemSummaryResponse.disconnectedCount.toString())).toBeTruthy();
49+
expect(await dashboard.panel.table.checkColumnValue('Virtual', systemSummaryResponse.virtualCount.toString())).toBeTruthy();
50+
});
51+
});
52+
});

0 commit comments

Comments
 (0)