Extract Session.wait into a Runner

This is done for a couple reasons. The first is just to have things a little
more self-contained for eventually supporting more advanced "wait" logic, e.g.
waiting for a selector.

The other is to provide callers with more fine-grained controlled. Specifically
the ability to manually "tick", so that they can [presumably] do something
after every tick. This is needed by the test runner to support more advanced
cases (cases that need to test beyond 'load') and it also improves (and fixes
potential use-after-free, the lp.waitForSelector)
This commit is contained in:
Karl Seguin
2026-03-23 12:15:53 +08:00
parent a69a22ccd7
commit c9bc370d6a
15 changed files with 315 additions and 241 deletions

View File

@@ -221,7 +221,7 @@ pub const WaitUntil = enum {
load,
domcontentloaded,
networkidle,
fixed,
done,
};
pub const Fetch = struct {
@@ -400,8 +400,8 @@ pub fn printUsageAndExit(self: *const Config, success: bool) void {
\\ Defaults to 5000.
\\
\\--wait_until Wait until the specified event.
\\ Supported events: load, domcontentloaded, networkidle, fixed.
\\ Defaults to 'load'.
\\ Supported events: load, domcontentloaded, networkidle, done.
\\ Defaults to 'done'.
\\
++ common_options ++
\\