fix: enforce complete building and offline viewer gates

This commit is contained in:
2026-07-10 14:04:10 +08:00
parent cab4d320c0
commit a761175c09
13 changed files with 401 additions and 25 deletions

View File

@@ -83,6 +83,41 @@ def test_served_viewer_in_desktop_and_mobile(tmp_path: Path) -> None:
checks = {item["name"]: item for item in result["checks"]}
assert checks["desktop:viewport"]["detail"] == "1440x900 expected 1440x900"
assert checks["mobile:viewport"]["detail"] == "390x844 expected 390x844"
offline = tmp_path / "viewer.html"
subprocess.run(
[
sys.executable,
str(ROOT / "scripts" / "write_offline_viewer.py"),
"--spec",
str(spec),
"--glb",
str(glb),
"--out",
str(offline),
],
check=True,
)
offline_report = tmp_path / "offline_browser_report.json"
offline_screenshot = tmp_path / "offline_browser.png"
proc = subprocess.run(
[
"node",
str(ROOT / "scripts" / "offline_viewer_smoke.mjs"),
"--viewer",
str(offline),
"--out",
str(offline_report),
"--screenshot",
str(offline_screenshot),
],
text=True,
capture_output=True,
)
assert proc.returncode == 0, proc.stderr
offline_result = json.loads(offline_report.read_text(encoding="utf-8"))
assert offline_result["status"] == "PASS"
assert offline_screenshot.exists()
finally:
server.terminate()
server.wait(timeout=10)