Files
hermes-webui/tests/test_terminal_auto_expand_setting.py
T
nesquena-hermesandrodboev 0501564098 Release v0.51.249 — Release HQ (stage-q21) (#3523)
## Release v0.51.249 — Release HQ (stage-q21)

Small opt-in feature. UX-approved (screenshot of the toggle in Settings → Preferences).

### Added
| Issue | Author | Feature |
|-------|--------|---------|
| #2974 | @rodboev | **"Auto-expand terminal on output"** preference (Settings → Preferences, **off by default**). When enabled, the collapsed embedded terminal panel expands automatically the first time a running command emits output. Fires once per stream (guarded on open && collapsed — not per chunk), and uses `expandComposerTerminal({focus:false})` so it doesn't steal focus from the composer. Backend-persisted boolean mirroring the `simplified_tool_calling` pattern; default-off = no behavior change on upgrade. |

### Gate
- Full pytest suite: **7557 passed, 0 failed**
- ESLint: CLEAN · ruff: CLEAN · browser-smoke: CLEAN · screenshot vision-verified (toggle renders cleanly under "Compact tool activity", unchecked by default)
- Codex (regression): **SAFE TO SHIP** (clean first pass) — no-arg `expandComposerTerminal` callers unchanged, default-off incl. settings-load-failure path, all 5 plumb sites mirror the existing pattern

Co-authored-by: rodboev <rodboev@users.noreply.github.com>
2026-06-03 20:15:53 -07:00

30 lines
1.2 KiB
Python

"""Regression tests for the terminal auto-expand-on-output setting."""
import json
def test_terminal_auto_expand_on_output_defaults_disabled_and_round_trips(monkeypatch, tmp_path):
import api.config as config
settings_path = tmp_path / "settings.json"
monkeypatch.setattr(config, "SETTINGS_FILE", settings_path)
loaded = config.load_settings()
assert loaded["terminal_auto_expand_on_output"] is False
saved = config.save_settings({"terminal_auto_expand_on_output": False})
assert saved["terminal_auto_expand_on_output"] is False
assert json.loads(settings_path.read_text(encoding="utf-8"))["terminal_auto_expand_on_output"] is False
saved = config.save_settings({"terminal_auto_expand_on_output": True})
assert saved["terminal_auto_expand_on_output"] is True
assert json.loads(settings_path.read_text(encoding="utf-8"))["terminal_auto_expand_on_output"] is True
def test_terminal_auto_expand_on_output_is_a_valid_boolean_setting():
import api.config as config
assert "terminal_auto_expand_on_output" in config._SETTINGS_DEFAULTS
assert "terminal_auto_expand_on_output" in config._SETTINGS_BOOL_KEYS
assert "terminal_auto_expand_on_output" in config._SETTINGS_ALLOWED_KEYS