waygraph / Trait
Interface: Trait
Defined in: src/engine/trait/trait.ts:23
A named, independently-reportable check. check never runs before resolve has already decided the Checkpoint, and it can only confirm or fail loud - it has no way to redirect the run.
Properties
name
name:
string
Defined in: src/engine/trait/trait.ts:25
Shows up in the error a failed check throws: ${blockName}: check "${name}" didn't pass.
says?
optionalsays?:string
Defined in: src/engine/trait/trait.ts:32
What it checks, said to a person watching, without the selector (reads "Saved", shows): the demo labels the ring around the element with it. Falls back to wants, then name.
selector?
optionalselector?:string
Defined in: src/engine/trait/trait.ts:42
The element the check looks at, when it looks at one: the demo rings it after the step.
timeoutMs?
optionaltimeoutMs?:number
Defined in: src/engine/trait/trait.ts:40
How long verify keeps retrying this check, ms (default 5000).
wants?
optionalwants?:string
Defined in: src/engine/trait/trait.ts:27
What the check is looking for, in words ("Saved" in .toast): the failure says it.
Methods
check()
check(
page,mem):Promise<boolean|TraitResult>
Defined in: src/engine/trait/trait.ts:38
Passes or not. Return { ok, saw } to say what the page showed when it doesn't pass: the failure says it. May wait (e.g. page.waitForURL) - just don't redirect the run. A check that doesn't wait is retried until it passes or timeoutMs runs out, so a page still settling doesn't fail it.
Parameters
page
Page
mem
Returns
Promise<boolean | TraitResult>