Fix flaky tests and library timing behavior

Merged
PI
9mo ago
+167-203

why

what changed

test plan


Summary by cubic

Stabilizes multi-click and iframe tests and hardens timing in the library. Uses event-based double-click checks, increases CI timeouts, and simplifies the Playwright config.

  • Bug Fixes

    • Double-click tests use an inline data-URL fixture and verify click/dblclick with detail=2 for determinism.
    • waitForChildFrame matches the expected child URL and probes frames (href + readyState) with clearer debug and errors.
    • Click events are dispatched in a pipelined burst to reduce inter-click jitter for multi-clicks.
    • First top-level page wait is 5s locally and 30s in CI (override via STAGEHAND_FIRST_TOP_LEVEL_PAGE_TIMEOUT_MS).
  • Refactors

    • Simplified Playwright testDir resolution with import.meta.url and removed the env reporter.
    • Example script adds explicit 30s action timeout and ensures Stagehand closes in a finally block.