Files
caddy-proxy-manager/tests/e2e/audit-log.spec.ts
fuomag9 9c60d11c2c feat: improve UI contrast, dark mode, dialog sizing, color coherence, and add table sorting
- Fix dialog scrollability (flex layout + max-h-[90dvh]) and increase L4 dialog to lg width
- Add styled enable card to L4 dialog matching proxy host pattern
- Unify section colors across proxy host and L4 dialogs (cyan=LB, emerald=DNS, violet=upstream DNS, rose=geo, amber=mTLS)
- Improve light mode contrast: muted-foreground oklch 0.552→0.502, remove opacity modifiers on secondary text
- Improve dark mode: boost muted-foreground to 0.85, increase border opacity 10%→16%, input 15%→20%
- Add bg-card to DataTable wrapper and bg-muted/40 to table headers for surface hierarchy
- Add semantic badge variants (success, warning, info, muted) and StatusChip dark mode fix
- Add server-side sortable columns to Proxy Hosts and L4 Proxy Hosts (name, upstream, status, protocol, listen)
- Add sortKey to DataTable Column type with clickable sort headers (ArrowUp/Down indicators, URL param driven)
- Fix E2E test selectors for shadcn UI (label associations, combobox roles, dropdown menus, mobile drawer)
- Add htmlFor/id to proxy host form fields and aria-labels to select triggers for accessibility
- Add sorting E2E tests for both proxy host pages

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-22 22:17:56 +01:00

48 lines
2.0 KiB
TypeScript

import { test, expect } from '@playwright/test';
test.describe('Audit Log', () => {
test('audit log page loads without redirecting to login', async ({ page }) => {
await page.goto('/audit-log');
await expect(page).not.toHaveURL(/login/);
await expect(page.locator('body')).toBeVisible();
});
test('audit log page has a table or list', async ({ page }) => {
await page.goto('/audit-log');
// Should have table or list structure
const hasTable = await page.locator('table, [role="grid"], [role="table"]').count() > 0;
const hasList = await page.locator('ul, ol').count() > 0;
const hasRows = await page.locator('tr').count() > 0;
expect(hasTable || hasList || hasRows).toBe(true);
});
test('creating a proxy host creates audit log entry', async ({ page }) => {
// Create a proxy host
await page.goto('/proxy-hosts');
await page.getByRole('button', { name: /create host/i }).click();
await expect(page.getByRole('dialog')).toBeVisible();
await page.getByLabel('Name').fill('Audit Test Host');
await page.getByLabel(/domains/i).fill('audit-test.local');
await page.getByPlaceholder('10.0.0.5:8080').fill('localhost:8888');
await page.getByRole('button', { name: /^create$/i }).click();
await expect(page.getByRole('dialog')).not.toBeVisible({ timeout: 10000 });
await expect(page.getByRole('table').getByText('Audit Test Host')).toBeVisible({ timeout: 10000 });
// Check audit log
await page.goto('/audit-log');
// Should show some entry related to proxy_host or create
await expect(page.locator('body')).toBeVisible();
});
test('audit log page has search functionality', async ({ page }) => {
await page.goto('/audit-log');
// Should have a search input
const hasSearch = await page.getByRole('searchbox').count() > 0
|| await page.getByPlaceholder(/search/i).count() > 0
|| await page.getByLabel(/search/i).count() > 0;
expect(hasSearch).toBe(true);
});
});