Files
caddy-proxy-manager/tests/e2e/dashboard.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

52 lines
2.0 KiB
TypeScript
Executable File

/**
* E2E tests: Dashboard (overview) home page.
*
* Verifies stat cards, navigation links, welcome header, and recent activity.
*/
import { test, expect } from '@playwright/test';
test.describe('Dashboard home page', () => {
test.beforeEach(async ({ page }) => {
await page.goto('/');
});
test('displays welcome header with user name', async ({ page }) => {
await expect(page.getByText(/welcome back/i)).toBeVisible();
});
test('shows stat cards for Proxy Hosts, Certificates, and Access Lists', async ({ page }) => {
// Stat card labels are <p> inside link cards — match via the parent link
await expect(page.getByRole('link', { name: /^\d+\s+Proxy Hosts/ })).toBeVisible();
await expect(page.getByRole('link', { name: /\d+\s*Certificates/ })).toBeVisible();
await expect(page.getByRole('link', { name: /\d+\s*Access Lists/ })).toBeVisible();
});
test('shows Traffic (24h) card', async ({ page }) => {
await expect(page.getByText('Traffic (24h)')).toBeVisible();
});
test('stat card links navigate to correct pages', async ({ page }) => {
await page.getByRole('link', { name: /proxy hosts/i }).first().click();
await expect(page).toHaveURL(/\/proxy-hosts/);
});
test('Certificates stat card navigates to /certificates', async ({ page }) => {
await page.getByRole('link', { name: /certificates/i }).first().click();
await expect(page).toHaveURL(/\/certificates/);
});
test('Access Lists stat card navigates to /access-lists', async ({ page }) => {
await page.getByRole('link', { name: /access lists/i }).first().click();
await expect(page).toHaveURL(/\/access-lists/);
});
test('Traffic card navigates to /analytics', async ({ page }) => {
await page.getByRole('link', { name: /traffic/i }).first().click();
await expect(page).toHaveURL(/\/analytics/);
});
test('shows Recent Activity section', async ({ page }) => {
await expect(page.getByText(/recent activity/i)).toBeVisible();
});
});