Skip to main content

Module drive

Module drive 

Source
Expand description

Driving a page from outside it: what a host’s driving verb answers, what that answer says, and the clock a page arms.

A ## Test works a page the way a visitor would — Click, Type … into, Press, Submit, Choose, Hover — and every tier reports the outcome in the same three words: the element the selector names is not there, it is there and nothing on the page answers what was done to it, or something answered. A lowered page answers through its node dispatcher, which says whether anything heard each event the verb raised; the reference tier knows it directly. Either way the sentence a test author reads comes from HERE, so the two tiers cannot word one failure two ways.

The page clock is the other half of what a host does to a page it drives. A browser page arms setInterval(ms, handler) and the browser calls the handler every ms milliseconds; a host with a virtual clock does the same arithmetic when a test says Advance time by …. The armed intervals are recorded here, beside the answers, because they are the host’s to fire.

Structs§

ClockState
The intervals a page has armed — what take saves and restore puts back.
Interval
One interval a page armed: its period and the closure the host fires each period.

Enums§

Answer
What a driving verb found.
FocusTarget
Where a verb’s default action sends keyboard focus (Verb::focus_target).
Verb
A driving verb a test aims at an element, and the events it raises there — the events a browser raises for the same act, in the order it raises them.

Functions§

answer_failure
The failure an answer means for events aimed at selector, or None when it is no failure.
arm_interval
setInterval(ms, handler) — record an interval the host fires every ms milliseconds.
cannot_take
Typing into "#x" enters nothing. … / Choosing "v" in "#x" selects nothing. … — the element is there and cannot take the verb, so the browser’s own default action does nothing and raises no input or change.
element_required
`Focus "#x"` found no such element. … — a command that acts on one element (focus, blur) aimed at an element that is not there.
form_urlencoded
A form’s fields as the body a browser submits: a=1&b=2, each name and value percent-encoded with the unreserved characters kept and a space as + (application/x-www-form-urlencoded).
intervals
Every interval the page has armed, in the order it armed them.
mount_target_missing
Mount App at "#root": no element matches that selector. …
no_element
No element matches "#x". … — the selector names nothing on the page.
no_routes_to_serve
Serve fetches with routes. in a program that declares no route.
nothing_answers
Nothing answers a click on "#x". … — the element is there and nothing listens.
reset_clock
A fresh page: no intervals armed.
restore
Put back intervals a matching take returned.
take
Take the armed intervals, leaving none in their place — like reset_clock, but they come back to the caller instead of being dropped. A nested run (a candidate page tier compared against the reference) takes the caller’s own armed intervals before it arms its own, and restores them when it is done.