/** * `flowDriver` — execute a scripted journey across pages. * * Use when you have a known critical path (register → verify → login → * onboard → buy) and want the chaos crawler to exercise it under fault * injection. The driver advances through a list of steps; each step * has an optional `when` predicate (defaults to URL match) so the * driver waits patiently when the crawler is on an unrelated page. * * Pair with `compositeDriver([flowDriver(steps), weightedRandomDriver()])` * so the flow drives the happy path while random exploration runs in * parallel on pages the flow doesn't claim. Once every step in the * journey has completed, the driver returns null forever (one-shot). */ import type { Page } from "playwright"; import type { Driver, DriverStep } from "./types.js"; export interface FlowStep { /** Human-readable label, used in trace + logs. */ name: string; /** * Predicate that decides whether this step is ready to run on the * current page. Defaults to matching `urlPattern`; either may be * provided. If neither is set, the step matches any URL (use sparingly). */ when?: (step: DriverStep) => boolean | Promise; urlPattern?: RegExp | string; /** * The actual journey action. Operate on the page directly. * Throw to mark the step failed; return value is ignored. */ run: (page: Page, step: DriverStep) => Promise; /** * If true, the flow advances even if `run` throws. Default: false * (a failing step halts the flow so subsequent steps don't run * against a broken state). */ optional?: boolean; } export interface FlowDriverOptions { steps: ReadonlyArray; /** Restart the flow when the last step has completed. Default: false. */ loop?: boolean; name?: string; } export declare function flowDriver(options: FlowDriverOptions): Driver; //# sourceMappingURL=flow-driver.d.ts.map