Files
sanderling/internal/driver/driver.go
pj 97154cf580 feat(ios): launch via XCTest with env vars for hierarchy/tap access (#39)
* feat(proto): add env map to LaunchRequest

* feat(driver): add env param to Launch interface and all implementations

* feat(sidecar): add IosDriverBackend using Maestro IOSDriver + env pass-through

* feat(testrun): launch iOS app via XCTest with env vars instead of simctl

* fix(ios): replace LaunchApp with BootedUDID; simctl launch moved to XCTest path

* test(cli): add tests for ios platform flag and ios-device flag parsing

* fix(sdk-ios): check semaphore wait result; resolve port from args and env; register extractors before start
2026-04-23 17:35:31 +07:00

61 lines
1.8 KiB
Go

package driver
import (
"context"
"time"
)
// DeviceDriver abstracts the platform-specific UI automation backend. v0.1
// surface matches proto/driverpb/driver.proto. The sidecar implementation
// lives under driver/sidecar; the web implementation under driver/chrome;
// tests use driver/mock.
type DeviceDriver interface {
Launch(ctx context.Context, bundleID string, clearState bool, env map[string]string) error
Terminate(ctx context.Context) error
Tap(ctx context.Context, x, y int) error
TapSelector(ctx context.Context, selector string) error
InputText(ctx context.Context, text string) error
Swipe(ctx context.Context, fromX, fromY, toX, toY int, duration time.Duration) error
PressKey(ctx context.Context, key string) error
Hierarchy(ctx context.Context) (string, error)
Screenshot(ctx context.Context) (Image, error)
// RecentLogs returns log entries at or after `since`, filtered to
// `minLevel` or above. An empty minLevel defaults to "E".
RecentLogs(ctx context.Context, since time.Time, minLevel string) ([]LogEntry, error)
WaitForIdle(ctx context.Context, duration time.Duration) error
Health(ctx context.Context) (Health, error)
// Metrics samples the app's CPU and memory at the time of the call.
// CPUPercent is percent of a single core (multi-core apps can exceed
// 100). HeapBytes is resident set size; TotalMemoryBytes includes
// native allocations.
Metrics(ctx context.Context, bundleID string) (Metrics, error)
}
type LogEntry struct {
UnixMillis int64
Level string
Tag string
Message string
}
type Image struct {
PNG []byte
Width int
Height int
}
type Health struct {
Ready bool
Version string
Platform string
}
type Metrics struct {
CPUPercent float64
HeapBytes int64
TotalMemoryBytes int64
}