test: add governance dashboard e2e coverage (#264)

Co-authored-by: bradgroux <brad@digitalmeld.io>
This commit is contained in:
Brad Groux 2026-03-23 20:16:47 -05:00 committed by GitHub
parent c89c5e5d7e
commit 3328a79b3f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 139 additions and 0 deletions

View file

@ -0,0 +1,34 @@
import { test, expect } from '@playwright/test';
import { bypassAuth, cleanupRoutes } from './helpers/auth';
test.describe('Governance dashboard widgets', () => {
test.beforeEach(async ({ page }) => {
await bypassAuth(page);
});
test.afterEach(async ({ page }) => {
await cleanupRoutes(page);
});
test('renders dashboard widgets on the board view', async ({ page }) => {
await page.goto('/', { timeout: 15_000 });
await expect(page.getByText('Loading dashboard…'))
.not.toBeVisible({ timeout: 15_000 })
.catch(() => {});
await expect(
page.getByRole('heading', { name: /dashboard|governance dashboard/i }).first()
).toBeVisible({ timeout: 15_000 });
await expect(
page.locator('text=/Filter|Filters|Time Range|Agent|Status/i').first()
).toBeVisible({ timeout: 15_000 });
await expect(
page
.locator('text=/Success Rate|Token Usage|Average Run Duration|Monthly Budget|Health/i')
.first()
).toBeVisible({ timeout: 15_000 });
});
});

36
e2e/drift-monitor.spec.ts Normal file
View file

@ -0,0 +1,36 @@
import { test, expect } from '@playwright/test';
import { bypassAuth, cleanupRoutes } from './helpers/auth';
test.describe('Drift monitor', () => {
test.beforeEach(async ({ page }) => {
await bypassAuth(page);
});
test.afterEach(async ({ page }) => {
await cleanupRoutes(page);
});
test('renders alerts and baselines sections', async ({ page }) => {
await page.goto('/drift', { timeout: 15_000 });
await expect(page.getByRole('heading', { name: 'Behavioral Drift Monitor' })).toBeVisible({
timeout: 15_000,
});
await expect(page.getByPlaceholder('Agent ID')).toBeVisible();
await expect(page.getByRole('button', { name: 'Analyze Agent' })).toBeVisible();
await expect(page.getByRole('heading', { name: 'Alerts' })).toBeVisible();
await expect(
page.locator('text=/No drift alerts for the current filter\.|Severity|Acknowledge/i').first()
).toBeVisible({ timeout: 15_000 });
await expect(page.getByRole('heading', { name: 'Baselines' })).toBeVisible();
await expect(
page
.locator(
'text=/No drift baselines have been computed yet\.|Reset Agent Baselines|Samples/i'
)
.first()
).toBeVisible({ timeout: 15_000 });
});
});

45
e2e/feedback.spec.ts Normal file
View file

@ -0,0 +1,45 @@
import { test, expect } from '@playwright/test';
import { bypassAuth, cleanupRoutes } from './helpers/auth';
test.describe('Feedback panel', () => {
test.beforeEach(async ({ page }) => {
await bypassAuth(page);
});
test.afterEach(async ({ page }) => {
await cleanupRoutes(page);
});
test('renders feedback browse state and filters', async ({ page }) => {
await page.goto('/', { timeout: 15_000 });
await expect(page.getByRole('heading', { name: 'User Feedback' })).toBeVisible({
timeout: 15_000,
});
await page.getByRole('tab', { name: 'Browse' }).click();
await expect(page.getByPlaceholder('Filter by agent')).toBeVisible({ timeout: 15_000 });
await expect(
page
.locator('button[role="combobox"]')
.filter({ hasText: /Sentiment|All sentiments/i })
.first()
).toBeVisible();
await expect(
page
.locator('button[role="combobox"]')
.filter({ hasText: /Category|All categories/i })
.first()
).toBeVisible();
await expect(
page
.locator('button[role="combobox"]')
.filter({ hasText: /Status|All statuses|Unresolved|Resolved/i })
.first()
).toBeVisible();
await expect(
page.locator('text=/No feedback found\.|Loading…|Resolved|Unresolved/i').first()
).toBeVisible({ timeout: 15_000 });
});
});

View file

@ -0,0 +1,24 @@
import { test, expect } from '@playwright/test';
import { bypassAuth, cleanupRoutes } from './helpers/auth';
test.describe('Prompt registry', () => {
test.beforeEach(async ({ page }) => {
await bypassAuth(page);
});
test.afterEach(async ({ page }) => {
await cleanupRoutes(page);
});
test('renders templates view and create controls', async ({ page }) => {
await page.goto('/templates', { timeout: 15_000 });
await expect(page.getByRole('button', { name: 'Templates' })).toBeVisible({ timeout: 15_000 });
await expect(page.getByText('Prompt Templates')).toBeVisible({ timeout: 15_000 });
await expect(page.getByRole('button', { name: /new template/i })).toBeVisible();
await expect(
page.locator('text=/No description|Variables:|Loading templates|Prompt Templates/i').first()
).toBeVisible({ timeout: 15_000 });
});
});