mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-02 11:07:10 +00:00
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
This commit is contained in:
20 files changed
+323
-90
No files matched your search
+6
-12
@@ -5,7 +5,6 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -55,18 +54,13 @@ func EnsureSimulator(ctx context.Context, deviceName string, stdout io.Writer) e
|
||||
return nil
|
||||
}
|
||||
|
||||
func LaunchApp(ctx context.Context, bundleID string, env map[string]string) error {
|
||||
args := []string{"simctl", "launch", "--terminate-running-process", "booted", bundleID}
|
||||
cmd := exec.CommandContext(ctx, "xcrun", args...)
|
||||
cmd.Env = os.Environ()
|
||||
for k, v := range env {
|
||||
cmd.Env = append(cmd.Env, "SIMCTL_CHILD_"+k+"="+v)
|
||||
// BootedUDID returns the UDID of the currently booted iOS simulator, or "" if none is booted.
|
||||
func BootedUDID(ctx context.Context) string {
|
||||
d, _ := bootedSimulator(ctx)
|
||||
if d == nil {
|
||||
return ""
|
||||
}
|
||||
out, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
return fmt.Errorf("launch %s: %w\n%s", bundleID, err, strings.TrimSpace(string(out)))
|
||||
}
|
||||
return nil
|
||||
return d.UDID
|
||||
}
|
||||
|
||||
func bootedSimulator(ctx context.Context) (*simDevice, error) {
|
||||
|
||||
Reference in new issue
Block a user