import { test, expect } from '@playwright/test'; import { login } from './helpers/auth'; test.describe('Audit Log', () => { test.beforeEach(async ({ page }) => { await login(page); await page.goto('/audit-log'); }); test('audit log page renders', async ({ page }) => { await expect(page.locator('h1:has-text("Audit Log")')).toBeVisible(); await expect(page.locator('table')).toBeVisible(); }); test('audit log entries load', async ({ page }) => { await page.waitForTimeout(5000); const hasRows = await page.locator('tbody tr').count(); const hasEmpty = await page.locator('text=No audit').isVisible().catch(() => false); expect(hasRows > 0 || hasEmpty).toBeTruthy(); }); test('pagination controls exist when multiple pages', async ({ page }) => { await page.waitForTimeout(3000); // If there are enough logs, pagination should show const prevBtn = page.locator('button:has-text("Prev"), button[disabled]:has-text("Prev")'); if (await prevBtn.isVisible()) { expect(await prevBtn.isVisible()).toBeTruthy(); } }); });