Files
resolutionflow/frontend/e2e/admin-panel.spec.ts
chihlasm 8b712b2046 test: add Playwright e2e tests for new features and uncovered workflows (#109)
High priority (new PR #108 features):
- Command palette: open/close, search flows, page navigation, FlowPilot handoff
- Fallback branches: add in editor, execute in session runner
- Session-to-flow: verify button appears on completed session detail

Medium priority (existing features without coverage):
- Procedural session: intake form, step-through, completion
- Tree editor: troubleshooting and procedural editor load/edit/save
- FlowPilot chat: page load, new chat creation
- Admin panel: dashboard, user management, settings access

Also adds API helpers: createProceduralTree(), createProceduralTreeWithFallbacks()

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 03:03:23 -04:00

45 lines
1.6 KiB
TypeScript

import { expect, test } from '@playwright/test'
// Note: These tests run as team_admin user (from auth.setup.ts).
// The seeded user is `teamadmin@resolutionflow.example.com` with role team_admin.
// Some admin features may require super_admin — tests gracefully handle access denial.
test.describe('admin panel smoke tests', () => {
test('can access the admin dashboard', async ({ page }) => {
await page.goto('/admin')
// If user has admin access, dashboard should load
// If not (team_admin vs super_admin), may redirect
const hasAccess = await page.getByText(/Admin|Dashboard|Users|Overview/i).isVisible().catch(() => false)
if (hasAccess) {
await expect(page.getByText(/Admin|Dashboard/i)).toBeVisible()
} else {
// Redirected away — team_admin may not have super_admin access
await expect(page).not.toHaveURL(/\/admin/)
}
})
test('can view user management page if super_admin', async ({ page }) => {
await page.goto('/admin/users')
const hasAccess = await page.getByText(/User Management|Users/i).isVisible().catch(() => false)
if (hasAccess) {
await expect(page.getByText(/User Management|Users/i)).toBeVisible()
// Should show a list of users
await expect(page.locator('table, [class*="card"]').first()).toBeVisible({ timeout: 5000 })
}
})
test('can view platform settings page', async ({ page }) => {
await page.goto('/admin/settings')
const hasAccess = await page.getByText(/Settings|Platform/i).isVisible().catch(() => false)
if (hasAccess) {
await expect(page.getByText(/Settings|Platform/i)).toBeVisible()
}
})
})