import { test, expect } from '@playwright/test'; test.describe('Insights', () => { test('can view insights page', async ({ page }) => { await page.goto('/insights'); await expect(page).toHaveURL(/\/insights/); await expect(page.locator('body')).toBeVisible(); }); test('can filter insights by status', async ({ page }) => { await page.goto('/insights'); // Look for filter tabs/buttons (Active, Dismissed, All, etc.) const filterTabs = page.locator( '[role="tab"], button:has-text("Active"), button:has-text("Dismissed"), button:has-text("All")' ); if ((await filterTabs.count()) > 0) { await filterTabs.first().click(); await page.waitForTimeout(500); } }); test('can filter insights by type', async ({ page }) => { await page.goto('/insights'); // Look for type filters const typeFilter = page.locator( 'button:has-text("Agent"), button:has-text("Device"), select[name*="type"]' ).first(); if (await typeFilter.isVisible()) { await typeFilter.click(); await page.waitForTimeout(500); } }); test('can view insight details', async ({ page }) => { await page.goto('/insights'); // Find first insight item const firstInsight = page.locator('[data-insight], tr, [role="listitem"]').first(); if (await firstInsight.isVisible()) { await firstInsight.click(); await page.waitForTimeout(500); } }); test('can dismiss an insight', async ({ page }) => { await page.goto('/insights'); // Look for dismiss button const dismissButton = page.locator( 'button:has-text("Dismiss"), button:has-text("Mark Dismissed")' ).first(); if (await dismissButton.isVisible()) { await dismissButton.click(); await page.waitForTimeout(500); } }); test('can search insights', async ({ page }) => { await page.goto('/insights'); // Look for search input const searchInput = page.locator('input[type="search"], input[placeholder*="Search"]').first(); if (await searchInput.isVisible()) { await searchInput.fill('test'); await page.waitForTimeout(500); } }); });