test(observability): assert design system markers
All checks were successful
CD Pipeline / deploy (push) Successful in 2m24s

This commit is contained in:
OoO
2026-05-05 22:08:44 +08:00
parent b21b40cae2
commit 6d015c5b6b
2 changed files with 15 additions and 1 deletions

View File

@@ -42,6 +42,13 @@ EXPECTED_MARKERS = {
MIN_HTML_BYTES = 2500
GLOBAL_REQUIRED_MARKERS = [
"momo-observability-mode",
"observability-system.css",
"AI 觀測台",
"momo-obs-link",
]
ERROR_NEEDLES = [
"Traceback",
"UndefinedError",
@@ -89,8 +96,12 @@ def main() -> int:
marker for marker in EXPECTED_MARKERS.get(path, [])
if marker not in html
]
missing_global_markers = [
marker for marker in GLOBAL_REQUIRED_MARKERS
if marker not in html
]
too_small = len(html.encode("utf-8")) < MIN_HTML_BYTES
if status != 200 or found or missing_markers or too_small:
if status != 200 or found or missing_markers or missing_global_markers or too_small:
issues = []
if status != 200:
issues.append("bad_status")
@@ -98,6 +109,8 @@ def main() -> int:
issues.extend(found)
if missing_markers:
issues.append(f"missing_markers={missing_markers}")
if missing_global_markers:
issues.append(f"missing_global_markers={missing_global_markers}")
if too_small:
issues.append(f"html_too_small={len(html.encode('utf-8'))}B")
print(f"- {label}: HTTP {status}, issues={issues}, FAIL")