Documentation
¶
Index ¶
- Constants
- Variables
- func AppendHistory(path, entry string) error
- func ChecksReady(checks []Check, required map[string]bool) bool
- func ClearHistory(path string) error
- func CompleteREPLLine(line string, position int, additional []string) (string, int, []string)
- func LoadHistory(path string, maxEntries int) ([]string, error)
- func RemoveSessionDescriptor(path string) error
- func ResolveExecutable(name string, candidates ...string) (string, error)
- func SortedDataLines(values map[string]interface{}) []string
- func SummarizeHierarchy(source, filter string, maxNodes int) (string, error)
- func ValidationFailureReason(validations []*assertly.Validation) (string, bool)
- func WriteSessionDescriptor(path string, descriptor *SessionDescriptor) error
- type AppiumClient
- type AppiumServer
- type AppiumServerOptions
- type AppiumSession
- func (s *AppiumSession) AcceptAlert(ctx context.Context) error
- func (s *AppiumSession) AlertText(ctx context.Context) (string, error)
- func (s *AppiumSession) Attribute(ctx context.Context, elementID, name string) (interface{}, error)
- func (s *AppiumSession) Back(ctx context.Context) error
- func (s *AppiumSession) Clear(ctx context.Context, elementID string) error
- func (s *AppiumSession) Click(ctx context.Context, elementID string) error
- func (s *AppiumSession) Close(ctx context.Context) error
- func (s *AppiumSession) Contexts(ctx context.Context) ([]string, error)
- func (s *AppiumSession) CurrentContext(ctx context.Context) (string, error)
- func (s *AppiumSession) DismissAlert(ctx context.Context) error
- func (s *AppiumSession) ElementBool(ctx context.Context, elementID, property string) (bool, error)
- func (s *AppiumSession) ElementRect(ctx context.Context, elementID string) (Rect, error)
- func (s *AppiumSession) Execute(ctx context.Context, script string, args ...interface{}) (interface{}, error)
- func (s *AppiumSession) FindElement(ctx context.Context, using, value string) (string, error)
- func (s *AppiumSession) FindElements(ctx context.Context, using, value string) ([]string, error)
- func (s *AppiumSession) HideKeyboard(ctx context.Context) error
- func (s *AppiumSession) Orientation(ctx context.Context) (string, error)
- func (s *AppiumSession) PageSource(ctx context.Context) (string, error)
- func (s *AppiumSession) PerformActions(ctx context.Context, actions []map[string]interface{}) error
- func (s *AppiumSession) PointerGesture(ctx context.Context, points []PointerPoint) error
- func (s *AppiumSession) ReleaseActions(ctx context.Context) error
- func (s *AppiumSession) Screenshot(ctx context.Context) ([]byte, error)
- func (s *AppiumSession) SendKeys(ctx context.Context, elementID, text string) error
- func (s *AppiumSession) SetContext(ctx context.Context, name string) error
- func (s *AppiumSession) SetLocation(ctx context.Context, latitude, longitude, altitude float64) error
- func (s *AppiumSession) SetOrientation(ctx context.Context, orientation string) error
- func (s *AppiumSession) Text(ctx context.Context, elementID string) (string, error)
- func (s *AppiumSession) WindowRect(ctx context.Context) (Rect, error)
- type Call
- type Check
- type CleanupError
- type CleanupStack
- type Command
- type DSLCommand
- type DeviceExecutor
- type Evidence
- type ExecutionResult
- type ExecutionStep
- type Executor
- type FailureArtifactFile
- type FailureArtifactOptions
- type FailureEvidence
- type LeaseHandle
- type LeaseStore
- type Locator
- type LocatorResolver
- type LoggedProcess
- type OSRunner
- type PointerPoint
- type Process
- type REPLCallbacks
- type REPLConfig
- type REPLResult
- type Rect
- type Result
- type Runner
- type SegmentFinalizer
- type SegmentStarter
- type SegmentedCapture
- type SessionDescriptor
- type TypedCall
- type TypedCommand
- type TypedExpectation
- type TypedLocator
Constants ¶
const SessionDescriptorVersion = 1
const W3CElementKey = "element-6066-11e4-a52e-4f735466cecf"
Variables ¶
var ErrLeaseHeld = errors.New("mobile resource lease is held")
Functions ¶
func AppendHistory ¶
func ClearHistory ¶
func CompleteREPLLine ¶
CompleteREPLLine applies one completion at the current byte position and returns all matching candidates so an interactive terminal can display ambiguity without losing the partially typed command.
func RemoveSessionDescriptor ¶
func SortedDataLines ¶
func SummarizeHierarchy ¶
SummarizeHierarchy converts Android UiAutomator or iOS WDA XML into a compact, grep-friendly tree. The filter is case-insensitive and maxNodes bounds output.
func ValidationFailureReason ¶
func ValidationFailureReason(validations []*assertly.Validation) (string, bool)
func WriteSessionDescriptor ¶
func WriteSessionDescriptor(path string, descriptor *SessionDescriptor) error
Types ¶
type AppiumClient ¶
func NewAppiumClient ¶
func NewAppiumClient(endpoint string, client *http.Client) (*AppiumClient, error)
func (*AppiumClient) AttachSession ¶
func (c *AppiumClient) AttachSession(ctx context.Context, sessionID string) (*AppiumSession, error)
AttachSession reconnects a client to an existing W3C session without creating or taking ownership of it. The caller decides whether Close should eventually be issued for the returned session.
func (*AppiumClient) NewSession ¶
func (c *AppiumClient) NewSession(ctx context.Context, capabilities map[string]interface{}) (*AppiumSession, error)
type AppiumServer ¶
type AppiumServer struct {
ID string
Endpoint string
Ownership string
PID int
LogPath string
// contains filtered or unexported fields
}
func StartAppium ¶
func StartAppium(ctx context.Context, runner Runner, options AppiumServerOptions) (*AppiumServer, error)
type AppiumServerOptions ¶
type AppiumServerOptions struct {
Mode string
ServerURL string
Executable string
AppiumHome string
Address string
Port int
BasePath string
LogPath string
StartupTimeoutMs int
}
func (*AppiumServerOptions) Init ¶
func (o *AppiumServerOptions) Init()
func (AppiumServerOptions) Validate ¶
func (o AppiumServerOptions) Validate() error
type AppiumSession ¶
type AppiumSession struct {
ID string
Capabilities map[string]interface{}
// contains filtered or unexported fields
}
func (*AppiumSession) AcceptAlert ¶
func (s *AppiumSession) AcceptAlert(ctx context.Context) error
func (*AppiumSession) AlertText ¶
func (s *AppiumSession) AlertText(ctx context.Context) (string, error)
func (*AppiumSession) Attribute ¶
func (s *AppiumSession) Attribute(ctx context.Context, elementID, name string) (interface{}, error)
func (*AppiumSession) Clear ¶
func (s *AppiumSession) Clear(ctx context.Context, elementID string) error
func (*AppiumSession) Click ¶
func (s *AppiumSession) Click(ctx context.Context, elementID string) error
func (*AppiumSession) Contexts ¶
func (s *AppiumSession) Contexts(ctx context.Context) ([]string, error)
func (*AppiumSession) CurrentContext ¶
func (s *AppiumSession) CurrentContext(ctx context.Context) (string, error)
func (*AppiumSession) DismissAlert ¶
func (s *AppiumSession) DismissAlert(ctx context.Context) error
func (*AppiumSession) ElementBool ¶
func (*AppiumSession) ElementRect ¶
func (*AppiumSession) Execute ¶
func (s *AppiumSession) Execute(ctx context.Context, script string, args ...interface{}) (interface{}, error)
func (*AppiumSession) FindElement ¶
func (*AppiumSession) FindElements ¶
func (*AppiumSession) HideKeyboard ¶
func (s *AppiumSession) HideKeyboard(ctx context.Context) error
func (*AppiumSession) Orientation ¶
func (s *AppiumSession) Orientation(ctx context.Context) (string, error)
func (*AppiumSession) PageSource ¶
func (s *AppiumSession) PageSource(ctx context.Context) (string, error)
func (*AppiumSession) PerformActions ¶
func (s *AppiumSession) PerformActions(ctx context.Context, actions []map[string]interface{}) error
func (*AppiumSession) PointerGesture ¶
func (s *AppiumSession) PointerGesture(ctx context.Context, points []PointerPoint) error
func (*AppiumSession) ReleaseActions ¶
func (s *AppiumSession) ReleaseActions(ctx context.Context) error
func (*AppiumSession) Screenshot ¶
func (s *AppiumSession) Screenshot(ctx context.Context) ([]byte, error)
func (*AppiumSession) SendKeys ¶
func (s *AppiumSession) SendKeys(ctx context.Context, elementID, text string) error
func (*AppiumSession) SetContext ¶
func (s *AppiumSession) SetContext(ctx context.Context, name string) error
func (*AppiumSession) SetLocation ¶
func (s *AppiumSession) SetLocation(ctx context.Context, latitude, longitude, altitude float64) error
func (*AppiumSession) SetOrientation ¶
func (s *AppiumSession) SetOrientation(ctx context.Context, orientation string) error
func (*AppiumSession) WindowRect ¶
func (s *AppiumSession) WindowRect(ctx context.Context) (Rect, error)
type CleanupError ¶
type CleanupStack ¶
type CleanupStack struct {
// contains filtered or unexported fields
}
CleanupStack provides the LIFO, continue-on-error behavior that Endly's FIFO Context.Deffer list does not provide by itself.
func (*CleanupStack) Close ¶
func (s *CleanupStack) Close(ctx context.Context) []CleanupError
type Command ¶
Command is an argv-safe local command. Name and Args are never joined into a shell expression.
type DSLCommand ¶
func ParseDSL ¶
func ParseDSL(source string) (*DSLCommand, error)
func ParseInstruction ¶
func ParseInstruction(candidate interface{}) (*DSLCommand, string, error)
type DeviceExecutor ¶
type DeviceExecutor func(ctx context.Context, session *AppiumSession, call Call) (interface{}, error)
type Evidence ¶
func CopyEvidenceFile ¶
func CopyEvidenceFile(ctx context.Context, fs afs.Service, directory, name, kind, sourcePath string, maxBytes int64, tail, sensitive bool) (*Evidence, error)
CopyEvidenceFile streams a stable local capture into an AFS artifact. A tail copy is useful for bounded logs; non-tail files are rejected rather than truncated when they exceed maxBytes so videos remain valid containers.
type ExecutionResult ¶
type ExecutionResult struct {
Data map[string]interface{}
Steps []ExecutionStep
Validations []*assertly.Validation
Failures []*FailureEvidence
}
type ExecutionStep ¶
type Executor ¶
type Executor struct {
Session *AppiumSession
Resolve LocatorResolver
ExecuteDevice DeviceExecutor
ActionTimeout time.Duration
PollInterval time.Duration
}
type FailureArtifactFile ¶
type FailureArtifactOptions ¶
type FailureEvidence ¶
type FailureEvidence struct {
Timestamp time.Time
Reason string
Artifacts []*Evidence
Errors []string
}
func CaptureAppiumFailure ¶
func CaptureAppiumFailure(ctx context.Context, fs afs.Service, session *AppiumSession, prefix, reason string, options *FailureArtifactOptions) *FailureEvidence
type LeaseHandle ¶
type LeaseStore ¶
type LeaseStore struct {
Directory string
TTL time.Duration
// contains filtered or unexported fields
}
func NewLeaseStore ¶
func NewLeaseStore(directory string) *LeaseStore
func (*LeaseStore) Acquire ¶
func (s *LeaseStore) Acquire(ctx context.Context, key string) (*LeaseHandle, error)
func (*LeaseStore) Refresh ¶
func (s *LeaseStore) Refresh(handle *LeaseHandle) error
func (*LeaseStore) Release ¶
func (s *LeaseStore) Release(handle *LeaseHandle) error
func (*LeaseStore) Validate ¶
func (s *LeaseStore) Validate(handle *LeaseHandle) error
type LoggedProcess ¶
func StartLoggedProcess ¶
type REPLCallbacks ¶
type REPLConfig ¶
type REPLResult ¶
type REPLResult struct {
Commands int
Errors int
ExitedBy string
History []string
Data map[string]interface{}
Artifacts []*Evidence
}
func RunREPL ¶
func RunREPL(ctx context.Context, input io.Reader, output io.Writer, config REPLConfig, callbacks REPLCallbacks) (*REPLResult, error)
type Runner ¶
type Runner interface {
Run(ctx context.Context, command Command) (Result, error)
Start(ctx context.Context, command Command, stdout, stderr io.Writer) (*Process, error)
}
Runner is intentionally small so platform lifecycle code can be tested without an installed SDK or a real emulator.
type SegmentedCapture ¶
type SegmentedCapture struct {
// contains filtered or unexported fields
}
func StartSegmentedCapture ¶
func StartSegmentedCapture(duration time.Duration, start SegmentStarter, finish SegmentFinalizer) (*SegmentedCapture, error)
func (*SegmentedCapture) Checkpoint ¶
func (s *SegmentedCapture) Checkpoint(ctx context.Context) ([]string, []string)
Checkpoint finalizes the segment currently being recorded and immediately starts the next one. It does not transfer ownership or stop the capture.
func (*SegmentedCapture) Snapshot ¶
func (s *SegmentedCapture) Snapshot() ([]string, []string)
func (*SegmentedCapture) Stop ¶
func (s *SegmentedCapture) Stop() ([]string, []string)
type SessionDescriptor ¶
type SessionDescriptor struct {
Version int `json:"version"`
Platform string `json:"platform"`
SessionID string `json:"sessionId"`
BackendSessionID string `json:"backendSessionId"`
Endpoint string `json:"endpoint"`
TargetID string `json:"targetId,omitempty"`
TestIDStrategy string `json:"testIdStrategy,omitempty"`
CreatedAt time.Time `json:"createdAt"`
}
SessionDescriptor is the portable, non-secret information needed by another Endly process to reconnect to an existing Appium session.
func ReadSessionDescriptor ¶
func ReadSessionDescriptor(path, expectedPlatform string) (*SessionDescriptor, error)
func (*SessionDescriptor) Init ¶
func (d *SessionDescriptor) Init()
func (*SessionDescriptor) Validate ¶
func (d *SessionDescriptor) Validate(expectedPlatform string) error
type TypedCall ¶
type TypedCall struct {
Name string `json:"name"`
Args []interface{} `json:"args,omitempty"`
}
type TypedCommand ¶
type TypedCommand struct {
Key string `json:"key,omitempty"`
Locator *TypedLocator `json:"locator,omitempty"`
Action *TypedCall `json:"action,omitempty"`
Device *TypedCall `json:"device,omitempty"`
Expect *TypedExpectation `json:"expect,omitempty"`
}
TypedCommand is the structured alternative to the textual DSL. Exactly one of Locator+Action, Device, or Expect must be configured.
func (*TypedCommand) DSL ¶
func (c *TypedCommand) DSL() (*DSLCommand, string, error)
type TypedExpectation ¶
type TypedExpectation struct {
Locator *TypedLocator `json:"locator,omitempty"`
Device *TypedCall `json:"device,omitempty"`
Matcher TypedCall `json:"matcher"`
TimeoutMs int `json:"timeoutMs,omitempty"`
}