Files
cleveragents-core/robot/tui_smoke.robot
brent.edwards 0ae733d01f feat(tui): implement help panel (F1) with context-sensitive help
Add a dedicated TUI help overlay toggled by F1 and resolve its content from the current prompt mode for main-screen, slash-command, reference, and shell contexts.

Extend Behave and Robot coverage for the new help-panel widget, app wiring, context switching, and toggle behavior.

ISSUES CLOSED: #1013
2026-04-01 21:51:14 +00:00

65 lines
3.3 KiB
Plaintext

*** Settings ***
Library Process
Library String
*** Test Cases ***
TUI Headless Startup Check Returns JSON
${result}= Run Process ${PYTHON} -m cleveragents tui --headless shell=False stderr=STDOUT env:CLEVERAGENTS_DATABASE_URL=sqlite:///:memory:
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} textual_available
Should Contain ${result.stdout} default_persona
TUI Headless Works When Shell Disabled
${result}= Run Process ${PYTHON} -m cleveragents tui --headless shell=False stderr=STDOUT env:CLEVERAGENTS_DATABASE_URL=sqlite:///:memory: env:CLEVERAGENTS_DISABLE_SHELL_MODE=1
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} textual_available
Should Contain ${result.stdout} default_persona
TUI Input Mode Router And Prompt Widget Behavior
${script}= Catenate SEPARATOR=\n
... from cleveragents.tui.input.modes import InputModeRouter
... from cleveragents.tui.widgets.prompt import PromptInput
... prompt = PromptInput()
... prompt.value = "hello"
... payload = prompt.consume_text()
... assert payload.text == "hello"
... assert prompt.value == ""
... router = InputModeRouter(command_handler=lambda raw: f"ok:{raw}")
... command_result = router.process("/help")
... assert command_result.mode.value == "command"
... assert command_result.command_result == "ok:help"
... normal_result = router.process("inspect @README.md")
... assert normal_result.mode.value == "normal"
... print("router-widget-ok")
${result}= Run Process ${PYTHON} -c ${script} shell=False stderr=STDOUT
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} router-widget-ok
TUI Headless Includes Router Help Payload
${result}= Run Process ${PYTHON} -m cleveragents tui --headless shell=False stderr=STDOUT env:CLEVERAGENTS_DATABASE_URL=sqlite:///:memory:
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} "help"
Should Contain ${result.stdout} /persona
TUI Help Panel Context Switching
${script}= Catenate SEPARATOR=\n
... from types import SimpleNamespace
... from features.steps import tui_app_coverage_steps as steps
... context = SimpleNamespace(add_cleanup=lambda fn: None)
... steps._install_mock_textual(context)
... steps.step_create_mock_deps(context)
... steps.step_instantiate_app(context)
... steps.step_call_on_mount(context)
... steps.step_set_prompt_text(context, "/persona list")
... steps.step_call_action_help(context)
... steps.step_help_panel_contains(context, "Help: Slash Commands")
... steps.step_set_prompt_text(context, "!ls")
... steps.step_call_action_help(context)
... steps.step_help_panel_contains(context, "Help: Shell Mode")
... steps._restore_modules(context)
... steps._cleanup_tmpdir(context)
... print("tui-help-panel-ok")
${result}= Run Process ${PYTHON} -c ${script} shell=False stderr=STDOUT
Should Be Equal As Integers ${result.rc} 0
Should Contain ${result.stdout} tui-help-panel-ok