test_lac_e2e.py
python
sha256:0e9549ec7b463911bc08b7d586dc320b1ac9b1f5c943ee7e3865dcc6cb0f6f83
chore(governance): sync handover+roadmap to 84db8c8 (drift:…
Human
9 hours ago
| 1 | """End-to-end tests — Landing + access clarity Path B chrome (§LAC.12).""" |
| 2 | |
| 3 | from __future__ import annotations |
| 4 | |
| 5 | import os |
| 6 | import signal |
| 7 | import subprocess |
| 8 | import sys |
| 9 | import time |
| 10 | from pathlib import Path |
| 11 | |
| 12 | from cli.kit_root import kit_root |
| 13 | from tests.fixtures.app import free_port, seed_app_repo, start_test_app |
| 14 | from tools.app.server import STATIC_ROOT |
| 15 | from tools.landing.validate import FROZEN_PRIMARY_DOWNLOAD_HREF, validate_landing |
| 16 | |
| 17 | KIT_ROOT = Path(__file__).resolve().parents[2] |
| 18 | |
| 19 | |
| 20 | def test_landing_fixtures_validate() -> None: |
| 21 | result = validate_landing(KIT_ROOT) |
| 22 | assert result.ok, result.errors |
| 23 | index = (KIT_ROOT / "docs" / "landing" / "index.html").read_text(encoding="utf-8") |
| 24 | assert FROZEN_PRIMARY_DOWNLOAD_HREF in index |
| 25 | assert 'id="path-1"' in index and 'id="path-2"' in index and 'id="path-3"' in index |
| 26 | |
| 27 | |
| 28 | def test_connect_collapses_auth_and_shows_bound_path_and_playbook(tmp_path: Path) -> None: |
| 29 | """Static+JS contract for Connect → collapse auth, bound path, Paths 1–3, Status once.""" |
| 30 | seed_app_repo(tmp_path) |
| 31 | handle, client = start_test_app(tmp_path) |
| 32 | try: |
| 33 | status, health = client.get("/api/health") |
| 34 | assert status == 200 |
| 35 | assert health["result"]["repo_root"] == str(tmp_path.resolve()) |
| 36 | |
| 37 | html = (STATIC_ROOT / "index.html").read_text(encoding="utf-8") |
| 38 | js = (STATIC_ROOT / "assets" / "app.js").read_text(encoding="utf-8") |
| 39 | |
| 40 | assert 'id="auth-panel"' in html |
| 41 | assert 'id="session-collapsed"' in html |
| 42 | assert 'id="bound-repo"' in html |
| 43 | assert "Open the local console" in html |
| 44 | assert "Path 1" in html and "Path 2" in html and "Path 3" in html |
| 45 | assert "OVERSEER_REPO_ROOT" in html |
| 46 | |
| 47 | assert "collapseAuthPanel" in js |
| 48 | assert "statusAutoFetched" in js |
| 49 | assert 'tabId === "status"' in js |
| 50 | assert '["result", "repo_root"]' in js or '["result","repo_root"]' in js.replace(" ", "") |
| 51 | finally: |
| 52 | handle.shutdown() |
| 53 | |
| 54 | |
| 55 | def test_ok_app_sigint_exit_zero(tmp_path: Path) -> None: |
| 56 | seed_app_repo(tmp_path) |
| 57 | port = free_port() |
| 58 | env = os.environ.copy() |
| 59 | env["PYTHONPATH"] = str(kit_root()) |
| 60 | proc = subprocess.Popen( |
| 61 | [ |
| 62 | sys.executable, |
| 63 | "-m", |
| 64 | "cli.main", |
| 65 | "app", |
| 66 | "--port", |
| 67 | str(port), |
| 68 | "--bind", |
| 69 | "127.0.0.1", |
| 70 | "--repo", |
| 71 | str(tmp_path), |
| 72 | ], |
| 73 | cwd=str(tmp_path), |
| 74 | env=env, |
| 75 | stdout=subprocess.PIPE, |
| 76 | stderr=subprocess.PIPE, |
| 77 | ) |
| 78 | try: |
| 79 | time.sleep(0.8) |
| 80 | proc.send_signal(signal.SIGINT) |
| 81 | code = proc.wait(timeout=5) |
| 82 | assert code in {0, -2, 130} |
| 83 | finally: |
| 84 | if proc.poll() is None: |
| 85 | proc.kill() |
| 86 | proc.wait(timeout=3) |
File History
1 commit
sha256:6abcf1fa82a7a621ccbc945f19acdba5bc0db54569599404a1452fb4a096a199
fix(ISR): default require_independent_second_reviewer to require
Human
minor
⚠
9 hours ago