Files
hermes-webui/tests/test_issue3227_help_tab.py
T
nesquena-hermes cadbe1e5d3 Release v0.51.325 — Release KO (in-app Help tab, #3518) (#3806)
#3518 (@rodboev): in-app Help tab in Settings (docs + GitHub issues links), redesigned as polished icon-led cards. UX-approved by Nathan. Full suite 8242, CI 11/11. Co-authored-by: rodboev <rodboev@users.noreply.github.com>
2026-06-07 18:59:01 -07:00

49 lines
1.7 KiB
Python

from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
INDEX_HTML = (ROOT / "static" / "index.html").read_text(encoding="utf-8")
PANELS_JS = (ROOT / "static" / "panels.js").read_text(encoding="utf-8")
I18N_JS = (ROOT / "static" / "i18n.js").read_text(encoding="utf-8")
LOCALE_COUNT = 13 # en, it, ja, ru, es, de, zh, zh-TW, pt, ko, fr, tr, pl
def test_help_nav_button_present():
assert 'data-settings-section="help"' in INDEX_HTML
assert "switchSettingsSection('help')" in INDEX_HTML
assert 'data-i18n="settings_tab_help"' in INDEX_HTML
def test_help_pane_present():
assert 'id="settingsPaneHelp"' in INDEX_HTML
assert 'href="https://get-hermes.ai/"' in INDEX_HTML
assert 'href="https://github.com/nesquena/hermes-webui/issues"' in INDEX_HTML
def test_help_pane_links_are_outbound():
assert 'target="_blank"' in INDEX_HTML
assert 'rel="noopener noreferrer"' in INDEX_HTML
def test_panels_js_allowlist_includes_help():
assert "name==='help'" in PANELS_JS
def test_panels_js_map_includes_help():
assert "help:'Help'" in PANELS_JS
def test_panels_js_foreach_includes_help():
assert "'help'" in PANELS_JS
assert "settingsPaneHelp" not in PANELS_JS or 'settingsPane'+'{map[key]}' not in PANELS_JS
# Simpler: confirm the forEach array string contains help
assert ",'help'," in PANELS_JS or ",'help']" in PANELS_JS
def test_i18n_help_keys_present_in_all_locales():
assert I18N_JS.count("settings_tab_help") == LOCALE_COUNT
assert I18N_JS.count("settings_help_docs_label") == LOCALE_COUNT
assert I18N_JS.count("settings_help_issue_label") == LOCALE_COUNT
assert I18N_JS.count("settings_help_docs_link") == LOCALE_COUNT
assert I18N_JS.count("settings_help_issue_link") == LOCALE_COUNT