8ea00f5185
CI / unit_tests (push) Has been cancelled
CI / benchmark-publish (push) Has been cancelled
CI / lint (push) Has been cancelled
CI / typecheck (push) Has been cancelled
CI / security (push) Has been cancelled
CI / quality (push) Has been cancelled
CI / integration_tests (push) Has been cancelled
CI / e2e_tests (push) Has been cancelled
CI / coverage (push) Has been cancelled
CI / benchmark-regression (push) Has been cancelled
CI / build (push) Has been cancelled
CI / push-validation (push) Has been cancelled
CI / status-check (push) Has been cancelled
CI / docker (push) Has been cancelled
CI / helm (push) Has been cancelled
Co-authored-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me> Co-committed-by: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
98 lines
4.9 KiB
Plaintext
98 lines
4.9 KiB
Plaintext
*** Settings ***
|
|
Library Process
|
|
Library String
|
|
|
|
*** Test Cases ***
|
|
TUI Headless Startup Check Returns JSON
|
|
[Tags] tdd_issue tdd_issue_4193 tdd_issue_4297
|
|
${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
|
|
[Tags] tdd_issue tdd_issue_4193 tdd_issue_4297
|
|
${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
|
|
[Tags] tdd_issue tdd_issue_4193 tdd_issue_4297 tdd_expected_fail
|
|
${script}= Catenate SEPARATOR=\n
|
|
... from cleveragents.tui.input.modes import InputModeRouter
|
|
... from cleveragents.tui.widgets.prompt import PromptInput
|
|
... prompt = PromptInput()
|
|
... prompt.value = "hello"
|
|
... prompt.action_submit()
|
|
... assert prompt.value == "", f"Expected cleared prompt after submit, got: {prompt.value!r}"
|
|
... print("prompt-widget-ok")
|
|
${result}= Run Process ${PYTHON} -c ${script} shell=False
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} prompt-widget-ok
|
|
|
|
TUI Chat History Widget Behavior
|
|
[Tags] tdd_issue tdd_issue_4193 tdd_issue_4297 tdd_expected_fail
|
|
${script}= Catenate SEPARATOR=\n
|
|
... from cleveragents.tui.widgets.history import ChatHistory
|
|
... from cleveragents.tui.events import MessageEvent, MessageType
|
|
... from textual.app import App
|
|
... import asyncio
|
|
... class TestApp(App):
|
|
... async def on_mount(self):
|
|
... hist = ChatHistory()
|
|
... await self.mount(hist)
|
|
... msg_ev = MessageEvent(msg_type=MessageType.USER, content="Test message")
|
|
... await hist.post_message_event(msg_ev)
|
|
... # Just verify it doesn't crash
|
|
... self.exit(0)
|
|
... app = TestApp()
|
|
... asyncio.run(app.run_async())
|
|
... print("chat-history-ok")
|
|
${result}= Run Process ${PYTHON} -c ${script} shell=False
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} chat-history-ok
|
|
|
|
TUI Screen Stack And Overlay Behavior
|
|
[Tags] tdd_issue tdd_issue_4193 tdd_issue_4297 tdd_expected_fail
|
|
${script}= Catenate SEPARATOR=\n
|
|
... from textual.app import App
|
|
... from textual.screen import Screen
|
|
... from cleveragents.tui.screens.examples import ExamplesScreen
|
|
... import asyncio
|
|
... class TestApp(App):
|
|
... async def on_mount(self):
|
|
... # Push examples screen as overlay
|
|
... examples = ExamplesScreen()
|
|
... examples.can_replace = False # Makes it an overlay
|
|
... await self.push_screen(examples)
|
|
... # Verify stack depth
|
|
... assert len(self.screen_stack) == 2, "Expected 2 screens after overlay push"
|
|
... # Pop overlay
|
|
... await self.pop_screen()
|
|
... assert len(self.screen_stack) == 1, "Expected 1 screen after overlay pop"
|
|
... self.exit(0)
|
|
... app = TestApp()
|
|
... asyncio.run(app.run_async())
|
|
... print("screen-stack-ok")
|
|
${result}= Run Process ${PYTHON} -c ${script} shell=False
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} screen-stack-ok
|
|
|
|
TUI Shell Mode Detection
|
|
[Tags] tdd_issue tdd_issue_4193 tdd_issue_4297 tdd_expected_fail
|
|
${script}= Catenate SEPARATOR=\n
|
|
... import os
|
|
... # Test shell mode enabled (default)
|
|
... os.environ.pop('CLEVERAGENTS_DISABLE_SHELL_MODE', None)
|
|
... from cleveragents.config import get_config
|
|
... cfg = get_config()
|
|
... assert cfg.enable_shell_mode is True, f"Expected shell mode enabled, got: {cfg.enable_shell_mode}"
|
|
... # Test shell mode disabled
|
|
... os.environ['CLEVERAGENTS_DISABLE_SHELL_MODE'] = '1'
|
|
... cfg = get_config()
|
|
... assert cfg.enable_shell_mode is False, f"Expected shell mode disabled, got: {cfg.enable_shell_mode}"
|
|
... print("shell-mode-detection-ok")
|
|
${result}= Run Process ${PYTHON} -c ${script} shell=False
|
|
Should Be Equal As Integers ${result.rc} 0
|
|
Should Contain ${result.stdout} shell-mode-detection-ok |