feat: add pytest testing dashboard with run history and statistics

Add a new Testing Dashboard page that replaces the old Testing Hub with
pytest integration:

- Database models for test runs, results, and collections (TestRun,
  TestResult, TestCollection)
- Test runner service that executes pytest with JSON reporting and
  stores results in the database
- REST API endpoints for running tests, viewing history, and statistics
- Dashboard UI showing pass rates, trends, tests by category, and top
  failing tests
- Alembic migration for the new test_* tables

The dashboard allows admins to:
- Run pytest directly from the UI
- View test run history with pass/fail statistics
- See trend data across recent runs
- Identify frequently failing tests
- Collect test information without running

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-12 23:04:41 +01:00
parent e6ed4a14dd
commit e3a10b4a53
9 changed files with 1539 additions and 2 deletions

View File

@@ -789,14 +789,33 @@ async def admin_icons_page(
@router.get("/testing", response_class=HTMLResponse, include_in_schema=False)
async def admin_testing_dashboard(
request: Request,
current_user: User = Depends(get_current_admin_from_cookie_or_header),
db: Session = Depends(get_db),
):
"""
Render testing dashboard page.
pytest results and test coverage overview.
"""
return templates.TemplateResponse(
"admin/testing-dashboard.html",
{
"request": request,
"user": current_user,
},
)
@router.get("/testing-hub", response_class=HTMLResponse, include_in_schema=False)
async def admin_testing_hub(
request: Request,
current_user: User = Depends(get_current_admin_from_cookie_or_header),
db: Session = Depends(get_db),
):
"""
Render testing hub page.
Central hub for all test suites and QA tools.
Render manual testing hub page.
Central hub for all manual test suites and QA tools.
"""
return templates.TemplateResponse(
"admin/testing-hub.html",