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
35 lines
1.5 KiB
TypeScript
Executable File
35 lines
1.5 KiB
TypeScript
Executable File
import { test, expect } from '@playwright/test';
|
|
|
|
test.describe('Analytics', () => {
|
|
test('analytics page loads without redirecting to login', async ({ page }) => {
|
|
await page.goto('/analytics');
|
|
await expect(page).not.toHaveURL(/login/);
|
|
await expect(page.locator('body')).toBeVisible();
|
|
});
|
|
|
|
test('analytics page renders content', async ({ page }) => {
|
|
await page.goto('/analytics');
|
|
const hasContent = await page.locator('text=/analytics|traffic|requests|blocked/i').count() > 0;
|
|
expect(hasContent).toBe(true);
|
|
});
|
|
|
|
test('analytics page shows summary stat cards', async ({ page }) => {
|
|
await page.goto('/analytics');
|
|
// These card headers are rendered by AnalyticsClient
|
|
await expect(page.getByText('Total Requests', { exact: true })).toBeVisible({ timeout: 10000 });
|
|
await expect(page.getByText('Unique IPs', { exact: true })).toBeVisible({ timeout: 10000 });
|
|
await expect(page.getByText('Blocked Requests', { exact: true })).toBeVisible({ timeout: 10000 });
|
|
});
|
|
|
|
test('analytics page has time range toggle buttons', async ({ page }) => {
|
|
await page.goto('/analytics');
|
|
await expect(page.getByRole('button', { name: '24h' })).toBeVisible();
|
|
await expect(page.getByRole('button', { name: '7d' })).toBeVisible();
|
|
});
|
|
|
|
test('analytics page does not show error content', async ({ page }) => {
|
|
await page.goto('/analytics');
|
|
await expect(page.locator('text=/500|internal server error/i')).not.toBeVisible();
|
|
});
|
|
});
|