Documentation
¶
Overview ¶
Package recorder turns a live `docker-agent run --record` TUI session into a ready-to-edit tuitest e2e test.
It wraps the real top-level TUI model and, for every keystroke and mouse click, records the input together with a snapshot of the frame the user was looking at when they acted. After the session ends, GenerateTest replays those events into the pkg/tui/tuitest DSL: typing bursts become Type(...), special keys become Press(...), clicks become ClickText(...), and the frame snapshots are diffed to synthesize WaitFor(Contains(...)) synchronization points. Combined with the model-traffic cassette recorded by the --record proxy, the output is a complete offline regression test.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TestNameFromPath ¶
TestNameFromPath derives a Go test name from a cassette path, e.g. "cagent-recording-17.yaml" becomes "TestRecordedCagentRecording17". Paths with no usable characters fall back to a deterministic hash so distinct recordings never collapse to the same test name.
Types ¶
type GenerateOptions ¶
type GenerateOptions struct {
// TestName is the Go test function name. Derive it with TestNameFromPath
// so it stays a valid identifier.
TestName string
// AgentFile is the agent YAML the session ran with, referenced (and to be
// copied) into the test's testdata directory.
AgentFile string
// CassettePath is the model-traffic cassette recorded alongside the input.
CassettePath string
}
GenerateOptions parameterizes the generated test source.
type Recorder ¶
type Recorder struct {
// contains filtered or unexported fields
}
Recorder is a tea.Model wrapping the real TUI model. All tea.Model methods run on the Bubble Tea message-loop goroutine; GenerateTest must only be called after Program.Run has returned.
func (*Recorder) GenerateTest ¶
func (r *Recorder) GenerateTest(opts GenerateOptions) string
GenerateTest renders the recorded session as a tuitest e2e test. It is not goroutine-safe with the Bubble Tea message loop: call it only after Program.Run has returned, never while the program is still running.
func (*Recorder) HasInput ¶
HasInput reports whether any user input was recorded. When false there is nothing worth generating a test from.
func (*Recorder) SetProgram ¶
SetProgram forwards the running program to the wrapped model so the session supervisor can route runtime events back through it.