fix(browser): harden waitFor event handling

Closed
MA
4mo ago
+248-24

Summary

  • add a typed { predicate?, timeoutMs? } form while preserving the positional waitFor API
  • reject predicate failures and scope page events to the active CDP session
  • add session.navigate(url) so the agent uses one simple call while the implementation registers the load waiter before Page.navigate
  • return immediately for same-document navigations and downloads, surface Page.navigate.errorText, and wait only for real cross-document loads
  • add deterministic coverage for options, timeout, predicate failures, compatibility, active-session filtering, early load events, same-document navigation, downloads, and navigation errors

Closes #110

Validation

  • targeted browser package tests: 18 pass, 8 environment-gated skips
  • package and root filtered typechecks pass
  • changed cdp-session test file is lint-clean