import { test, expect } from '@playwright/test'; test.describe('General - Dashboard - Router', () => { test.beforeEach(async ({ page }) => { await page.goto('/', { waitUntil: 'networkidle' }); }); test('Title', async ({ page }) => { const title = await page.title(); expect(title).toBe('Difuse - Dashboard - Router'); }); test('Top Cards', async ({ page }) => { const lanClients = await page.getByRole('heading', { name: 'LAN Clients' }); const wifiClients = await page.getByRole('heading', { name: 'GHz & 5 GHz Clients' }); const wgEndpoints = await page.getByRole('heading', { name: 'Peers & Clients' }); expect(lanClients && wifiClients && wgEndpoints).toBeTruthy(); }); test('Basic System Information', async ({ page }) => { const cells = (await page.$$('.tabulator-cell')).filter(async (cell) => { const field = await cell.getAttribute('tabulator-field'); return field === 'value'; }); const currentYear = new Date().getFullYear(); let foundFw = false; let foundUptime = false; for (let i = 0; i < cells.length; i++) { const text = await cells[i].textContent(); if (text.includes('difos')) { foundFw = true; } else if (text.includes(currentYear.toString())) { foundUptime = true; } } expect(foundFw && foundUptime).toBe(true); }); test('Network Information', async ({ page }) => { expect(await page.$('th:has-text("Network Information")')).toBeTruthy(); }); });