Files
cleveragents-core/features/tui_settings_session_screens.feature
T
HAL9000 bd18f10040 fix(tui): apply ruff format and expand behave coverage for new TUI screens
- session_management.py: collapse three multi-line statements that
  ruff format would otherwise reformat (CI lint gate was failing on
  `ruff format --check`).
- features/tui_settings_session_screens.feature: add three scenarios
  that exercise the previously uncovered paths reported by
  diff_coverage on prior attempts:
  - SettingsScreen.get_settings() returns a settings dict
  - SessionManagementScreen renders sessions when visible+loaded
    (covers the render-loop body + _render_session_details
    non-None branch + the four detail lines)
  - TuiCommandRouter routes "/settings" to _settings_command
- features/steps/tui_settings_session_screens_steps.py:
  - Make `the selected_index should be {index:d}` look up whichever
    screen the scenario created (the step was always referencing
    `context.settings_screen`, which crashed in the
    SessionManagementScreen scenarios).
  - Reuse the existing TuiCommandRouter steps from
    tui_commands_coverage_steps.py for the /settings scenario.

The unit_tests / integration_tests CI gates on the prior run were
red on tests unrelated to this PR (CheckpointRepository and
actor_run_signature.robot, neither touched here); the targeted
behave run for this PR's feature file passes locally with all 12
scenarios green.
2026-06-13 16:54:29 -04:00

92 lines
3.5 KiB
Gherkin

Feature: TUI Settings and Session Management Screens
Implements the Settings screen and Session Management screen
for TUI configuration and session management.
Background:
Given the TUI screens module is imported
# ---------- SettingsScreen ----------
Scenario: SettingsScreen initializes with default settings
Given a SettingsScreen widget
Then the theme should be "dracula"
And the default_actor should be "default"
And the safety_level should be "medium"
Scenario: SettingsScreen shows and hides
Given a SettingsScreen widget
When I show the settings screen
Then the settings screen should be visible
When I hide the settings screen
Then the settings screen should not be visible
Scenario: SettingsScreen navigates settings
Given a SettingsScreen widget that is visible
When I navigate to the next setting
Then the selected_index should be 1
When I navigate to the previous setting
Then the selected_index should be 0
Scenario: SettingsScreen allows setting configuration
Given a SettingsScreen widget
When I set the theme to "light"
And I set the default_actor to "admin"
And I set the safety_level to "high"
Then the theme should be "light"
And the default_actor should be "admin"
And the safety_level should be "high"
Scenario: SettingsScreen returns current settings as dict
Given a SettingsScreen widget
When I set the theme to "light"
And I set the default_actor to "admin"
And I set the safety_level to "high"
Then get_settings should return theme "light", default_actor "admin", safety_level "high"
# ---------- SessionManagementScreen ----------
Scenario: SessionManagementScreen initializes empty
Given a SessionManagementScreen widget
Then the sessions list should be empty
And the current_session_id should be "default"
Scenario: SessionManagementScreen shows and hides
Given a SessionManagementScreen widget
When I show the session management screen
Then the session management screen should be visible
When I hide the session management screen
Then the session management screen should not be visible
Scenario: SessionManagementScreen loads and navigates sessions
Given a SessionManagementScreen widget
When I load 3 sessions
Then the sessions list should have 3 items
When I navigate to the next session
Then the selected_index should be 1
When I navigate to the previous session
Then the selected_index should be 0
Scenario: SessionManagementScreen returns selected session
Given a SessionManagementScreen widget with 3 sessions
When I navigate to the next session
Then get_selected_session should return a SessionInfo object
Scenario: SessionManagementScreen returns None when no sessions
Given a SessionManagementScreen widget
Then get_selected_session should return None
Scenario: SessionManagementScreen renders sessions when visible
Given a SessionManagementScreen widget
When I show the session management screen
And I load 3 sessions
Then the session screen rendered text should contain "Session 1"
And the session screen rendered text should contain "10 msgs"
And the session screen rendered text should contain "[CURRENT]"
# ---------- TuiCommandRouter /settings route ----------
Scenario: TuiCommandRouter routes /settings to settings command
Given a TuiCommandRouter for settings tests
When I call handle with raw input "settings"
Then the handle result should be "Settings screen opened"