Skip to content

waygraph / PageBlockOptions

Type Alias: PageBlockOptions<Out, M, E, R, Nav, U, Q, F, C, Lk> ​

PageBlockOptions<Out, M, E, R, Nav, U, Q, F, C, Lk> = object

Defined in: src/engine/block/kinds/page.ts:96

Type Parameters ​

Out ​

Out extends Checkpoint<string>

M ​

M extends Record<string, PageMethodEntry> = Record<string, PageMethodEntry>

E ​

E extends Record<string, PageExpectEntry> = Record<string, PageExpectEntry>

R ​

R extends PageRead = PageRead

Nav = undefined

U ​

U extends string = string

Q ​

Q extends string = never

F ​

F extends "folder" | undefined = undefined

C ​

C extends Checkpoint<string> | string = Out

Lk ​

Lk extends Record<string, unknown> = Record<never, never>

Properties ​

checkpoint? ​

optional checkpoint?: C

Defined in: src/engine/block/kinds/page.ts:115

The Checkpoint this page confirms. A name makes it (checkpoint: "Home"): the page is its own Checkpoint, with nothing to declare beforehand; Home.checkpoint is the value, for what must name it (lands, a flow's from). Left out, the Block is a bare shell: it covers pages (covers) but is no page itself.


click? ​

optional click?: string | ((mem) => string)

Defined in: src/engine/block/kinds/page.ts:215

Optional click-nav onto this page. XOR with url.


covers? ​

optional covers?: "children" | readonly PageName[]

Defined in: src/engine/block/kinds/page.ts:198

The page covers other pages, as a shell does (a sidebar, a top bar): "children" is every page under its folder (nested shells stack), a list of names is those pages wherever they live. What the shell declares (links, interrupts, and its read) applies on every covered page, and the map draws it as one box around them.

Example ​

ts
covers: "children" · covers: ["Documents", "Templates"]

description? ​

optional description?: string

Defined in: src/engine/block/kinds/page.ts:109


do? ​

optional do?: (page) => M

Defined in: src/engine/block/kinds/page.ts:149

What you can do here: the page's moves by name, from a function of the page, called the first time the page's do is used (after every file is loaded, so the page and its Methods can import each other).

Parameters ​

page ​

PageSelf<Out, R, Nav>

Returns ​

M

Example ​

ts
do: () => ({ addToCart: AddToCart, openModal: OpenModal })

expect? ​

optional expect?: ExpectList<Out>

Defined in: src/engine/block/kinds/page.ts:123

What this Block promises wherever it's used, checked after its verify: Expect Blocks, Traits, Key.is(...). A Block that can land in several places lists them per outcome. Read-only and run together; a step can drop them ({ expect: false }) or add its own.

Example ​

ts
expect: [ExpectArchivedToastBlock] · expect: { EquipmentDetail: [ExpectSavedBlock], EquipmentAdd: [ExpectNameRequiredBlock] }

expects? ​

optional expects?: E | ((page) => E)

Defined in: src/engine/block/kinds/page.ts:156

What a scenario can expect on this page, by name: Expect Blocks, Traits (page.read.modalOpen.is(true)), or () => Block factories; as a record, or a function of the page (called the first time it's used). The page's expects, typed, for a step's expect: [...].

Example ​

ts
expects: (page) => ({ modalShown: page.read.modalOpen.is(true), saved: SavedExpectBlock })

for? ​

optional for?: readonly Account[]

Defined in: src/engine/block/kinds/page.ts:222

The accounts that can open this page; without it, every account. The access tests try it as each other account and expect it not to open; waygraph check flags a flow as one of them that goes there.

Example ​

ts
for: [PlantManager, Admin]

frame? ​

optional frame?: string

Defined in: src/engine/block/kinds/page.ts:191

The page lives in an iframe on another page (an embedded widget): its Blocks, checks and read see the page with every locator inside this frame, so no selector carries a prefix.

Example ​

ts
frame: "#zsign-embed"

from? ​

optional from?: readonly (PageName | Checkpoint<string>)[]

Defined in: src/engine/block/kinds/page.ts:169

The pages it can be opened from, with a url or click. Omit = from anywhere. Set it for a page that only exists after something else (every in-app page after sign-in), so route finding goes through the sign-in steps.

Example ​

ts
from: SIGNED_IN

instanceOptions? ​

optional instanceOptions?: Block<Checkpoint<string>, Out>["instanceOptions"]

Defined in: src/engine/block/kinds/page.ts:216


interrupts? ​

optional interrupts?: Record<string, { do: (page) => Promise<void>; when: string; }>

Defined in: src/engine/block/kinds/page.ts:213

What can appear on any covered page and get in the way (a cookie banner, a sound prompt), each handled where it shows up: when is the selector that shows it, do what to do. Logged, and shown in the demo; never a step.


optional links?: (self) => Lk

Defined in: src/engine/block/kinds/page.ts:206

The links every covered page has (a sidebar's): Shell.links.documents, each a Nav valid from any covered page, so a flow writes .gotoPage(Shell.links.documents) once instead of a Nav per page.

Parameters ​

self ​

PageSelf<CheckpointOf<C>, R, Nav>

Returns ​

Lk

Example ​

ts
links: (self) => ({ documents: self.link({ to: "Documents", click: Sel.documents }) })

methods? ​

optional methods?: readonly PageMethodEntry[] | M

Defined in: src/engine/block/kinds/page.ts:135

Methods available on this page: a record of Blocks (or () => Block factories, lazy so the page object can colocate method definitions), or an array. A record's Blocks are also the page's do, by name, typed.

Deprecated ​

Name them in do: () => ({ addItem: AddItemBlock }). waygraph upgrade --codemod page-object converts a project.


name ​

name: string

Defined in: src/engine/block/kinds/page.ts:108


optional nav?: NavBlock<Out>

Defined in: src/engine/block/kinds/page.ts:163

The Nav Block that opens this page (its _nav.block.ts): the page's nav, so a flow imports the page alone.

Deprecated ​

Give the page its own url (or click) and from: the page opens itself, map().gotoPage(LoginPage). waygraph upgrade --codemod nav converts a project.

Example ​

ts
definePageBlock({ ..., nav: NavLoginBlock }) · map().gotoPage(LoginPage.nav).method(LoginPage.do.fillUsername)

needs? ​

optional needs?: readonly MemKey<boolean>[]

Defined in: src/engine/block/kinds/page.ts:200

States (boolean mem keys from state()) the app must be in to reach this page; on a shell, every page it covers: needs: [Auth.signedIn].


opens? ​

optional opens?: string

Defined in: src/engine/block/kinds/page.ts:208

A menu that hides its links until opened (a burger, a user dropdown): the selector of what opens it; a link clicks it first.


query? ​

optional query?: readonly Q[]

Defined in: src/engine/block/kinds/page.ts:180

The query params the page keeps in its address (?tab=files): state of the page, not a page of its own. Page.go({ id, tab }) opens with them, Page.setQuery({ tab }) changes them, and arrival checks them.

Example ​

ts
query: ["tab", "filter"]

read? ​

optional read?: (ctx) => R

Defined in: src/engine/block/kinds/page.ts:141

What the page shows: its fields, read after a step lands here (the run log, the demo, Waygraph Studio and checks read them). Field types are inferred. Write it before do and expects, which build on it.

Parameters ​

ctx ​

ReadCtx

Returns ​

R

Example ​

ts
read: (ctx) => ({ sort: ctx.page.value(Sel.sort), modalOpen: ctx.page.visible(Sel.modal) })

readAs? ​

optional readAs?: string

Defined in: src/engine/block/kinds/page.ts:143

The namespace of its fields in the run log (sort is inventory.sort). Default: the Checkpoint's name, lower-cased first.


requires? ​

optional requires?: readonly MemKey<unknown>[]

Defined in: src/engine/block/kinds/page.ts:129


route? ​

optional route?: F

Defined in: src/engine/block/kinds/page.ts:185

"folder": the page's address is its folder under src/map/ (requests/[id]/ is /requests/[id]), as in Next.js and Nuxt; no url to write, and it can't disagree with where the page lives. Page.go({ id }) fills the [id].


screenshot? ​

optional screenshot?: StepScreenshot

Defined in: src/engine/block/kinds/page.ts:128

A screenshot of this page whenever a step lands on it (true, or { fullPage: true }): kept with the run, and the newest one shows on Waygraph Studio's map.


url? ​

optional url?: U | ((mem) => string)

Defined in: src/engine/block/kinds/page.ts:174

Optional deep-link onto this page (goto). XOR with click. Omit when the hub is arrival-only (previous Block already resolved here).


verify? ​

optional verify?: Trait[] | ((out) => Trait[])

Defined in: src/engine/block/kinds/page.ts:116

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