mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-02 11:07:10 +00:00
fix(testrun): simctl-first launch order for iOS; Maestro init after SDK connects
This commit is contained in:
1 parent
016a959833
commit
c9aa1683df
1 file changed
+8
-5
@@ -133,14 +133,11 @@ func Execute(ctx context.Context, options Options, stdout io.Writer) error {
|
|||||||
defer listener.Close()
|
defer listener.Close()
|
||||||
agentPort := listener.Addr().(*net.TCPAddr).Port
|
agentPort := listener.Addr().(*net.TCPAddr).Port
|
||||||
|
|
||||||
// Start Maestro XCTest session, then re-launch via simctl to inject the port.
|
// Launch app via simctl with SANDERLING_PORT so the SDK can connect.
|
||||||
if err := activeDriver.Launch(ctx, options.BundleID, false); err != nil {
|
|
||||||
return fmt.Errorf("launch app (maestro): %w", err)
|
|
||||||
}
|
|
||||||
if err := ios.LaunchApp(ctx, options.BundleID, map[string]string{
|
if err := ios.LaunchApp(ctx, options.BundleID, map[string]string{
|
||||||
"SANDERLING_PORT": strconv.Itoa(agentPort),
|
"SANDERLING_PORT": strconv.Itoa(agentPort),
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
return fmt.Errorf("launch app (simctl): %w", err)
|
return fmt.Errorf("launch app: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Fprintf(stdout, "iOS app launched with SANDERLING_PORT=%d; waiting for SDK (%.0fs timeout)\n", agentPort, sdkAcceptTimeout.Seconds())
|
fmt.Fprintf(stdout, "iOS app launched with SANDERLING_PORT=%d; waiting for SDK (%.0fs timeout)\n", agentPort, sdkAcceptTimeout.Seconds())
|
||||||
|
|
||||||
@@ -156,6 +153,12 @@ func Execute(ctx context.Context, options Options, stdout io.Writer) error {
|
|||||||
hello := connection.Hello()
|
hello := connection.Hello()
|
||||||
fmt.Fprintf(stdout, "SDK connected: platform=%s app=%s sdk=%s\n", hello.Platform, hello.AppPackage, hello.Version)
|
fmt.Fprintf(stdout, "SDK connected: platform=%s app=%s sdk=%s\n", hello.Platform, hello.AppPackage, hello.Version)
|
||||||
|
|
||||||
|
// Initialize Maestro XCTest session after the app is running.
|
||||||
|
// clearState=false avoids relaunching the already-connected app.
|
||||||
|
if err := activeDriver.Launch(ctx, options.BundleID, false); err != nil {
|
||||||
|
fmt.Fprintf(stdout, "warn: maestro launch: %v\n", err)
|
||||||
|
}
|
||||||
|
|
||||||
case "web":
|
case "web":
|
||||||
fmt.Fprintln(stdout, "web mode: skipping SDK")
|
fmt.Fprintln(stdout, "web mode: skipping SDK")
|
||||||
if err := activeDriver.Launch(ctx, options.BundleID, false); err != nil {
|
if err := activeDriver.Launch(ctx, options.BundleID, false); err != nil {
|
||||||
|
|||||||
Reference in new issue
Block a user