mav

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 8, 2026 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MapDirName        = ".mav/map"
	MapScreensDirName = ".mav/map/screens"
	MapIndexFile      = ".mav/map/index.json"
	MapCurrentFile    = ".mav/map/current.json"
	MapPendingFile    = ".mav/map/pending.json"
)
View Source
const (
	MavDir        = ".mav"
	ConfigFile    = ".mav/config.yaml"
	AppMapFile    = ".mav/app-map.yaml"
	CurrentRunRef = ".mav/current-run"
)
View Source
const EvidenceStepsFile = "evidence.jsonl"

Variables

This section is empty.

Functions

func AppendEvidenceStep

func AppendEvidenceStep(run RunState, step EvidenceStep) error

func ClearPendingMapAction

func ClearPendingMapAction(root string)

func CurrentScreen

func CurrentScreen(root string) string

func GenerateReport

func GenerateReport(run RunState) (string, error)

func ObserveExpectedScreen

func ObserveExpectedScreen(root string, cfg Config, run RunState, rawTree, screenID string) error

func ObserveExpectedScreenWithDriver added in v0.2.0

func ObserveExpectedScreenWithDriver(root string, cfg Config, run RunState, rawTree, screenID, driver string) error

func ObserveScreen

func ObserveScreen(root string, cfg Config, run RunState, rawTree string) (string, error)

func Run

func Run(ctx context.Context, args []string, stdout, stderr io.Writer) error

func SaveAppMap

func SaveAppMap(root string, m AppMap) error

func SaveConfig

func SaveConfig(root string, cfg Config) error

func SaveCurrentRun

func SaveCurrentRun(root string, run RunState) error

func SaveScreen

func SaveScreen(root string, screen Screen) error

func SetCurrentScreen

func SetCurrentScreen(root, screenID, runID string)

func SetPendingMapAction

func SetPendingMapAction(root string, pending pendingMapAction)

func ValidateAppMap

func ValidateAppMap(m AppMap) error

Types

type AppMap

type AppMap struct {
	AppID   string            `json:"app_id"`
	Start   string            `json:"start"`
	Screens map[string]Screen `json:"-"`
}

func DefaultAppMap

func DefaultAppMap(bundleID string) AppMap

func EnsureAppMap

func EnsureAppMap(root string, cfg Config) (AppMap, error)

func LoadAppMap

func LoadAppMap(root string) (AppMap, error)

type CLI

type CLI struct {
	Runner Runner
	Stdin  io.Reader
	Stdout io.Writer
	Stderr io.Writer
	Root   string
}

func (CLI) Run

func (c CLI) Run(ctx context.Context, args []string) error

type Capabilities added in v0.0.10

type Capabilities struct {
	Tools                map[string]bool
	LaunchRecipe         bool
	Accessibility        bool
	AccessibilityDriver  string
	SemanticActions      bool
	CoordinateTap        bool
	CoordinateTapDriver  string
	DeviceFallback       bool
	DeviceFallbackDriver string
	AppiumInstall        bool
	IDBIssue             string
	IDBNext              string
}

type CommandResult

type CommandResult struct {
	Stdout string
	Stderr string
	Code   int
	Err    error
}

type Config

type Config struct {
	ProjectName       string
	Root              string
	AppTarget         string
	DeviceTarget      string
	BundleID          string
	ProcessName       string
	SimulatorUDID     string
	SimulatorName     string
	SimulatorRuntime  string
	Locale            string
	Language          string
	LogSubsystem      string
	LogCategory       string
	PreferredUIDriver string
	AllowShell        bool
	Launch            LaunchConfig
	Tools             map[string]bool
}

func DefaultConfig

func DefaultConfig(root string) Config

func LoadConfig

func LoadConfig(root string) (Config, error)

func SetupConfig added in v0.0.10

func SetupConfig(root string, runner Runner) (Config, error)

type Edge

type Edge struct {
	To     string `json:"to"`
	ID     string `json:"id,omitempty"`
	Text   string `json:"text,omitempty"`
	X      string `json:"x,omitempty"`
	Y      string `json:"y,omitempty"`
	Wait   string `json:"wait,omitempty"`
	Driver string `json:"driver,omitempty"`
	Source string `json:"source,omitempty"`
}

func Route

func Route(m AppMap, target string) ([]Edge, error)

type Element

type Element struct {
	ID      string `json:"id,omitempty"`
	Label   string `json:"label,omitempty"`
	Role    string `json:"role,omitempty"`
	Value   string `json:"value,omitempty"`
	Frame   string `json:"frame,omitempty"`
	Enabled string `json:"enabled,omitempty"`
	Subrole string `json:"subrole,omitempty"`
	Title   string `json:"title,omitempty"`
	PID     string `json:"pid,omitempty"`
	Focused string `json:"focused,omitempty"`
}

func ExtractElements

func ExtractElements(rawTree string) []Element

type EvidenceStep

type EvidenceStep struct {
	Name      string `json:"name"`
	Note      string `json:"note,omitempty"`
	File      string `json:"file"`
	Kind      string `json:"kind"`
	CreatedAt string `json:"created_at"`
}

