Files
caddy-proxy-manager/tests/e2e/audit-log.spec.ts
akanealw 99819b70ff
Some checks failed
Build and Push Docker Images (Trusted) / build-and-push (., docker/caddy/Dockerfile, caddy) (push) Has been cancelled
Build and Push Docker Images (Trusted) / build-and-push (., docker/l4-port-manager/Dockerfile, l4-port-manager) (push) Has been cancelled
Build and Push Docker Images (Trusted) / build-and-push (., docker/web/Dockerfile, web) (push) Has been cancelled
Tests / test (push) Has been cancelled
added caddy-proxy-manager for testing
2026-04-21 22:49:08 +00:00

48 lines
2.0 KiB
TypeScript
Executable File

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);
});
});