test_q4b_ui_unit.py
file-level
1
files
1
commits
0
hotspots
0
🧊 dead
0
💥 blast risk
| 1 | """Unit tests for Track Q / Q4b Path B UI redesign (§Q4A.15).""" |
| 2 | |
| 3 | from __future__ import annotations |
| 4 | |
| 5 | from pathlib import Path |
| 6 | |
| 7 | from tools.app.server import STATIC_ROOT |
| 8 | |
| 9 | CTA_HREFS = [ |
| 10 | "https://github.com/aaronrene/overseer-kit", |
| 11 | "https://musehub.ai", |
| 12 | "https://github.com/aaronrene/overseer-kit/blob/main/docs/CONSUMER-ADAPTER-PATTERN.md", |
| 13 | "https://github.com/aaronrene/overseer-kit/blob/main/docs/README.md", |
| 14 | ] |
| 15 | |
| 16 | DIAGRAM_PATHS = [ |
| 17 | "/assets/diagrams/lanes.svg", |
| 18 | "/assets/diagrams/regimes.svg", |
| 19 | "/assets/diagrams/layers.svg", |
| 20 | "/assets/diagrams/kit-consumer.svg", |
| 21 | ] |
| 22 | |
| 23 | FORBIDDEN_COPY = [ |
| 24 | "Sign up", |
| 25 | "Create account", |
| 26 | "Run your agents here", |
| 27 | "Website executes tasks", |
| 28 | "Install unsigned desktop build as primary path", |
| 29 | "Requires MuseHub", |
| 30 | ] |
| 31 | |
| 32 | |
| 33 | def _html() -> str: |
| 34 | return (STATIC_ROOT / "index.html").read_text(encoding="utf-8") |
| 35 | |
| 36 | |
| 37 | def _js() -> str: |
| 38 | return (STATIC_ROOT / "assets" / "app.js").read_text(encoding="utf-8") |
| 39 | |
| 40 | |
| 41 | def test_overview_and_structure_nav_ids() -> None: |
| 42 | html = _html() |
| 43 | assert 'data-tab="overview"' in html |
| 44 | assert 'data-tab="structure"' in html |
| 45 | assert 'id="tab-overview"' in html |
| 46 | assert 'id="tab-structure"' in html |
| 47 | |
| 48 | |
| 49 | def test_honesty_strip_present() -> None: |
| 50 | html = _html() |
| 51 | assert 'id="honesty-strip"' in html |
| 52 | assert "Kit ≠ product runtime" in html or "kit ≠ product runtime" in html.lower() |
| 53 | assert "not a product task runtime" in html |
| 54 | |
| 55 | |
| 56 | def test_forbidden_copy_absent() -> None: |
| 57 | html = _html() |
| 58 | js = _js() |
| 59 | blob = html + "\n" + js |
| 60 | for phrase in FORBIDDEN_COPY: |
| 61 | assert phrase not in blob |
| 62 | |
| 63 | |
| 64 | def test_four_diagram_svg_paths_referenced() -> None: |
| 65 | html = _html() |
| 66 | for path in DIAGRAM_PATHS: |
| 67 | assert path in html |
| 68 | assert (STATIC_ROOT / path.removeprefix("/")).is_file() |
| 69 | |
| 70 | |
| 71 | def test_all_suite_cta_hrefs() -> None: |
| 72 | html = _html() |
| 73 | for href in CTA_HREFS: |
| 74 | assert href in html |
| 75 | |
| 76 | |
| 77 | def test_auth_copy_prefers_ok_app() -> None: |
| 78 | html = _html() |
| 79 | assert "ok app" in html |
| 80 | # Primary verb must not be overseer app in bootstrap paragraph. |
| 81 | assert "started <code>ok app</code>" in html |
| 82 | assert "started <code>overseer app</code>" not in html |
| 83 | |
| 84 | |
| 85 | def test_no_credential_persistence_apis() -> None: |
| 86 | js = _js() |
| 87 | assert "localStorage" not in js |
| 88 | assert "sessionStorage" not in js |
| 89 | assert "document.cookie" not in js |
| 90 | assert "Cookie" not in js |