From 4fc96b7f238a2b24c296c417fff393cfe8c00d16 Mon Sep 17 00:00:00 2001 From: Ajas Date: Sun, 2 Jun 2024 23:15:54 +0530 Subject: [PATCH] Check Netdata iframe loading: Change dynamic class name to deterministic and fix lint errors --- tests/dashboards/netdata.spec.js | 74 ++++++++++++++++---------------- 1 file changed, 36 insertions(+), 38 deletions(-) diff --git a/tests/dashboards/netdata.spec.js b/tests/dashboards/netdata.spec.js index 50e6688..a021fe5 100644 --- a/tests/dashboards/netdata.spec.js +++ b/tests/dashboards/netdata.spec.js @@ -1,80 +1,78 @@ -import { test, expect } from "@playwright/test"; +import { test, expect } from '@playwright/test'; -test.describe("General - Dashboard - Netdata", () => { +test.describe('General - Dashboard - Netdata', () => { test.beforeEach(async ({ page }) => { - await page.goto("/dash-netdata", { waitUntil: "load" }); + await page.goto('/dash-netdata', { waitUntil: 'load' }); }); - test("Title", async ({ page }) => { + test('Title', async ({ page }) => { const title = await page.title(); - expect(title).toBe("Difuse - Dashboard - Netdata"); + expect(title).toBe('Difuse - Dashboard - Netdata'); }); - test("Check Netdata iframe loading", async ({ page }) => { - const iframeElement = await page.locator("#netdataFrame"); + test('Check Netdata iframe loading', async ({ page }) => { + const iframeElement = await page.locator('#netdataFrame'); await expect(iframeElement).toBeTruthy(); - const netdataContent = await page.locator( - `//div[@class='flex-sc-1m6gk2e-0 layout__Wrapper-sc-1d05imu-0 frXvTZ kLLhdj']` - ); - expect(netdataContent).toBeTruthy(); + const netDataContent = await page.locator('.charts-body'); + expect(netDataContent).toBeTruthy(); }); - test("Netdata Key Elements", async ({ page }) => { - const systemOverview = await page.getByRole("heading", { - name: "System Overview", + test('Netdata Key Elements', async ({ page }) => { + const systemOverview = await page.getByRole('heading', { + name: 'System Overview' }); - 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", + 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' }); - 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", + 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' }); - const firewall = await page.getByRole("heading", { - name: "Firewall (netfilter)", + const firewall = await page.getByRole('heading', { + name: 'Firewall (netfilter)' }); - const netdataMonitoring = await page.getByRole("heading", { - name: "Netdata Monitoring", + const netdataMonitoring = await page.getByRole('heading', { + name: 'Netdata Monitoring' }); expect( systemOverview && - CPUs && + cpuS && disks && newtworkStack && - Ipv4 && - Ipv6 && + ipv4 && + ipv6 && networkInterfaces && firewall && netdataMonitoring ).toBeTruthy(); }); - test("Display System Overview Chart", async ({ page }) => { - const diskRead = await page.locator("#easypiechart-system.io-1-chart"); + test('Display System Overview Chart', async ({ page }) => { + const diskRead = await page.locator('#easypiechart-system.io-1-chart'); await expect(diskRead).toBeTruthy(); - const diskWrite = await page.locator("#easypiechart-system.io-2-chart"); + const diskWrite = await page.locator('#easypiechart-system.io-2-chart'); await expect(diskWrite).toBeTruthy(); - const CPUguage = await page.locator("#gauge-system.cpu-3-chart"); - await expect(CPUguage).toBeTruthy(); + const cpuGuage = await page.locator('#gauge-system.cpu-3-chart'); + await expect(cpuGuage).toBeTruthy(); - const netInbound = await page.locator("#easypiechart-system.net-4-chart"); + const netInbound = await page.locator('#easypiechart-system.net-4-chart'); await expect(netInbound).toBeTruthy(); - const netOutbound = await page.locator("#easypiechart-system.net-5-chart"); + const netOutbound = await page.locator('#easypiechart-system.net-5-chart'); await expect(netOutbound).toBeTruthy(); - const userRAM = await page.locator("#easypiechart-system.ram-6-chart"); + const userRAM = await page.locator('#easypiechart-system.ram-6-chart'); await expect(userRAM).toBeTruthy(); await expect( - diskRead && diskWrite && CPUguage && netInbound && netOutbound && userRAM + diskRead && diskWrite && cpuGuage && netInbound && netOutbound && userRAM ).toBeTruthy(); }); });