Files
hermes-webui/tests/test_issue1796_error_toasts.py
nesquena-hermes bf088cbbc4
Some checks failed
Release & Docker / release (push) Has been cancelled
Release v0.51.302 — Release JR (stage-brick — mobile/iOS brick + large-session perf hotfixes) (#3754)
* fix(ui): stop hidden toast from intercepting clicks on mobile (#3735)

The .toast container kept pointer-events:auto while hidden (opacity:0), so its
fixed padding sat over mobile profile action buttons and ate their clicks. Set
pointer-events:none when hidden; restore auto on .toast.show.

Co-authored-by: timlawrenz <timlawrenz@users.noreply.github.com>

* fix(sessions): rename saves on blur so iOS Safari rename works (#3729)

iOS Safari has no Enter key; the keyboard 'Done' button fires blur, and the old
onblur=cancel discarded the rename. Flip blur to save (Escape still cancels) for
session rename and project create/rename, with a _finishDone guard to prevent a
double-fire between blur and the API callback.

Co-authored-by: reinocheong <reinocheong@users.noreply.github.com>

* perf(session): skip fuzzy dedup matching for giant merge payloads (#3730)

Large tool/log payloads made _matching_visible_duplicate() casefold+regex-tokenize
multi-megabyte contents on every visible key, so /api/session took 10s+ and blocked
/api/sessions for ~19s. Keep loose normalization lazy+cached and skip substring/fuzzy
matching for non-exact payloads >200KB; exact visible-key matches still short-circuit.

Co-authored-by: alvistar <alvistar@users.noreply.github.com>

* docs(changelog): stamp v0.51.302 — Release JR (stage-brick brick/perf hotfixes #3735 #3729 #3730)

---------

Co-authored-by: nesquena-hermes <[email protected]>
Co-authored-by: timlawrenz <timlawrenz@users.noreply.github.com>
Co-authored-by: reinocheong <reinocheong@users.noreply.github.com>
Co-authored-by: alvistar <alvistar@users.noreply.github.com>
2026-06-06 16:58:13 -07:00

47 lines
2.3 KiB
Python

from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
UI_JS = (ROOT / "static" / "ui.js").read_text()
STYLE_CSS = (ROOT / "static" / "style.css").read_text()
def test_error_toast_default_duration_is_substantially_longer_than_info_toasts():
assert "const TOAST_DEFAULT_MS=2800" in UI_JS
assert "const TOAST_ERROR_DEFAULT_MS=20000" in UI_JS
assert "const duration=(ms==null)?(t==='error'?TOAST_ERROR_DEFAULT_MS:TOAST_DEFAULT_MS):ms" in UI_JS
assert "ms||2800" not in UI_JS
def test_error_toast_keeps_explicit_duration_override():
show_toast = UI_JS[UI_JS.index("function showToast"):UI_JS.index("// ── Shared app dialogs")]
assert "ms==null" in show_toast
assert "?TOAST_ERROR_DEFAULT_MS" in show_toast
assert ":TOAST_DEFAULT_MS" in show_toast
assert "setToastDismissTimer(el,duration)" in show_toast
def test_error_toast_has_copy_button_for_exact_error_text():
show_toast = UI_JS[UI_JS.index("function showToast"):UI_JS.index("// ── Shared app dialogs")]
assert "toast-copy" in show_toast
assert "data-toast-copy" in show_toast
assert "copyToastText" in show_toast
assert "const text=el?(el.dataset.toastMessage||el.textContent||''):''" in UI_JS
assert "_copyText(text).then(done).catch(()=>{})" in UI_JS
def test_toast_dismissal_pauses_on_hover_and_keyboard_focus():
assert "onmouseenter=()=>clearToastDismissTimer(el)" in UI_JS
assert "onmouseleave=()=>setToastDismissTimer(el,duration)" in UI_JS
assert "onfocusin=()=>clearToastDismissTimer(el)" in UI_JS
assert "onfocusout=()=>setToastDismissTimer(el,duration)" in UI_JS
# A *visible* toast must remain interactive so hover/focus can pause the
# dismiss timer. Interactivity lives on `.toast.show` (see #3735): the hidden
# base `.toast` is pointer-events:none so its invisible padding can't eat
# taps on controls underneath it (mobile profile buttons), and it becomes
# pointer-events:auto only once shown.
assert ".toast.show{" in STYLE_CSS
show_rule = STYLE_CSS[STYLE_CSS.index(".toast.show{"):STYLE_CSS.index("}", STYLE_CSS.index(".toast.show{"))]
assert "pointer-events:auto" in show_rule
assert ".toast{pointer-events:none" in STYLE_CSS # hidden toast must not intercept clicks (#3735)
assert ".toast-copy" in STYLE_CSS