Skip to content

feat(native): waits and UAT observers (phase 5) - #12

Merged
unohee merged 1 commit into
masterfrom
feat/native-wait-observe
Oct 25, 2026
Merged

unohee merged 1 commit into
masterfrom
feat/native-wait-observe

Conversation

@unohee

@unohee unohee commented Oct 23, 2026

Copy link
Copy Markdown
Contributor

Stacked on #11. This is phase 5 of the plan.

What

  • Waits
    • Page.wait_for_function polls in the isolated world. A navigation during the wait just starts a new poll; it is not an error.
    • wait_for_url accepts a Playwright glob, a regex or a predicate, then waits for the load state. Glob rules: * stops at /, ** does not, {a,b} is an alternation, ? matches a literal ?.
    • wait_for_load_state reads the lifecycle of the current document. A document that committed before the page was set up counts as loaded, as it does in Playwright.
  • Observers
    • request, response and requestfailed come from the Network domain, which every page already has enabled.
    • console and pageerror need Runtime.enable. A page sends it only once something subscribes to one of those two events.
    • The UAT recorder subscribes to them. An ordinary session does not, so Runtime.enable never goes out for it.

Verified

  • pytest: 1755 passed. The two pre-existing macOS sha256sum failures were deselected.

  • tests/native: 92 tests.

  • testing/native_wait_observe_smoke_261023_v1.py: 10/10.

    case result
    wait_for by load state passed
    wait_for by text waited 2.6 s, then passed
    wait_for by URL glob on a pushState waited 1.6 s, then passed
    wait_for that never matches reported as a timeout
    the five observer events (a 503 fetch, console.error, console.warn, a thrown error) all five received
    Runtime.enable before any console observer not sent
    Runtime.enable after a console observer subscribes sent once
  • The real-browser runs for phases 1–2, 3 and 4 still pass.

- Page.wait_for_function polls in the isolated world (a navigation in the
  middle is a fresh poll, not an error); wait_for_url takes Playwright's
  globs (* stops at /, ** does not, {a,b}, ? literal), a regex or a
  predicate and then waits for the load state; wait_for_load_state reads the
  current loader's lifecycle, a document that committed before the page was
  set up counting as loaded, as Playwright counts it.
- request / response / requestfailed come from the Network domain the page
  already has on; console / pageerror need Runtime.enable, so a page sends it
  only once something subscribes to one of them. The UAT recorder does; an
  ordinary session never does, and keeps no Runtime.enable on the wire.

Verified: pytest 1755 passed (2 pre-existing macOS sha256sum failures
deselected); tests/native 92; testing/native_wait_observe_smoke_261023_v1.py
10/10: wait_for by load state, by text (waited 2.6 s for it), by URL glob
(waited 1.6 s for a pushState) and a timeout reported as one; the five
observer events with a 503 fetch, console.error / console.warn and a thrown
error; Runtime.enable absent until a console observer exists, then sent
once. The phase 1-2, 3 and 4 real-browser runs still pass.
@unohee
unohee force-pushed the feat/native-wait-observe branch from d5c7a05 to e11eb95 Compare October 25, 2026 04:01
@unohee
unohee changed the base branch from feat/native-snapshot to master October 25, 2026 04:02
@unohee
unohee marked this pull request as ready for review October 25, 2026 04:02
@unohee
unohee merged commit 410b78f into master Oct 25, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant