Repository navigation
Journeys: eval <js> and wait --fn <expression>; Page.WaitForFunctionAsync - #71
Merged
Merged
Conversation
Mpdreamz
force-pushed
the
feature/journey-eval-wait-fn
branch
from
December 2, 2026 15:51
af63d8e to
b6a3792
Compare
Polls a JS expression until it is truthy and returns its value, with a timeout and poll interval. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
eval records the expression's value as a JSON checkpoint (a promise is awaited); wait --fn polls Page.WaitForFunctionAsync until it is truthy. Both in the .NET runner and in @nullean/journeys, and both export to agent-browser unchanged. Also fixes WaitForFunctionAsync not awaiting a promise inside its wrapper. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ailure on Windows Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Mpdreamz
force-pushed
the
feature/journey-eval-wait-fn
branch
from
December 2, 2026 15:54
b6a3792 to
52ec655
Compare
Mpdreamz
added a commit
to nullean/snapshots
that referenced
this pull request
Dec 3, 2026
## Why nullean/pagefind-net's E2E tests assert on what a page's JS API returns (`window.pagefind.search(term)` → result URLs and count), which a `.journey` could not express, so they dropped down to `Page.EvaluateAsync`. Journey steps live in Nullean.Cdp.Journeys; the steps asked for shipped in Nullean.Cdp 0.14.0 (nullean/cdp#70, via nullean/cdp#71), so this takes the pin. ## What - `Nullean.Cdp` and `Nullean.Cdp.Journeys` 0.13.0 → 0.14.0. - `eval <js>` records the expression's value as JSON in the transcript (`undefined` when there is none, a promise awaited), and `wait --fn <expression>` waits until it is truthy. No code in this repository is needed for them: transcript sections come from the checkpoint commands. - A live journey `journeys/eval.journey` against a new fixture page, `site/api.html`, whose API exists only after a delay (so `wait --fn` is what makes the evals deterministic), with its verified transcript. - `docs/formats/browser.md` gets a section on asserting on a page's JavaScript, the Browser agent skill and `DECISIONS.md` are updated, and `eval` is no longer listed as unsupported. The unreleased 0.19.0 release does not include this; it goes out in the next one. ## Verified - `mise run test`: every test project passes (Browser: 224 passed, 1 skipped as before), including the new journey in a real Chrome, `mise run format` and `mise run check` clean. - Mutation: changing one value in the verified transcript fails `Run(eval)`. - The transcript was read before it was accepted: a promise is awaited (`.then(r => r.length)` → `1`), `[]` stays `[]`, `undefined` is `undefined`. ## Not covered - Failure paths (a `wait --fn` that never turns truthy, an `eval` that throws) are Nullean.Cdp's and are tested there; this repository's existing "a failed step fails the assertion" covers propagation. - No native AOT publish was run locally: CI's AOT pack jobs cover the new Cdp version. Closes #84 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #70
Closes #52
Page.WaitForFunctionAsync(expression, timeout, pollInterval): polls until truthy and returns the value as JSON; a promise is awaited (the first version did not await a promise inside its wrapper; fixed and tested).eval <js>is a checkpoint recording the result as JSON (undefinedwhen none);wait --fn <expression>polls until truthy, up to the navigation timeout, and a throwing expression fails the step. Both in Nullean.Cdp.Journeys and in @nullean/journeys (the shared error fixtures and usage strings are updated), and both export to agent-browser unchanged.wait --downloadstays refused; DECISIONS.md, the command reference and READMEs are updated.Tested:
mise run test(536 pass, live Chrome); journeys-js typecheck,npm testand live tests. Mutation check: stubbing the runner's wait --fn makes the two new live tests fail.🤖 Generated with Claude Code