docs: cerrar issue 0023 — seccion de tests en dashboard
Mover issue a completed/ y actualizar README. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -30,3 +30,4 @@ afectados y notas de implementacion.
|
||||
| 22a | E2E: Infraestructura base | [0022a-e2e-infra.md](completed/0022a-e2e-infra.md) | completado |
|
||||
| 22b | E2E: Auth fixtures y helpers | [0022b-e2e-auth-helpers.md](completed/0022b-e2e-auth-helpers.md) | completado |
|
||||
| 22c | E2E: Tests de agentes + docs | [0022c-e2e-agent-tests.md](completed/0022c-e2e-agent-tests.md) | completado |
|
||||
| 23 | Seccion de tests en dashboard | [0023-dashboard-tests.md](completed/0023-dashboard-tests.md) | completado |
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
# 0023 — Seccion de tests en el dashboard
|
||||
|
||||
## Objetivo
|
||||
|
||||
Añadir una opcion "Tests" al menu principal del dashboard TUI que permita ejecutar tests de Go (`go test`) y tests E2E (Playwright) de forma independiente, con salida en tiempo real y resumen de resultados.
|
||||
|
||||
## Contexto
|
||||
|
||||
- El dashboard actual (`cmd/dashboard/`) tiene un "Run Tests" en el menu Server que solo ejecuta `go test -tags goolm ./...`
|
||||
- Los tests E2E existen en `e2e/` y se ejecutan con `./dev-scripts/e2e/run.sh`
|
||||
- No hay forma de ejecutar E2E desde el dashboard ni de elegir que tipo de tests correr
|
||||
- El dashboard sigue el patron pure core (`pkg/tui/`) + impure shell (`shell/tui/adapter.go`)
|
||||
|
||||
## Arquitectura
|
||||
|
||||
```
|
||||
pkg/tui/model.go — nuevo ScreenTests, TestKind, campos de estado
|
||||
pkg/tui/update.go — logica pura para pantalla Tests (navegacion, seleccion)
|
||||
pkg/tui/view.go — render de la pantalla Tests (menu + output)
|
||||
pkg/tui/messages.go — nuevos mensajes: MsgTestsRunning, MsgTestOutput (streaming)
|
||||
shell/tui/adapter.go — nuevos intents: IntentRunGoTests, IntentRunE2ETests, IntentRunAllTests
|
||||
```
|
||||
|
||||
### Patron pure core / impure shell
|
||||
|
||||
- `pkg/tui/` — tipos de pantalla, opciones de menu, logica de navegacion, formateo de output. Todo puro.
|
||||
- `shell/tui/` — ejecucion real de `go test` y `./dev-scripts/e2e/run.sh`. Impuro.
|
||||
- No se necesitan cambios en `agents/`, `tools/`, ni `shell/` fuera de `shell/tui/`.
|
||||
|
||||
## Tareas
|
||||
|
||||
### Fase 1: Menu principal — nueva opcion "Tests"
|
||||
|
||||
- [ ] **1.1** Añadir `ScreenTests` al enum de screens en `pkg/tui/model.go`
|
||||
- [ ] **1.2** Añadir opcion "Tests" al `MainMenuOptions()` (entre "Server" y "Quit")
|
||||
- [ ] **1.3** Manejar seleccion de "Tests" en `updateMainScreen` — navegar a `ScreenTests`
|
||||
|
||||
### Fase 2: Pantalla de tests — menu de seleccion
|
||||
|
||||
- [ ] **2.1** Crear `TestMenuOptions()` en `model.go` con las opciones:
|
||||
- "Go Tests" — `go test -tags goolm -count=1 ./...`
|
||||
- "E2E Tests" — `./dev-scripts/e2e/run.sh`
|
||||
- "E2E Tests (headed)" — `./dev-scripts/e2e/run.sh --headed`
|
||||
- "All Tests" — Go tests + E2E secuencial
|
||||
- [ ] **2.2** Crear `updateTestsScreen` en `update.go` — navegacion y seleccion de tipo de test
|
||||
- [ ] **2.3** Crear `viewTests` en `view.go` — menu con las opciones y ultimo resultado (PASSED/FAILED/no ejecutado)
|
||||
|
||||
### Fase 3: Ejecucion y output
|
||||
|
||||
- [ ] **3.1** Añadir intents nuevos: `IntentRunGoTests`, `IntentRunE2ETests`, `IntentRunAllTests`
|
||||
- [ ] **3.2** Refactorizar el `runTests()` actual del adapter para que sea `runGoTests()`, reutilizable
|
||||
- [ ] **3.3** Implementar `runE2ETests(headed bool)` en el adapter — ejecuta `./dev-scripts/e2e/run.sh [--headed]`
|
||||
- [ ] **3.4** Implementar `runAllTests()` — ejecuta Go tests primero, luego E2E, combina output
|
||||
- [ ] **3.5** Reutilizar `ScreenTestOutput` existente para mostrar resultados (ya tiene scroll y re-run)
|
||||
- [ ] **3.6** Adaptar `updateTestOutput` para que "r" re-ejecute el mismo tipo de test (no siempre Go)
|
||||
|
||||
### Fase 4: Estado y UX
|
||||
|
||||
- [ ] **4.1** Añadir campo `LastTestKind` al Model para saber que re-ejecutar con "r"
|
||||
- [ ] **4.2** Mostrar indicador "Running..." mientras se ejecutan los tests
|
||||
- [ ] **4.3** El boton "0" desde test output vuelve a `ScreenTests` (no a Server)
|
||||
|
||||
### Fase 5: Limpiar intent antiguo
|
||||
|
||||
- [ ] **5.1** Eliminar `IntentRunTests` del menu Server y reemplazar por navegacion a `ScreenTests`
|
||||
- [ ] **5.2** Mantener retrocompatibilidad: "Run Tests" en Server menu ahora navega a la pantalla Tests
|
||||
|
||||
### Fase 6: Tests
|
||||
|
||||
- [ ] **6.1** Tests unitarios para `TestMenuOptions()` — verifica opciones correctas
|
||||
- [ ] **6.2** Tests unitarios para `updateTestsScreen` — navegacion, seleccion, generacion de intents
|
||||
- [ ] **6.3** Tests unitarios para `viewTests` — render correcto con distintos estados
|
||||
- [ ] **6.4** Verificar que `go build -tags goolm ./...` compila
|
||||
|
||||
### Fase 7: Cleanup
|
||||
|
||||
- [ ] **7.1** Actualizar seccion del dashboard en `CLAUDE.md` si es necesario
|
||||
|
||||
---
|
||||
|
||||
## Ejemplo de uso
|
||||
|
||||
```
|
||||
Bot Server Dashboard
|
||||
────────────────────────────────────
|
||||
2 agents (2 running, 0 stopped, 0 disabled)
|
||||
|
||||
Agents Gestionar agentes
|
||||
Server Gestionar launcher unificado
|
||||
> Tests Ejecutar tests
|
||||
Quit Salir
|
||||
|
||||
[enter]
|
||||
|
||||
Tests
|
||||
────────────────────────────────────
|
||||
> Go Tests go test ./...
|
||||
E2E Tests Playwright headless
|
||||
E2E Tests (headed) Playwright con browser
|
||||
All Tests Go + E2E secuencial
|
||||
|
||||
Last run: Go Tests — PASSED
|
||||
|
||||
↑↓ navegar enter ejecutar 0 volver
|
||||
|
||||
[enter en "E2E Tests"]
|
||||
|
||||
Test Results — E2E Tests
|
||||
────────────────────────────────────────────────────────
|
||||
Running tests...
|
||||
|
||||
(output va apareciendo)
|
||||
|
||||
↑↓ scroll r re-ejecutar 0 volver
|
||||
```
|
||||
|
||||
## Decisiones de diseno
|
||||
|
||||
- **Menu separado en vez de submenu de Server**: los tests son una actividad frecuente e independiente del estado del servidor. Merecen acceso directo desde el menu principal.
|
||||
- **Reutilizar ScreenTestOutput**: ya existe toda la logica de scroll, re-run y visualizacion. Solo hay que parametrizar el tipo de test.
|
||||
- **E2E headed como opcion separada**: util para debugging, pero no es el caso comun. Opcion explicita evita flags ocultos.
|
||||
- **"All Tests" secuencial**: Go tests son rapidos, E2E lentos. Ejecutar Go primero permite fail-fast.
|
||||
|
||||
## Prerequisitos
|
||||
|
||||
- Dashboard funcional (ya existe)
|
||||
- E2E tests configurados (`e2e/.env` con credenciales) — si no estan configurados, el E2E fallara con mensaje claro
|
||||
|
||||
## Riesgos
|
||||
|
||||
- **E2E sin configurar**: si `e2e/.env` no existe, el script fallara. Mitigacion: capturar el error y mostrar mensaje descriptivo en el output ("E2E not configured — run ./dev-scripts/e2e/install.sh").
|
||||
- **E2E headed sin display**: en servidores sin X/Wayland, `--headed` fallara. Mitigacion: el error de Playwright es claro, se muestra en el output.
|
||||
Reference in New Issue
Block a user