Skip to content

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 ​

readonly config: 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? ​

readonly optional demoPace?: 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? ​

readonly optional device?: ResolvedDevice

Defined in: src/engine/flow/flow.ts:126

map({ device }): the device this flow plays on (waygraph run, demo, test --flows).


exclusive? ​

readonly optional exclusive?: boolean

Defined in: src/engine/flow/flow.ts:128

map({ exclusive: true }): under waygraph test --flows it runs alone, after every other flow.


expectedFailureReason? ​

readonly optional expectedFailureReason?: 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? ​

readonly optional highlightStyle?: 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? ​

readonly optional input?: 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? ​

readonly optional memStub?: 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? ​

readonly optional meta?: FlowMeta<string>

Defined in: src/engine/flow/flow.ts:103

What the flow says about itself (map({ title, description, labels, ticket, owner })).


resetSession ​

readonly resetSession: 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 ​

ts
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>)

Trait


Function ​

(page, mem) => Promise<boolean | TraitResult>

Returns ​

Flow<Out>

Example ​

ts
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 ​

MemPage

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 ​

MemPage

options ​

RunGraphOptions & object

Returns ​

Promise<{ page: Page; result: Out; }>

Example ​
ts
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 ​

MemPage

options? ​

RunGraphOptions

Returns ​

Promise<Out>

Example ​
ts
await loginFlow.run(context, mem, { page: existingPage });

Call Signature ​

run(mem, config?): Promise<Out>

Defined in: src/engine/flow/flow.ts:153

Parameters ​
mem ​

MemPage

config? ​

EngineConfig

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 ​

Trait[] | ((out) => Trait[])

Returns ​

Flow<Out>

Examples ​

ts
checkoutFlow.withBlockVerify(LoginBlock, [])
ts
checkoutFlow.withBlockVerify("login", [])
ts
checkoutFlow.withBlockVerify(0, [])

waygraph 0.18.3 (alpha) · Node 24+ · peer @playwright/test ^1.40.0 · syntax may change before 1.0: see what was removed