Files
webui/tests/test_sprint20b.py
nesquena-hermes ede1a5fc50 feat: composer-centric UI refresh + Hermes Control Center (v0.50.0, closes #242)
* Polish workspace panel behavior and app dialogs

* Replace remaining emoji UI glyphs with Lucide icons

* Redesign composer footer around model and context controls

Move the model selector into the composer footer, replace the linear context pill with a compact circular badge plus tooltip, and remove the redundant topbar model pill.

Design credit and inspiration: Theo / T3 Code.
Reference implementation: https://github.com/pingdotgg/t3code/

* Remove obsolete activity bar

Drop the old activity bar, keep turn-scoped state in the composer footer, and route remaining non-chat status messages through toasts.

This leaves live tool cards and the message timeline as the primary progress UI, with the composer owning stop/cancel and brief turn status.

* Move workspace and model switching into composer footer

* Move profile switching into composer footer

* Refactor Hermes control center UI

* Redesign control center settings modal layout

Widen the modal to 860px, simplify the tab list to icon+label rows,
stretch the tab column's divider to full height, lock the panel to a
fixed height so switching tabs no longer resizes the outer shell, and
always open on the Conversation tab.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Put session item actions in a dropdown

* Use Hermes mark in sidebar control button

* Reset control center section on close

* Drop session-item left border indicator

Remove the left-border accent used for active, CLI, and project rows —
each state already has a dedicated cue (gold fill, cli badge, project
dot), so the border was redundant. Fully round the row, add 2px
bottom spacing between rows, and strip the matching JS/CSS overrides.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Increase session search input vertical padding

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Normalise odd pixel values across UI

Snap padding, gap, and border-radius values to the 2/4/6/8/10/12 grid
across composer chips, sidebar panels, cron list, settings, approval
buttons, dropdowns, and inline message edit — eliminating the 7/9/11px
drift that was making sibling elements feel subtly misaligned.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Add missing #btnMobileFiles button and .mobile-files-btn CSS (for mobile QA suite)

The mobile layout regression suite (test_mobile_layout.py) requires:
- #btnMobileFiles onclick=toggleMobileFiles() in topbar chips
- .mobile-files-btn CSS rules for responsive show/hide at 640/900px breakpoints

Also adds max-width guard to .profile-dropdown to prevent clipping at narrow viewports.

* Improve composer footer mobile responsiveness and UX

- Collapse composer chips to icon-only at <=400px viewports
- Add model chip icon (CPU) so it remains tappable when labels are hidden
- Show send button always (disabled state when empty, hidden during streaming)
- Show context usage indicator on session load, not just after streaming
- Add cancel status fallback timeout to prevent stale "Cancelling..." text
- Update tests to match new send button and busy state behavior

* Fix duplicate files button and broken workspace close on mobile

Remove redundant #btnMobileFiles button that duplicated #btnWorkspacePanelToggle
in the mobile topbar. Fix workspace panel close button calling undefined
closeMobileFiles() — now calls closeWorkspacePanel().

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Fix model chip icon vertical alignment in composer footer

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Fix workspace toggle button hidden on desktop by conflicting CSS class

Remove mobile-files-btn class from #btnWorkspacePanelToggle — its
display:none!important rule was overriding workspace-toggle-btn visibility
on non-mobile viewports.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Fix session actions dots button inaccessible on mobile sidebar

Always show the session actions trigger on mobile (no hover state on
touch devices) and restore right padding so text truncates with
ellipsis before the dots icon.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Fix composer footer manage links not opening sidebar panel

The "Manage profiles" and "Manage workspaces" links in the composer
footer dropdowns called switchPanel() which only changes the active
panel content but doesn't open the sidebar. Replaced with
mobileSwitchPanel() which also opens the sidebar so the panel is
actually visible.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Widen icon-only composer chips breakpoint from 400px to 768px

Move the icon-only chip styling up into the existing max-width:768px
media query so chips collapse to icon-only on tablets too, preventing
composer footer overflow on mid-size screens.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* Fix composer-left vertical scrollbar by setting overflow-y:hidden

When overflow-x is set to auto, the CSS spec implicitly changes
overflow-y from visible to auto, allowing a vertical scrollbar to
appear from slight chip padding/border overflow. Explicitly set
overflow-y:hidden to prevent this.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: resolve rebase conflicts and fix control center test assertions

- Resolved 4 conflicts during rebase onto master (workspace.js,
  boot.js, index.html, test_sprint34.py)
- Fixed test_sprint34.py: _controlSection -> _settingsSection,
  cc-tab -> settings-tabs (matching actual implementation)
- Fixed quoting syntax error in test assertion

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* fix: update version badge in System tab to v0.49.4

* docs: update README and CHANGELOG for v0.50.0 UI refresh, bump version badge

---------

Co-authored-by: Aron Prins <pwf.aron@gmail.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Nathan Esquenazi <nesquena@gmail.com>
2026-04-12 11:55:40 -07:00

342 lines
12 KiB
Python

"""
Sprint 21 Tests: Send button polish — hidden until content, pop-in animation,
icon-only circle design.
"""
import re
import urllib.request
BASE = "http://127.0.0.1:8788"
def get_text(path):
with urllib.request.urlopen(BASE + path, timeout=10) as r:
return r.read().decode(), r.status
# ── index.html ────────────────────────────────────────────────────────────
def test_send_button_present():
"""btnSend must still exist in the DOM."""
html, status = get_text("/")
assert status == 200
assert 'id="btnSend"' in html
def test_send_button_disabled_by_default():
"""btnSend must start disabled — enabled only when there is content."""
html, _ = get_text("/")
btn_match = re.search(r'id="btnSend"[^>]*>', html)
assert btn_match, "btnSend element not found"
assert 'disabled' in btn_match.group(0)
def test_send_button_no_text_label():
"""Send button must be icon-only — no visible 'Send' text label."""
html, _ = get_text("/")
# Find the full button element (from opening tag to closing tag)
btn_open_end = html.find('>', html.find('id="btnSend"')) + 1
btn_end = html.find('</button>', btn_open_end) + len('</button>')
btn_inner = html[btn_open_end:btn_end]
# Strip SVG content and any remaining tags; check visible text
no_svg = re.sub(r'<svg[^>]*>.*?</svg>', '', btn_inner, flags=re.DOTALL)
visible_text = re.sub(r'<[^>]+>', '', no_svg).strip()
assert visible_text == '', f"Send button has visible text: {visible_text!r}"
def test_send_button_has_svg_icon():
"""Send button must have an SVG icon."""
html, _ = get_text("/")
btn_start = html.find('id="btnSend"')
btn_end = html.find('</button>', btn_start) + len('</button>')
btn_html = html[btn_start:btn_end]
assert '<svg' in btn_html
def test_send_button_has_title_attribute():
"""btnSend must have a title attribute for accessibility (replaces text label)."""
html, _ = get_text("/")
btn_match = re.search(r'id="btnSend"[^>]*>', html)
assert btn_match
assert 'title=' in btn_match.group(0)
def test_send_button_svg_arrow_up():
"""Send button SVG should use an upward arrow (line + polyline or path)."""
html, _ = get_text("/")
btn_start = html.find('id="btnSend"')
btn_end = html.find('</button>', btn_start) + len('</button>')
btn_html = html[btn_start:btn_end]
# Must have some directional shape element
has_shape = ('<line' in btn_html or '<polyline' in btn_html or
'<polygon' in btn_html or '<path' in btn_html)
assert has_shape, "Send button SVG missing directional shape"
# ── style.css ────────────────────────────────────────────────────────────
def test_send_btn_is_circle():
"""send-btn must use border-radius:50% for the circle shape."""
css, status = get_text("/static/style.css")
assert status == 200
send_idx = css.find('.send-btn{')
brace_open = css.find('{', send_idx)
brace_close = css.find('}', brace_open)
rule = css[brace_open:brace_close]
assert 'border-radius:50%' in rule or 'border-radius: 50%' in rule
def test_send_btn_fixed_dimensions():
"""send-btn must have explicit width and height (icon-circle, not text-padded)."""
css, _ = get_text("/static/style.css")
send_idx = css.find('.send-btn{')
brace_open = css.find('{', send_idx)
brace_close = css.find('}', brace_open)
rule = css[brace_open:brace_close]
assert 'width:' in rule or 'width :' in rule
assert 'height:' in rule or 'height :' in rule
def test_send_btn_no_old_padding():
"""send-btn must not use text padding layout (old pill style removed)."""
css, _ = get_text("/static/style.css")
send_idx = css.find('.send-btn{')
brace_open = css.find('{', send_idx)
brace_close = css.find('}', brace_open)
rule = css[brace_open:brace_close]
# Old style used padding:7px 18px — should be gone
assert 'padding:7px' not in rule and 'padding: 7px' not in rule
def test_send_btn_blue_background():
"""send-btn background must use the blue accent (#7cb9ff or similar)."""
css, _ = get_text("/static/style.css")
send_idx = css.find('.send-btn{')
brace_open = css.find('{', send_idx)
brace_close = css.find('}', brace_open)
rule = css[brace_open:brace_close]
assert '7cb9ff' in rule or '5ba8f5' in rule or 'var(--blue)' in rule
def test_send_btn_has_transition():
"""send-btn must have transition for smooth hover/active states."""
css, _ = get_text("/static/style.css")
send_idx = css.find('.send-btn{')
brace_open = css.find('{', send_idx)
brace_close = css.find('}', brace_open)
rule = css[brace_open:brace_close]
assert 'transition' in rule
def test_send_btn_has_box_shadow():
"""send-btn must have a box-shadow glow effect."""
css, _ = get_text("/static/style.css")
send_idx = css.find('.send-btn{')
brace_open = css.find('{', send_idx)
brace_close = css.find('}', brace_open)
rule = css[brace_open:brace_close]
assert 'box-shadow' in rule
def test_send_btn_hover_has_scale():
"""send-btn:hover must use transform:scale for a satisfying hover effect."""
css, _ = get_text("/static/style.css")
hover_idx = css.find('.send-btn:hover{')
brace_open = css.find('{', hover_idx)
brace_close = css.find('}', brace_open)
rule = css[brace_open:brace_close]
assert 'scale' in rule
def test_send_btn_active_shrinks():
"""send-btn:active must scale down slightly for tactile press feedback."""
css, _ = get_text("/static/style.css")
active_idx = css.find('.send-btn:active{')
brace_open = css.find('{', active_idx)
brace_close = css.find('}', brace_open)
rule = css[brace_open:brace_close]
assert 'scale' in rule
def test_send_btn_disabled_rule_exists():
"""send-btn:disabled must still be styled."""
css, _ = get_text("/static/style.css")
assert '.send-btn:disabled' in css
def test_send_btn_visible_class_defined():
""".send-btn.visible class must be defined for the pop-in animation."""
css, _ = get_text("/static/style.css")
assert '.send-btn.visible' in css
def test_send_pop_in_keyframes_defined():
"""@keyframes send-pop-in must be defined."""
css, _ = get_text("/static/style.css")
assert 'send-pop-in' in css
assert '@keyframes' in css
def _extract_keyframe(css, name):
"""Extract the full @keyframes block for the given animation name."""
# Find '@keyframes <name>' directly (forward search) to avoid hitting
# an earlier keyframe when multiple are defined on the same line.
kf_start = css.find('@keyframes ' + name)
assert kf_start != -1, f"@keyframes {name} not found in CSS"
depth = 0
kf_end = kf_start
for i, ch in enumerate(css[kf_start:], kf_start):
if ch == '{':
depth += 1
elif ch == '}':
depth -= 1
if depth == 0:
kf_end = i
break
return css[kf_start:kf_end]
def test_send_pop_in_uses_scale():
"""send-pop-in keyframe must animate from a scaled-down state."""
css, _ = get_text("/static/style.css")
kf_rule = _extract_keyframe(css, 'send-pop-in')
assert 'scale' in kf_rule
def test_send_pop_in_uses_opacity():
"""send-pop-in keyframe must fade in (opacity transition)."""
css, _ = get_text("/static/style.css")
kf_rule = _extract_keyframe(css, 'send-pop-in')
assert 'opacity' in kf_rule
def test_send_btn_mobile_override_no_padding():
"""Mobile override for send-btn must not add text padding (keeps circle shape)."""
css, _ = get_text("/static/style.css")
# Find the @media block
media_idx = css.find('@media')
send_mobile_idx = css.find('.send-btn', media_idx)
if send_mobile_idx == -1:
return # No mobile override, fine
brace_open = css.find('{', send_mobile_idx)
brace_close = css.find('}', brace_open)
rule = css[brace_open:brace_close]
assert 'padding:' not in rule and 'font-size' not in rule
# ── ui.js ─────────────────────────────────────────────────────────────────
def test_ui_js_update_send_btn_function():
"""ui.js must define updateSendBtn() function."""
js, status = get_text("/static/ui.js")
assert status == 200
assert 'function updateSendBtn' in js
def test_update_send_btn_checks_content():
"""updateSendBtn must check textarea value length."""
js, _ = get_text("/static/ui.js")
fn_idx = js.find('function updateSendBtn')
fn_end = js.find('\n}', fn_idx) + 2
fn_body = js[fn_idx:fn_end]
assert 'msg' in fn_body
assert '.value' in fn_body
assert '.length' in fn_body or '.trim()' in fn_body
def test_update_send_btn_checks_pending_files():
"""updateSendBtn must also show send button when files are attached."""
js, _ = get_text("/static/ui.js")
fn_idx = js.find('function updateSendBtn')
fn_end = js.find('\n}', fn_idx) + 2
fn_body = js[fn_idx:fn_end]
assert 'pendingFiles' in fn_body
def test_update_send_btn_uses_visible_class():
"""updateSendBtn must add .visible class to trigger the pop-in animation."""
js, _ = get_text("/static/ui.js")
fn_idx = js.find('function updateSendBtn')
fn_end = js.find('\n}', fn_idx) + 2
fn_body = js[fn_idx:fn_end]
assert 'visible' in fn_body
def test_update_send_btn_uses_disabled():
"""updateSendBtn must disable the button when no content or busy."""
js, _ = get_text("/static/ui.js")
fn_idx = js.find('function updateSendBtn')
fn_end = js.find('\n}', fn_idx) + 2
fn_body = js[fn_idx:fn_end]
assert 'disabled' in fn_body
def test_set_busy_calls_update_send_btn():
"""setBusy must call updateSendBtn() so button hides while agent is responding."""
js, _ = get_text("/static/ui.js")
busy_idx = js.find('function setBusy')
busy_end = js.find('\n}', busy_idx) + 2
busy_body = js[busy_idx:busy_end]
assert 'updateSendBtn' in busy_body
def test_render_tray_calls_update_send_btn():
"""renderTray must call updateSendBtn() so button appears when files are attached."""
js, _ = get_text("/static/ui.js")
tray_idx = js.find('function renderTray')
tray_end = js.find('\n}', tray_idx) + 2
tray_body = js[tray_idx:tray_end]
assert 'updateSendBtn' in tray_body
# ── boot.js ──────────────────────────────────────────────────────────────
def test_boot_js_input_calls_update_send_btn():
"""boot.js input event listener must call updateSendBtn()."""
js, status = get_text("/static/boot.js")
assert status == 200
assert 'updateSendBtn' in js
# ── messages.js ───────────────────────────────────────────────────────────
def test_auto_resize_calls_update_send_btn():
"""autoResize() must call updateSendBtn() so button hides after send clears textarea."""
js, status = get_text("/static/messages.js")
assert status == 200
assert 'updateSendBtn' in js
# ── Regression: existing behaviour unchanged ──────────────────────────────
def test_send_button_still_has_send_btn_class():
"""btnSend must still carry class='send-btn' for CSS targeting."""
html, _ = get_text("/")
assert 'class="send-btn"' in html
def test_ui_js_set_busy_calls_update_send_btn():
"""setBusy must call updateSendBtn to manage button disabled state."""
js, _ = get_text("/static/ui.js")
busy_idx = js.find('function setBusy')
busy_end = js.find('\n}', busy_idx) + 2
busy_body = js[busy_idx:busy_end]
assert 'updateSendBtn' in busy_body
def test_index_html_attach_button_unchanged():
"""btnAttach must still be present (no regression)."""
html, _ = get_text("/")
assert 'id="btnAttach"' in html
def test_send_function_still_exists():
"""send() function must still be defined in messages.js."""
js, _ = get_text("/static/messages.js")
assert 'async function send()' in js