Skip to content

How waygraph works ​

Waygraph is Playwright with a map. You describe your app once - its pages and what you can do on each - and every test becomes a path through that map.

Pages are Checkpoints, actions are Blocks ​

A Checkpoint is a place the app can be: the login page, the catalogue, a cart with an item in it. A Block is one action that moves between Checkpoints: open a page, fill a field, submit a form.

Each arrow is one Block, in one file, doing one thing. A Block that can end in more than one place (the dotted arrow: a wrong password keeps you on the login page) says so.

BlockDoesMade with
Navgoes to a page (a URL or a link)defineNavBlock
Page"you have arrived" - lists what you can do heredefinePageBlock
Methodone action on the page: fill, click, submit; or on one row of many (add this item)defineMethodBlock
Expectwhat a scenario expects: reads and judges, changes nothingdefineExpectBlock
APIan HTTP call, no pagedefineApiBlock

A flow is a path ​

A flow picks a path through the map: which Blocks, in which order. TypeScript checks that each step starts where the last one ended - you can't "teleport".

ts
export const checkoutFlow = engine
  .map({ as: StandardUser })          // start signed in
  .gotoPage(NavInventoryBlock)
  .method(AddToCartBlock)
  .gotoPage(NavCartBlock)
  .finally(EmptyCartApiBlock)         // clean up, pass or fail;

What happens in one step ​

The engine plays a flow one Block at a time. Every Block goes through the same steps:

PhaseAsks
preconditionis the page ready for this step?
actPlaywright does the work: fill, click, request
observewhat happened? (only a Block that can land in more than one place)
resolvewhich Checkpoint are we on now?
verifydo the Block's checks hold? Retried until the page settles
readwhat does the page show now? (its page's read)

When a check fails it names the step first, then what it wanted, what the page showed, and where:

text
save-machine: check "text-equals(.toast, "Saved")" didn't pass
  wanted  "Saved" in .toast
  saw     "Name is required"
  on      /equipment/new ("Add equipment")

A step played inside a chain (a fast-forward, a nested flow) is named by itself, and the chain by its ends: in ff-1 → add-to-cart → … → finish-order (9 steps).

Three ways to play a flow ​

The same flow, three ways. Nothing in the flow changes.

CommandForYou get
waygraph run checkoutFlowrunning itpass / fail, a run log
waygraph demo checkoutFlowshowing it to a personthe overlay: rings, captions, a checklist, Next
waygraph test --flowsCIevery flow as a Playwright test: workers, retries, video, reports

What a run leaves behind ​

Every run writes .waygraph/runs/<runId>.jsonl, one event per line. Its path is printed at the end.

EventSays
run:memthe data the run was seeded with (rerun with it: --replay <runId>)
step:start / step:endeach Block, where it started and landed, how long it took
step:readwhat the page showed after the step (from its page's read)
step:errorthe failure, with what the check wanted and saw

Next ​

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