Nico 3d71c651fc v0.10.0: test framework with markdown testcases and web UI
- testcases/*.md: declarative test definitions (send, expect_response,
  expect_state, expect_actions, action)
- runtime_test.py: standalone runner + pytest integration via conftest.py
- /tests route: web UI showing last run results from results.json
- /api/tests: serves results JSON
- Two initial testcases: counter_state (UI actions) and pub_conversation
  (multi-turn, language switch, tool use, memorizer state)
- pub_conversation: 19/20 passed on first run
- Fix nm-text vertical overflow in node metrics bar

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 15:36:19 +01:00

53 lines
2.9 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>cog — tests</title>
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: system-ui, sans-serif; background: #0a0a0a; color: #e0e0e0; padding: 2rem; max-width: 900px; margin: 0 auto; }
h1 { font-size: 1.2rem; color: #60a5fa; margin-bottom: 0.5rem; }
.meta { font-size: 0.75rem; color: #666; margin-bottom: 1.5rem; }
.tc { margin-bottom: 2rem; }
.tc-name { font-size: 1rem; font-weight: 700; color: #e0e0e0; margin-bottom: 0.5rem; padding: 0.4rem 0; border-bottom: 1px solid #222; }
.step { display: flex; align-items: baseline; gap: 0.5rem; padding: 0.25rem 0.5rem; border-bottom: 1px solid #111; font-size: 0.8rem; font-family: monospace; }
.step:hover { background: #1a1a2e; }
.badge { display: inline-block; min-width: 2.5rem; text-align: center; padding: 0.1rem 0.3rem; border-radius: 0.2rem; font-size: 0.7rem; font-weight: 700; }
.badge.PASS { background: #064e3b; color: #34d399; }
.badge.FAIL { background: #450a0a; color: #ef4444; }
.step-name { color: #888; min-width: 10rem; }
.step-check { color: #ccc; flex: 1; }
.step-detail { color: #666; font-size: 0.7rem; max-width: 30rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.summary { padding: 0.5rem; background: #111; border-radius: 0.3rem; font-size: 0.85rem; margin-bottom: 1rem; }
.summary .pass { color: #34d399; font-weight: 700; }
.summary .fail { color: #ef4444; font-weight: 700; }
.empty { color: #444; font-style: italic; padding: 2rem; text-align: center; }
a { color: #60a5fa; text-decoration: none; }
a:hover { text-decoration: underline; }
</style>
</head>
<body>
<h1><a href="/">cog</a> — test results</h1>
<div id="content"><div class="empty">Loading...</div></div>
<script>
fetch('/api/tests').then(r => r.json()).then(data => {
const el = document.getElementById('content');
if (!data.timestamp) { el.innerHTML = '<div class="empty">No test results yet. Run: python runtime_test.py</div>'; return; }
let html = '<div class="meta">Run: ' + data.timestamp + '</div>';
html += '<div class="summary"><span class="pass">' + data.summary.passed + ' passed</span> &nbsp; <span class="fail">' + data.summary.failed + ' failed</span></div>';
for (const [name, results] of Object.entries(data.testcases)) {
html += '<div class="tc"><div class="tc-name">' + name + '</div>';
for (const r of results) {
html += '<div class="step"><span class="badge ' + r.status + '">' + r.status + '</span><span class="step-name">' + r.step + '</span><span class="step-check">' + r.check + '</span><span class="step-detail">' + (r.detail || '') + '</span></div>';
}
html += '</div>';
}
el.innerHTML = html;
}).catch(() => {
document.getElementById('content').innerHTML = '<div class="empty">Failed to load results. Run: python runtime_test.py</div>';
});
</script>
</body>
</html>