difuse-playwright/tests/dashboards/netdata.spec.js

79 lines
2.6 KiB
JavaScript
Raw Normal View History

import { test, expect } from '@playwright/test';
2024-06-02 12:55:31 +00:00
test.describe('General - Dashboard - Netdata', () => {
2024-06-02 12:55:31 +00:00
test.beforeEach(async ({ page }) => {
await page.goto('/dash-netdata', { waitUntil: 'load' });
2024-06-02 12:55:31 +00:00
});
test('Title', async ({ page }) => {
2024-06-02 12:55:31 +00:00
const title = await page.title();
expect(title).toBe('Difuse - Dashboard - Netdata');
2024-06-02 12:55:31 +00:00
});
test('Check Netdata iframe loading', async ({ page }) => {
const iframeElement = await page.locator('#netdataFrame');
2024-06-02 12:55:31 +00:00
await expect(iframeElement).toBeTruthy();
const netDataContent = await page.locator('.charts-body');
expect(netDataContent).toBeTruthy();
2024-06-02 12:55:31 +00:00
});
test('Netdata Key Elements', async ({ page }) => {
const systemOverview = await page.getByRole('heading', {
name: 'System Overview'
2024-06-02 12:55:31 +00:00
});
const cpuS = await page.getByRole('heading', { name: 'Memory' });
const disks = await page.getByRole('heading', { name: 'Disks' });
const newtworkStack = await page.getByRole('heading', {
name: 'Networking Stack'
2024-06-02 12:55:31 +00:00
});
const ipv4 = await page.getByRole('heading', { name: 'IPv4 Networking' });
const ipv6 = await page.getByRole('heading', { name: 'IPv6 Networking' });
const networkInterfaces = await page.getByRole('heading', {
name: 'Network Interfaces'
2024-06-02 12:55:31 +00:00
});
const firewall = await page.getByRole('heading', {
name: 'Firewall (netfilter)'
2024-06-02 12:55:31 +00:00
});
const netdataMonitoring = await page.getByRole('heading', {
name: 'Netdata Monitoring'
2024-06-02 12:55:31 +00:00
});
expect(
systemOverview &&
cpuS &&
2024-06-02 12:55:31 +00:00
disks &&
newtworkStack &&
ipv4 &&
ipv6 &&
2024-06-02 12:55:31 +00:00
networkInterfaces &&
firewall &&
netdataMonitoring
).toBeTruthy();
});
test('Display System Overview Chart', async ({ page }) => {
const diskRead = await page.locator('#easypiechart-system.io-1-chart');
2024-06-02 12:55:31 +00:00
await expect(diskRead).toBeTruthy();
const diskWrite = await page.locator('#easypiechart-system.io-2-chart');
2024-06-02 12:55:31 +00:00
await expect(diskWrite).toBeTruthy();
const cpuGuage = await page.locator('#gauge-system.cpu-3-chart');
await expect(cpuGuage).toBeTruthy();
2024-06-02 12:55:31 +00:00
const netInbound = await page.locator('#easypiechart-system.net-4-chart');
2024-06-02 12:55:31 +00:00
await expect(netInbound).toBeTruthy();
const netOutbound = await page.locator('#easypiechart-system.net-5-chart');
2024-06-02 12:55:31 +00:00
await expect(netOutbound).toBeTruthy();
const userRAM = await page.locator('#easypiechart-system.ram-6-chart');
2024-06-02 12:55:31 +00:00
await expect(userRAM).toBeTruthy();
await expect(
diskRead && diskWrite && cpuGuage && netInbound && netOutbound && userRAM
2024-06-02 12:55:31 +00:00
).toBeTruthy();
});
});