Documentation
¶
Overview ¶
Package replay is the fleet's typed model + driver seam for headless-browser replays — so no tool emits or shells out to a browser-replay bash script. A Recording is a typed AST of steps (navigate, click, type, wait, …); a Driver executes it; the core ships a deterministic no-op/test driver. The real browser driver (chromedp) is an import-gated leaf sub-package so the core stays zero-dep and offline-buildable (Law 6).
It is a pure, generic browser-replay primitive: it models any recording and never names or imports any particular project.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Driver ¶
type Driver interface {
// Run executes every step of the recording in order, stopping at the first
// error.
Run(ctx context.Context, rec *Recording) error
}
Driver executes a Recording. The browser-replay implementation lives in an import-gated leaf sub-package (chromedp); the core ships NoopDriver for tests and the disabled path (Law 2 — the driver is the universal seam, the AST is transport-independent).
type NoopDriver ¶
type NoopDriver struct {
// Executed accumulates the kinds of steps Run walked, in order.
Executed []StepKind
}
NoopDriver records the steps it was asked to run without touching a browser. It validates the recording first, so it is the canonical offline test driver.
type Recording ¶
type Recording struct {
// Name is a human label for the recording.
Name string
// Steps are executed in order.
Steps []Step
}
Recording is a typed, ordered sequence of steps — the replay AST. The zero value is an empty (valid) recording; build it through New.
type Step ¶
type Step struct {
Kind StepKind
Selector string // for Click/Type/WaitFor
Value string // for Type
Target string // for Navigate (URL) / Screenshot (name)
Duration time.Duration // for Wait / WaitFor timeout
}
Step is one typed action in a Recording.
type StepKind ¶
type StepKind string
StepKind enumerates the supported replay actions. New kinds are additive.
const ( Navigate StepKind = "navigate" // Click clicks the element matched by Selector. Click StepKind = "click" // Type sets Value on the element matched by Selector. Type StepKind = "type" // WaitFor waits until the element matched by Selector is present. WaitFor StepKind = "waitFor" // Wait pauses for Duration. Wait StepKind = "wait" // Screenshot captures the current page (Target names the artifact). Screenshot StepKind = "screenshot" )