agent-zero/tests/test_chat_working_animation.py
frdel 2ec52e1968 Add /stop API and stop-button UI/behavior
Introduce a /stop API handler (api/stop.py) and its DOX to cancel an AgentContext run without deleting the context; it clears pause state, progress and logs an info step. Add tests for stopping behavior, chat working animation, and sidebar timestamp/spacing (tests/*). Update helpers/git._format_git_timestamp to emit UTC timestamps without a timezone suffix and add a test for it. Implement stop-related UI/UX: input-store.js gains a stop state, activateSendButton(), and stopAgent() to call /stop; chat-bar-input.html updates the send button markup, aria-label and stop styles. Update sidebar/chat list CSS to add the working-bubble animation, adjust chat row layout and action-button visibility, and left-sidebar/bottom styling (nowrap timestamp). Modify messages.js to hide kvps.finished from display and complete the active process group when finished. Minor welcome-composer and documentation updates to reflect these behaviors.
2026-07-28 09:26:06 +02:00

60 lines
2.2 KiB
Python

from pathlib import Path
PROJECT_ROOT = Path(__file__).resolve().parents[1]
def test_running_chat_bubble_morphs_and_rotates_on_a_1500ms_cycle() -> None:
chats_list = (
PROJECT_ROOT / "webui/components/sidebar/chats/chats-list.html"
).read_text(encoding="utf-8")
assert ".chats-list-container .project-color-ball.heartbeat" in chats_list
assert (
"animation: chat-working-bubble 1500ms ease-in-out infinite;" in chats_list
)
assert "@keyframes chat-working-bubble" in chats_list
assert "border-radius: 0;" in chats_list
assert "transform: rotate(45deg) scale(0.9);" in chats_list
assert "transform: rotate(405deg) scale(0.9);" in chats_list
assert "transform: rotate(405deg) scale(1);" in chats_list
def test_chat_and_task_rows_reclaim_left_space_without_shifting_headers() -> None:
chats_list = (
PROJECT_ROOT / "webui/components/sidebar/chats/chats-list.html"
).read_text(encoding="utf-8")
left_sidebar = (
PROJECT_ROOT / "webui/components/sidebar/left-sidebar.html"
).read_text(encoding="utf-8")
assert "margin-inline-start: calc(0px - var(--spacing-md));" not in chats_list
assert left_sidebar.count(
"margin-inline-start: calc(0px - var(--spacing-sm));"
) == 2
assert left_sidebar.count("width: calc(100% + var(--spacing-sm));") == 2
assert (
"#chats-section .section-header-row,\n"
" #tasks-section .section-header {\n"
" margin-inline-start: var(--spacing-sm);"
) in left_sidebar
assert "flex: 1 1 auto;" in chats_list
assert "min-width: 0;" in chats_list
assert "padding: 8px 6px;" in chats_list
def test_only_visible_chat_actions_take_width() -> None:
chats_list = (
PROJECT_ROOT / "webui/components/sidebar/chats/chats-list.html"
).read_text(encoding="utf-8")
assert ".device-pointer .chat-container .chat-list-action-btn" in chats_list
assert (
".device-touch .chat-container:not(.chat-selected) .chat-list-action-btn"
in chats_list
)
assert ".device-pointer .chat-container:hover .chat-list-action-btn" in chats_list
assert (
".device-touch .chat-container.chat-selected .chat-list-action-btn"
in chats_list
)