Add sx:ready hydration signal, eliminate test sleeps

boot-init now sets data-sx-ready on <html> and dispatches an sx:ready
CustomEvent after all islands are hydrated. Playwright tests use this
instead of networkidle + hard-coded sleeps (50+ seconds eliminated).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-03-30 12:47:52 +00:00
parent fffb5ab0b5
commit e14947cedc
12 changed files with 131 additions and 137 deletions

View File

@@ -36,13 +36,10 @@ def nav(page: Page, path: str):
js_errors: list[str] = []
page.on("pageerror", lambda err: js_errors.append(str(err)))
page.goto(f"{BASE}/sx/{path}", wait_until="networkidle")
page.goto(f"{BASE}/sx/{path}", wait_until="domcontentloaded")
# Poll briefly for JS errors — pageerror fires async during networkidle
for _ in range(10):
if js_errors:
break
page.wait_for_timeout(100)
# Wait for SX runtime hydration to complete
page.wait_for_selector("html[data-sx-ready]", timeout=15000)
# Fail fast on JS errors — don't wait for content that will never appear
if js_errors: