Files
cleveragents-core/features/ui/tui_interface.feature
freemo 3e93525f4d fix(ui): address TUI/Web review findings
- Add uvicorn dependency to pyproject.toml (verified already present)
- Add network binding warning for non-localhost hosts
- Narrow 12 contextlib.suppress(Exception) to specific NoMatches with debug logging
- Change -h flag to -H for --host to avoid --help conflict
- Improve type safety in _ServiceHolder with explicit method calls
- Fix fragile project ID conversion with proper error handling
- Add TODO for CORS middleware
2026-03-25 01:17:49 +00:00

123 lines
4.4 KiB
Gherkin

Feature: TUI and Web UI interface
As a developer using CleverAgents
I want a TUI dashboard and web UI
So that I can monitor plans, diffs, and validations visually
# --- UIDataProvider ---
Scenario: UIDataProvider returns empty plan list
Given a UIDataProvider backed by mock services
When I request UI plans for project "1"
Then the UI plan list should be empty
Scenario: UIDataProvider returns plan list
Given a UIDataProvider backed by mock services with plans
When I request UI plans for project "1"
Then the UI plan list should contain 2 plans
And the first UI plan name should be "plan-alpha"
Scenario: UIDataProvider returns plan detail
Given a UIDataProvider backed by mock services with plans
When I request UI plan detail for "plan-1"
Then the UI plan detail should have name "plan-alpha"
And the UI plan detail should include decisions
Scenario: UIDataProvider returns None for missing plan detail
Given a UIDataProvider backed by mock services
When I request UI plan detail for "nonexistent"
Then the UI plan detail should be None
Scenario: UIDataProvider returns validations
Given a UIDataProvider backed by mock services
When I request UI validations for plan "plan-1"
Then the UI validations list should be empty
Scenario: UIDataProvider returns diffs
Given a UIDataProvider backed by mock services
When I request UI diffs for plan "plan-1"
Then the UI diffs list should be empty
Scenario: UIDataProvider returns logs
Given a UIDataProvider backed by mock services
When I request UI logs for plan "plan-1" with level "INFO"
Then the UI logs list should be empty
Scenario: UIDataProvider returns sessions
Given a UIDataProvider backed by mock services
When I request UI sessions
Then the UI sessions list should be empty
# --- Configuration ---
Scenario: Default TUI refresh interval
Given default UI settings
Then the TUI refresh interval should be 5
Scenario: Custom TUI refresh interval
Given UI settings with tui_refresh_interval set to 10
Then the TUI refresh interval should be 10
Scenario: Web UI disabled by default
Given default UI settings
Then web_ui_enabled should be false
Scenario: Web UI port default
Given default UI settings
Then web_ui_port should be 8080
# --- Web route responses ---
Scenario: Web UI plan list returns JSON
Given a web UI app backed by mock provider
When I send a GET to UI route "/ui/plans"
Then the UI response status should be 200
And the UI response JSON should contain key "plans"
Scenario: Web UI plan detail returns JSON
Given a web UI app backed by mock provider with plans
When I send a GET to UI route "/ui/plans/plan-1"
Then the UI response status should be 200
And the UI response JSON should contain key "plan_id"
Scenario: Web UI plan detail 404 for missing plan
Given a web UI app backed by mock provider
When I send a GET to UI route "/ui/plans/nonexistent"
Then the UI response status should be 404
And the UI response JSON should contain key "error"
Scenario: Web UI sessions returns JSON
Given a web UI app backed by mock provider
When I send a GET to UI route "/ui/sessions"
Then the UI response status should be 200
And the UI response JSON should contain key "sessions"
Scenario: Web UI diffs returns JSON
Given a web UI app backed by mock provider
When I send a GET to UI route "/ui/diffs/plan-1"
Then the UI response status should be 200
And the UI response JSON should contain key "diffs"
Scenario: Web UI validations returns JSON
Given a web UI app backed by mock provider
When I send a GET to UI route "/ui/validations/plan-1"
Then the UI response status should be 200
And the UI response JSON should contain key "validations"
Scenario: Web UI health endpoint
Given a web UI app backed by mock provider
When I send a GET to UI route "/ui/health"
Then the UI response status should be 200
And the UI response JSON should contain key "status"
# --- CLI commands ---
Scenario: CLI ui tui command is registered
Given the CLI app is loaded for UI testing
Then the "ui" command group should be available
Scenario: CLI ui web rejects when disabled
Given a CLI runner with web UI disabled
When I invoke the UI CLI with "web"
Then the UI CLI should exit with code 1
And the UI CLI output should mention "disabled"