mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-04 20:17:09 +00:00
fix(sidecar): warm up WDA after health check to absorb startup race
This commit is contained in:
1 parent
9180388f9a
commit
f05bdbd0ba
1 file changed
+13
@@ -509,6 +509,19 @@ class IosDriverBackend(private val udid: String) : DriverBackend {
|
|||||||
val device = ios.LocalIOSDevice(udid, xcTestDevice, simctlDevice, maestro.utils.NoopInsights)
|
val device = ios.LocalIOSDevice(udid, xcTestDevice, simctlDevice, maestro.utils.NoopInsights)
|
||||||
driver = maestro.drivers.IOSDriver(device, maestro.utils.NoopInsights, metrics)
|
driver = maestro.drivers.IOSDriver(device, maestro.utils.NoopInsights, metrics)
|
||||||
driver.open()
|
driver.open()
|
||||||
|
// warm up: absorbs WDA startup race (health check passes before accept() loop is stable)
|
||||||
|
var warmupErr: Exception? = null
|
||||||
|
repeat(3) { attempt ->
|
||||||
|
try {
|
||||||
|
driver.contentDescriptor(false)
|
||||||
|
warmupErr = null
|
||||||
|
return@repeat
|
||||||
|
} catch (e: Exception) {
|
||||||
|
warmupErr = e
|
||||||
|
if (attempt < 2) Thread.sleep(500)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
warmupErr?.let { throw IllegalStateException("WDA warmup failed after 3 attempts: $it") }
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun launch(bundleId: String, clearState: Boolean, env: Map<String, String>) {
|
override fun launch(bundleId: String, clearState: Boolean, env: Map<String, String>) {
|
||||||
|
|||||||
Reference in new issue
Block a user