waygraph / Flow
Interface: Flow<Out>
Defined in: src/engine/flow/flow.ts:85
A runnable chain of Blocks built by engine.map(). run(mem) launches its own browser; run(context, mem) reuses one.
Type Parameters
Out
Out extends Checkpoint<string>
Properties
config
readonlyconfig:EngineConfig
Defined in: src/engine/flow/flow.ts:92
The engine config the Flow was built with (how it launches a browser); running one of its steps on its own uses it too.
demoPace?
readonlyoptionaldemoPace?:DemoPace
Defined in: src/engine/flow/flow.ts:108
Demo pacing for this Flow's episode (map({ demoPace })). run() ignores; step/demo applies per Block in the episode.
device?
readonlyoptionaldevice?:ResolvedDevice
Defined in: src/engine/flow/flow.ts:126
map({ device }): the device this flow plays on (waygraph run, demo, test --flows).
exclusive?
readonlyoptionalexclusive?:boolean
Defined in: src/engine/flow/flow.ts:128
map({ exclusive: true }): under waygraph test --flows it runs alone, after every other flow.
expectedFailureReason?
readonlyoptionalexpectedFailureReason?:string
Defined in: src/engine/flow/flow.ts:101
map({ expectedFailure }) - a display hint for a step-through overlay: this Flow is DESIGNED to throw (e.g. a blocked user's login attempt genuinely failing), not a bug in the demo itself. run() never reads this - the Flow still throws exactly as it would otherwise; only the overlay's error panel reads it, to show an informational "this is the point" panel instead of an alarming one indistinguishable from a real break.
highlightStyle?
readonlyoptionalhighlightStyle?:HighlightStyleDefaults
Defined in: src/engine/flow/flow.ts:113
Default highlight size/weight/tone for this Flow's episode (map({ highlightStyle })). Per-slot stub/fixture values win. run() ignores.
input?
readonlyoptionalinput?:MemKey<unknown>
Defined in: src/engine/flow/flow.ts:124
map({ input: CaseKey }): the MemKey this flow takes as its input - one flow for many cases instead of one export per case. Required like any requires key; given by --input (an array runs the flow once per item), --data, a mem stub, or .flow(sub, { input }).
memStub?
readonlyoptionalmemStub?:boolean
Defined in: src/engine/flow/flow.ts:118
map({ memStub: true }) (or new Engine({ memStub: true })): a key the flow requires and mem doesn't have comes from its mem stub (registerMemStub) instead of failing preflight. run() fills them first; the CLI does the same.
meta?
readonlyoptionalmeta?:FlowMeta<string>
Defined in: src/engine/flow/flow.ts:103
What the flow says about itself (map({ title, description, labels, ticket, owner })).
resetSession
readonlyresetSession:boolean
Defined in: src/engine/flow/flow.ts:90
map({ sessionReset: true }): this Flow wants a fresh browser session when it runs after another one (nested with .flow(sub) or chained on the CLI). run() itself never reads it.
Methods
blocks()
blocks(): readonly
BlockInfo[]
Defined in: src/engine/flow/flow.ts:134
This Flow's constituent Blocks, in order between start/end, as plain data - for introspection/visualization tools, without running anything.
Returns
readonly BlockInfo[]
Example
loginFlow.blocks() // [{ name: "login" }, { name: "add-to-cart", routes: {...} }]modBlockVerify()
modBlockVerify(
block,nameOrIndex,newCheck):Flow<Out>
Defined in: src/engine/flow/flow.ts:172
Replaces one Trait inside the given Block's verify list - same rules as modVerify. Throws if no Block in this Flow matches, or if that Block has no verify trait at the given name/index.
Parameters
block
string | number | SomeBlock
nameOrIndex
string | number
newCheck
Trait | ((page, mem) => Promise<boolean | TraitResult>)
Function
(page, mem) => Promise<boolean | TraitResult>
Returns
Flow<Out>
Example
checkoutFlow.modBlockVerify(LoginBlock, "url-matches", Trait.url({ pathname: "/inventory.html" }))run()
Call Signature
run(
context,mem):Promise<Out>
Defined in: src/engine/flow/flow.ts:135
Parameters
context
BrowserContext
mem
Returns
Promise<Out>
Call Signature
run(
context,mem,options):Promise<{page:Page;result:Out; }>
Defined in: src/engine/flow/flow.ts:142
options.closeOnFinish: false hands the driven page back instead of closing it - use this overload (a literal false, not a boolean) to get the { result, page } shape typed correctly.
Parameters
context
BrowserContext
mem
options
RunGraphOptions & object
Returns
Promise<{ page: Page; result: Out; }>
Example
const { result, page } = await loginFlow.run(context, mem, { closeOnFinish: false });Call Signature
run(
context,mem,options?):Promise<Out>
Defined in: src/engine/flow/flow.ts:152
options.page drives that already-open page instead of opening a new one - see RunGraphOptions.
Parameters
context
BrowserContext
mem
options?
Returns
Promise<Out>
Example
await loginFlow.run(context, mem, { page: existingPage });Call Signature
run(
mem,config?):Promise<Out>
Defined in: src/engine/flow/flow.ts:153
Parameters
mem
config?
Returns
Promise<Out>
withBlockVerify()
withBlockVerify(
block,verify):Flow<Out>
Defined in: src/engine/flow/flow.ts:162
Replaces the given Block's whole verify list, wherever it sits in this Flow - same rules as withVerify. Throws if no Block in this Flow matches.
Parameters
block
string | number | SomeBlock
verify
Returns
Flow<Out>
Examples
checkoutFlow.withBlockVerify(LoginBlock, [])checkoutFlow.withBlockVerify("login", [])checkoutFlow.withBlockVerify(0, [])