Skip to content

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

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

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

optional timeoutMs?: number

Defined in: src/engine/trait/trait.ts:40

How long verify keeps retrying this check, ms (default 5000).


wants? ​

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

MemPage

Returns ​

Promise<boolean | TraitResult>

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