fix(sidecar): use LocalIOSDevice (WDA+simctl) + stop before relaunch

This commit is contained in:
pj committed 2026-04-23 16:05:13 +07:00
1 parent f1fba36a28
commit 5b7415d2ea
3 files changed
+22 -5

No files matched your search

@@ -503,12 +503,15 @@ class IosDriverBackend(private val udid: String) : DriverBackend {
false,
)
val xcTestDriverClient = xcuitest.XCTestDriverClient(installer, httpClient, false)
val device = ios.xctest.XCTestIOSDevice(udid, xcTestDriverClient) { emptySet() }
val xcTestDevice = ios.xctest.XCTestIOSDevice(udid, xcTestDriverClient) { emptySet() }
val simctlDevice = ios.simctl.SimctlIOSDevice(udid)
val device = ios.LocalIOSDevice(udid, xcTestDevice, simctlDevice, maestro.utils.NoopInsights)
driver = maestro.drivers.IOSDriver(device, maestro.utils.NoopInsights, metrics)
driver.open()
}
override fun launch(bundleId: String, clearState: Boolean, env: Map<String, String>) {
runCatching { driver.stopApp(bundleId) }
if (clearState) driver.clearAppState(bundleId)
driver.launchApp(bundleId, env, java.util.UUID.randomUUID())
}
@@ -150,7 +150,9 @@ class DriverService(
observer.onNext(block())
observer.onCompleted()
} catch (cause: Exception) {
observer.onError(cause)
cause.printStackTrace()
observer.onError(io.grpc.Status.INTERNAL.withDescription(cause.toString())
.withCause(cause).asRuntimeException())
}
}