test(observability): assert design system markers
All checks were successful
CD Pipeline / deploy (push) Successful in 2m24s
All checks were successful
CD Pipeline / deploy (push) Successful in 2m24s
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user