| from pathlib import Path | |
| ROOT = Path(__file__).resolve().parents[1] | |
| def read(path: str) -> str: | |
| return (ROOT / path).read_text(encoding="utf-8") | |
| def test_billing_panel_is_actionable_compute_checklist(): | |
| html = read("web/index.html") | |
| css = read("web/static/app.css") | |
| billing = html.split('id="billingPanel"', 1)[1].split('</section>', 1)[0] | |
| for text in [ | |
| "Payment readiness", | |
| "Pi assistant", | |
| "Build Job", | |
| "Generated Space", | |
| "Guardrail", | |
| "Inference Providers", | |
| "A100/H200", | |
| "Review spend and quotas", | |
| ]: | |
| assert text in billing | |
| assert "billing-compute-checklist" in css | |
| assert "billing-ready-card" in css | |
| def test_timeline_does_not_auto_scroll_on_identical_signature_after_user_scroll(): | |
| js = read("web/static/progress.js") | |
| assert "root.dataset.signature===signature" in js | |
| assert "root.dataset.userScrolled!=='1'" in js | |
| assert "previousKey!==currentKey" in js | |
| assert "root.dataset.currentStep=currentKey" in js | |
| def test_event_bindings_are_delegated_and_one_shot(): | |
| app = read("web/static/app.js") | |
| runs = read("web/static/runs.js") | |
| assert "function bindOnce" in app | |
| assert "function bindAllOnce" in app | |
| assert "root.dataset.boundRuns==='true'" in runs | |
| assert "root.addEventListener('click'" in runs | |
| assert "root.addEventListener('keydown'" in runs | |