Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Monitor ¶
type Monitor struct {
// contains filtered or unexported fields
}
Monitor polls anvils for quests and executes them, creating beads on failure with deduplication.
func New ¶
func New(db *state.DB, interval, timeout time.Duration, anvils map[string]string, newExec func() QuestExecutor) *Monitor
New creates a Monitor that polls anvils for quests at the given interval. The newExec function is called to create a QuestExecutor for each quest execution. Passing nil for newExec is permitted for testing but produces a warning — the resulting monitor will pass every quest without executing it.
func (*Monitor) Run ¶
Run starts the quest polling loop. It blocks until ctx is cancelled. Returns an error if the configured interval is non-positive.
func (*Monitor) UpdateAnvilPaths ¶
UpdateAnvilPaths replaces the set of anvils the monitor polls. Safe to call concurrently with Run.
type Quest ¶
type Quest struct {
Name string `yaml:"name"`
Description string `yaml:"description"`
URL string `yaml:"url"`
Tags []string `yaml:"tags"`
Steps []Step `yaml:"steps"`
FilePath string `yaml:"-"` // populated at discovery time
}
Quest represents an E2E test scenario defined in YAML.
func DiscoverQuests ¶
DiscoverQuests finds all quest YAML files under <anvilPath>/.forge/quests/ and returns the parsed quests. Returns an empty slice if the directory does not exist.
func ParseQuest ¶
ParseQuest reads a YAML file at path and returns the parsed Quest.
type QuestExecutor ¶
type QuestExecutor interface {
Execute(ctx context.Context, quest *Quest) *QuestResult
}
QuestExecutor executes a quest and returns the result. This interface decouples the monitor from the adventurer package to avoid an import cycle (adventurer imports questgiver for the Quest type).
type QuestResult ¶
QuestResult holds the outcome of executing a quest, decoupled from the adventurer package to avoid an import cycle.
type Step ¶
type Step struct {
Action string `yaml:"action"` // navigate, fill, click, wait, assert, screenshot
URL string `yaml:"url,omitempty"`
Selector string `yaml:"selector,omitempty"`
Value string `yaml:"value,omitempty"`
Contains string `yaml:"contains,omitempty"`
Timeout time.Duration `yaml:"timeout,omitempty"`
}
Step represents a single action in a quest sequence.