Files
hermes-webui/tests/test_issue2518_new_session_inflight.py
nesquena-hermes de4509702d
Some checks failed
Release & Docker / release (push) Has been cancelled
Release v0.51.337 — Release LA (model-picker keyboard nav #2952 + mobile new-chat #3531) (#3857)
Two small, aesthetic-safe UX wins:
- #2952 (@Sanjays2402): model-picker arrow-key navigation + Enter-to-select.
  Highlight reuses existing hover style, invisible until keyboard used.
  Opus SHIP-safe, live key-drive verified (multi-row traversal + wrap + Enter).
- #3531 (@franksong2702): mobile titlebar '+' new-chat button. Shares the
  existing reload-button styling, mobile-only, mirrors new-chat pending state.
  390px screenshot vision-verified: cleanly aligned in the titlebar.

Both rebased onto master (CHANGELOG-only / merge-commit conflicts resolved;
code verified byte-identical to PR heads). Full suite green on each (8336/8334),
ESLint/scope-undef CLEAN, zero blocking bot flags.

Co-authored-by: Sanjays2402 <Sanjays2402@users.noreply.github.com>
Co-authored-by: franksong2702 <franksong2702@users.noreply.github.com>
2026-06-08 18:47:55 -07:00

41 lines
1.6 KiB
Python

"""Regression coverage for #2518 new-conversation cold-start dedupe."""
from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
def _source(rel: str) -> str:
return (ROOT / rel).read_text(encoding="utf-8")
def test_new_session_reuses_inflight_request_before_posting_again():
src = _source("static/sessions.js")
assert "let _newSessionInFlight=null" in src
assert "if(_newSessionInFlight){" in src
assert "return _newSessionInFlight;" in src, (
"newSession() must return the existing create promise so rapid clicks do "
"not enqueue multiple /api/session/new requests"
)
assert "_newSessionInFlight=(async()=>" in src
assert "_newSessionInFlight=null;" in src
def test_new_session_sets_visible_pending_state_for_cold_catalog_wait():
src = _source("static/sessions.js")
assert "function _setNewSessionPending(pending)" in src
assert "btn.disabled=!!pending" in src
assert "btn.setAttribute('aria-busy',pending?'true':'false')" in src
assert "const ids=['btnNewChat','btnTitlebarNewChat']" in src
assert "btnTitlebarNewChat" in src
assert "setComposerStatus(pendingText)" in src
assert "t('new_session_creating')" in src
def test_new_session_pending_button_style_and_copy_exist():
css = _source("static/style.css")
i18n = _source("static/i18n.js")
assert '.panel-head-btn:disabled,.panel-head-btn[aria-busy="true"]' in css
assert '.app-titlebar-new-chat:disabled,.app-titlebar-new-chat[aria-busy="true"]' in css
assert "cursor:wait" in css
assert "new_session_creating: 'Creating new conversation…'" in i18n