import { test, expect } from '@playwright/test'; import { login } from './helpers/auth'; test.describe('Reports', () => { test.beforeEach(async ({ page }) => { await login(page); await page.goto('/reports'); }); test('reports page renders with KPI cards', async ({ page }) => { await expect(page.locator('h1:has-text("Reports")')).toBeVisible(); await page.waitForTimeout(3000); // At least one KPI card should be visible await expect(page.locator('text=Total Collected, text=Collection, text=Report').first()).toBeVisible(); }); test('collection section renders', async ({ page }) => { await page.waitForTimeout(3000); await expect(page.locator('text=Collection')).toBeVisible(); }); test('page does not crash on load', async ({ page }) => { await page.waitForTimeout(5000); // Page should still have the heading — no JS crash await expect(page.locator('h1:has-text("Reports")')).toBeVisible(); }); });