mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-02 19:17:10 +00:00
fix(sidecar): update AndroidDriver calls for Maestro 2.4.0 API
launchApp no longer accepts a UUID argument. Third constructor param changed from hostname to emulatorName so drop the "localhost" value.
This commit is contained in:
1 parent
334f571111
commit
1c05efb32a
1 file changed
+40
-19
@@ -383,13 +383,13 @@ class MaestroDriverBackend(private val serial: String?) : DriverBackend {
|
|||||||
init {
|
init {
|
||||||
dadb = buildDadb(serial)
|
dadb = buildDadb(serial)
|
||||||
val hostPort = java.net.ServerSocket(0).use { it.localPort }
|
val hostPort = java.net.ServerSocket(0).use { it.localPort }
|
||||||
driver = maestro.drivers.AndroidDriver(dadb, hostPort, "localhost")
|
driver = maestro.drivers.AndroidDriver(dadb, hostPort)
|
||||||
driver.open()
|
driver.open()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun launch(bundleId: String, clearState: Boolean, env: Map<String, String>) {
|
override fun launch(bundleId: String, clearState: Boolean, env: Map<String, String>) {
|
||||||
if (clearState) driver.clearAppState(bundleId)
|
if (clearState) driver.clearAppState(bundleId)
|
||||||
driver.launchApp(bundleId, env, java.util.UUID.randomUUID())
|
driver.launchApp(bundleId, env)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun terminate(bundleId: String) = driver.stopApp(bundleId)
|
override fun terminate(bundleId: String) = driver.stopApp(bundleId)
|
||||||
@@ -492,24 +492,45 @@ class IosDriverBackend(private val udid: String) : DriverBackend {
|
|||||||
private val reconnectLock = java.util.concurrent.locks.ReentrantLock()
|
private val reconnectLock = java.util.concurrent.locks.ReentrantLock()
|
||||||
|
|
||||||
init {
|
init {
|
||||||
val httpClient = xcuitest.api.OkHttpClientInstance.get()
|
|
||||||
val metrics = maestro.utils.NoOpMetrics()
|
|
||||||
val wdaPort = maestro.utils.SocketUtils.nextFreePort(22000, 23000)
|
val wdaPort = maestro.utils.SocketUtils.nextFreePort(22000, 23000)
|
||||||
val installer = xcuitest.installer.LocalXCTestInstaller(
|
val tempFileHandler = maestro.utils.TempFileHandler()
|
||||||
udid,
|
val simctlDevice = device.SimctlIOSDevice(
|
||||||
"localhost",
|
deviceId = udid,
|
||||||
false,
|
tempFileHandler = tempFileHandler,
|
||||||
wdaPort,
|
|
||||||
metrics,
|
|
||||||
httpClient,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
)
|
)
|
||||||
val xcTestDriverClient = xcuitest.XCTestDriverClient(installer, httpClient, false)
|
val driverConfig = xcuitest.installer.LocalXCTestInstaller.IOSDriverConfig(
|
||||||
val xcTestDevice = ios.xctest.XCTestIOSDevice(udid, xcTestDriverClient) { emptySet() }
|
prebuiltRunner = false,
|
||||||
val simctlDevice = ios.simctl.SimctlIOSDevice(udid)
|
sourceDirectory = "driver-iPhoneSimulator",
|
||||||
val device = ios.LocalIOSDevice(udid, xcTestDevice, simctlDevice, maestro.utils.NoopInsights)
|
context = xcuitest.installer.Context.CLI,
|
||||||
driver = maestro.drivers.IOSDriver(device, maestro.utils.NoopInsights, metrics)
|
snapshotKeyHonorModalViews = null,
|
||||||
|
)
|
||||||
|
val installer = xcuitest.installer.LocalXCTestInstaller(
|
||||||
|
deviceId = udid,
|
||||||
|
host = "127.0.0.1",
|
||||||
|
deviceType = util.IOSDeviceType.SIMULATOR,
|
||||||
|
defaultPort = wdaPort,
|
||||||
|
iOSDriverConfig = driverConfig,
|
||||||
|
deviceController = simctlDevice,
|
||||||
|
tempFileHandler = tempFileHandler,
|
||||||
|
)
|
||||||
|
val xcTestClient = xcuitest.XCTestClient("127.0.0.1", wdaPort)
|
||||||
|
val xcTestDriverClient = xcuitest.XCTestDriverClient(
|
||||||
|
installer = installer,
|
||||||
|
client = xcTestClient,
|
||||||
|
)
|
||||||
|
val xcRunnerUtils = util.XCRunnerCLIUtils(tempFileHandler)
|
||||||
|
val xcTestDevice = ios.xctest.XCTestIOSDevice(
|
||||||
|
deviceId = udid,
|
||||||
|
client = xcTestDriverClient,
|
||||||
|
getInstalledApps = { xcRunnerUtils.listApps(udid) },
|
||||||
|
)
|
||||||
|
val device = ios.LocalIOSDevice(
|
||||||
|
deviceId = udid,
|
||||||
|
xcTestDevice = xcTestDevice,
|
||||||
|
deviceController = simctlDevice,
|
||||||
|
insights = maestro.utils.NoopInsights,
|
||||||
|
)
|
||||||
|
driver = maestro.drivers.IOSDriver(device, maestro.utils.NoopInsights)
|
||||||
driver.open()
|
driver.open()
|
||||||
warmup()
|
warmup()
|
||||||
}
|
}
|
||||||
@@ -552,7 +573,7 @@ class IosDriverBackend(private val udid: String) : DriverBackend {
|
|||||||
override fun launch(bundleId: String, clearState: Boolean, env: Map<String, String>) = withReconnect {
|
override fun launch(bundleId: String, clearState: Boolean, env: Map<String, String>) = withReconnect {
|
||||||
runCatching { driver.stopApp(bundleId) }
|
runCatching { driver.stopApp(bundleId) }
|
||||||
if (clearState) driver.clearAppState(bundleId)
|
if (clearState) driver.clearAppState(bundleId)
|
||||||
driver.launchApp(bundleId, env, java.util.UUID.randomUUID())
|
driver.launchApp(bundleId, env)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun terminate(bundleId: String) = withReconnect { driver.stopApp(bundleId) }
|
override fun terminate(bundleId: String) = withReconnect { driver.stopApp(bundleId) }
|
||||||
|
|||||||
Reference in new issue
Block a user