func LoadEvidenceSteps

func LoadEvidenceSteps(run RunState) []EvidenceStep

type ExecRunner

type ExecRunner struct{}

func (ExecRunner) LookPath

func (ExecRunner) LookPath(file string) (string, error)

func (ExecRunner) Run

func (ExecRunner) Run(ctx context.Context, name string, args ...string) CommandResult

func (ExecRunner) Start

func (ExecRunner) Start(ctx context.Context, logPath string, name string, args ...string) (int, error)

type Flow

type Flow struct {
	Version int        `yaml:"version"`
	Name    string     `yaml:"name"`
	Steps   []FlowStep `yaml:"steps"`
}

func LoadFlow

func LoadFlow(path string) (Flow, error)

func ParseFlow

func ParseFlow(data []byte) (Flow, error)

type FlowCondition

type FlowCondition struct {
	Text        string `yaml:"text"`
	ID          string `yaml:"id"`
	Value       string `yaml:"value"`
	ChangedFrom string `yaml:"changedFrom"`
}

type FlowStep

type FlowStep struct {
	Action string
	Params map[string]string
	Any    []FlowCondition
	Do     []FlowStep
	Env    map[string]string
}

type GlobalOptions

type GlobalOptions struct {
	Verbose      bool
	Raw          bool
	Help         bool
	PreferDriver string
}

type LaunchCandidate added in v0.0.10

type LaunchCandidate struct {
	Source      string
	Confidence  int
	Description string
	Launch      LaunchConfig
	AppTarget   string
	BundleID    string
}

type LaunchCommands added in v0.0.10

type LaunchCommands struct {
	Healthcheck string
	Build       string
	AppPath     string
	Install     string
	Launch      string
	Cleanup     string
}

type LaunchConfig added in v0.0.10

type LaunchConfig struct {
	Mode     string
	Commands LaunchCommands
}

type Output

type Output struct {
	OK     bool              `json:"ok"`
	Cmd    string            `json:"cmd,omitempty"`
	Code   string            `json:"code,omitempty"`
	Fields map[string]string `json:"fields,omitempty"`
}

func Fail

func Fail(code string, fields map[string]string) Output

func OK

func OK(cmd string, fields map[string]string) Output

func (Output) Write

func (o Output) Write(w io.Writer) error

type Recognizer

type Recognizer struct {
	Kind  string `json:"kind"`
	Value string `json:"value"`
}

type ReportData

type ReportData struct {
	RunID        string
	CreatedAt    string
	Dir          string
	Screenshot   string
	Steps        []EvidenceStep
	Video        string
	VideoInvalid bool
	VideoIssue   string
	Logs         string
	Crashes      []string
	Commands     []string
}

type RunState

type RunState struct {
	ID        string
	Dir       string
	LogsPath  string
	Commands  string
	Processes string
	Started   time.Time
}

func LoadRun

func LoadRun(root, id string) (RunState, error)

func NewRunState

func NewRunState() (RunState, error)

type Runner

type Runner interface {
	LookPath(file string) (string, error)
	Run(ctx context.Context, name string, args ...string) CommandResult
	Start(ctx context.Context, logPath string, name string, args ...string) (int, error)
}

type Screen

type Screen struct {
	ID          string       `json:"id"`
	Title       string       `json:"title,omitempty"`
	Driver      string       `json:"driver,omitempty"`
	AssertID    string       `json:"assert_id,omitempty"`
	AssertText  string       `json:"assert_text,omitempty"`
	Recognizers []Recognizer `json:"recognizers,omitempty"`
	Elements    []Element    `json:"elements,omitempty"`
	Edges       []Edge       `json:"edges,omitempty"`
	TreeFile    string       `json:"tree_file,omitempty"`
	UpdatedAt   string       `json:"updated_at,omitempty"`
}

func LoadScreen

func LoadScreen(root, id string) (Screen, error)

type ScreenObservation added in v0.0.6

type ScreenObservation struct {
	Screen         string
	Source         string
	PreviousScreen string
	Elements       []Element
}

func ObserveScreenDetailed added in v0.0.6

func ObserveScreenDetailed(root string, cfg Config, run RunState, rawTree string) (ScreenObservation, error)

func ObserveScreenDetailedWithDriver added in v0.2.0

func ObserveScreenDetailedWithDriver(root string, cfg Config, run RunState, rawTree, driver string) (ScreenObservation, error)

type Simulator

type Simulator struct {
	UDID    string
	Name    string
	Runtime string
	State   string
}

func ListSimulators

func ListSimulators(runner Runner) ([]Simulator, error)

func SelectSimulator

func SelectSimulator(sims []Simulator, name, runtime, udid string) (Simulator, bool)

type VideoValidation added in v0.0.7

type VideoValidation struct {
	OK       bool
	Duration time.Duration
	Frames   int
	Issue    string
}

func ValidateEvidenceVideo added in v0.0.7

func ValidateEvidenceVideo(path string) VideoValidation

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL