packages/core/proof-browser
(part of epic ) -- the Playwright browser flows of the detail, form, dashboard and wizard shapes, as generated LOCKED specs (proof.mjs writes them, construct test run <feature> --area generated runs them).
Core engine, next. Source: packages/core/proof-browser.mjs.
Type Aliases#
BrowserKit#
BrowserKit =
object
Defined in: packages/core/proof-browser.mjs:23
What proof.mjs hands the browser flows: the generated-file header, the flow's own command line and run line, and how to write a literal.
Type Parameters#
Type Declaration#
command
command:
string
header
header: (
extra,command) =>string[]
Parameters
extra
string
command
string
Returns
string[]
lit
lit: (
value) =>string
Parameters
value
string
Returns
string
rowLiteral
rowLiteral: (
row) =>string
Parameters
row
object
Returns
string
run
run:
string
Functions#
dashboardBrowserText()#
dashboardBrowserText(
ctx,route,kit):string
Defined in: packages/core/proof-browser.mjs:207
The text of the Playwright flow of a dashboard screen: loads the route with the summary endpoint mocked, and checks loading, then the heading, every tile and every line of every panel of the sample summary, and the error state with role alert.
Parameters#
ctx
any
The proof context (shape context plus rows, loadingText, errorText).
route
string
The route of the screen, for example /orders.
kit
The shared header and helpers.
Returns#
string
The file text, ending with a newline.
Example#
dashboardBrowserText(ctx, '/orders', kit).includes('every tile');
detailBrowserText()#
detailBrowserText(
ctx,route,kit):string
Defined in: packages/core/proof-browser.mjs:124
The text of the Playwright flow of a detail screen: loads the route with ?id= and the item endpoint mocked, and checks loading then the item
(heading, every label and value), the not-found state (a 404) and the error state with role alert.
Parameters#
ctx
any
The proof context (shape context plus rows, loadingText, notFoundText, errorText).
route
string
The route of the screen, for example /product.
kit
The shared header and helpers.
Returns#
string
The file text, ending with a newline.
Example#
detailBrowserText(ctx, '/product', kit).includes('not-found');
formBrowserText()#
formBrowserText(
ctx,route,kit):string
Defined in: packages/core/proof-browser.mjs:289
The text of the Playwright flow of a form screen: loads the route with the POST endpoint mocked, and checks every field by its label and input type, the message beside each invalid field after an empty submit, a valid submit (the typed values are POSTed, then the saved notice) and a failed submit.
Parameters#
ctx
any
The proof context (shape context plus errorText, submittedText).
route
string
The route of the screen, for example /add-product.
kit
The shared header and helpers.
Returns#
string
The file text, ending with a newline.
Example#
formBrowserText(ctx, '/add-product', kit).includes('a valid submit');
wizardBrowserText()#
wizardBrowserText(
ctx,route,kit):string
Defined in: packages/core/proof-browser.mjs:395
The text of the Playwright flow of a wizard screen: loads the route with the POST endpoint mocked, and walks it like a person: step 1 to the last step with Next (each step shows its progress, its legend, its fields and, on a step with no field of its own, the review of what was typed), Back keeps what was typed, Submit POSTs the typed values and shows the complete screen; Next stays off while a step is invalid; a failed submit stays on the last step with its message.
Parameters#
ctx
any
The proof context (shape context plus errorText; steps are the parsed steps).
route
string
The route of the screen, for example /signup.
kit
The shared header and helpers.
Returns#
string
The file text, ending with a newline.
Example#
wizardBrowserText(ctx, '/signup', kit).includes('Next through every step');