feat(hierarchy): flat-to-tree + path query selector (#41)

* feat(hierarchy): add Node tree + path query support

Preserve parent-child relationships in a Node tree at parse time.
Extend Find/FindAll with " > " path operator for scoped queries,
e.g. id:LoginScreen > desc:EmailInput.

Flat Elements slice and all public signatures unchanged.

* test(hierarchy): add path query tests

Cover single-level, multi-level, mixed-type, not-found, wrong-subtree,
and FindAll across multiple roots.

* feat(folio): add modifier param to Screen composable

* feat(folio): testTag LoginScreen

* feat(folio): testTag HomeScreen

* feat(folio): testTag AddAccountScreen

* feat(folio): testTag LedgerScreen

* feat(folio): testTag AddTransactionScreen

* feat(folio): scope spec selectors to screen testTags via path queries

* fix(sidecar): align grpc-netty/grpc-okhttp with grpc-core version

Maestro 1.40.0 brings grpc-netty:1.50.2 which compiled against
AbstractManagedChannelImplBuilder, removed in grpc-core 1.64+.
Gradle was upgrading grpc-core to 1.68.0 while leaving grpc-netty at
1.50.2, causing NoClassDefFoundError at startup.

Force grpc-netty and grpc-okhttp to match grpcVersion so all gRPC
artifacts are binary-compatible.

* fix(sidecar): use ephemeral host port for AndroidDriver

Hard-coded port 7001 caused TcpForwarder.start() to fail with
TimeoutException when a previous sidecar process held the port open.
Pick a free port via ServerSocket(0) instead.

* chore(sidecar): bump maestro to 2.4.0, exclude graalvm from fat JAR

Maestro 2.4.0 still ships grpc-netty:1.50.2 so the grpc transport
resolution strategy is kept. GraalVM JS is excluded: unused by our
sidecar and causes shadow JAR expansion errors (pom treated as zip).

* 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:
pj authored and GitHub committed 2026-04-25 18:46:15 +07:00
1 parent 2a1b263b8c
commit 6c32fb0e1d
11 files changed
+309 -41

No files matched your search

@@ -382,13 +382,14 @@ class MaestroDriverBackend(private val serial: String?) : DriverBackend {
init {
dadb = buildDadb(serial)
driver = maestro.drivers.AndroidDriver(dadb, 7001, "localhost")
val hostPort = java.net.ServerSocket(0).use { it.localPort }
driver = maestro.drivers.AndroidDriver(dadb, hostPort)
driver.open()
}
override fun launch(bundleId: String, clearState: Boolean, env: Map<String, String>) {
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)
@@ -491,24 +492,45 @@ class IosDriverBackend(private val udid: String) : DriverBackend {
private val reconnectLock = java.util.concurrent.locks.ReentrantLock()
init {
val httpClient = xcuitest.api.OkHttpClientInstance.get()
val metrics = maestro.utils.NoOpMetrics()
val wdaPort = maestro.utils.SocketUtils.nextFreePort(22000, 23000)
val installer = xcuitest.installer.LocalXCTestInstaller(
udid,
"localhost",
false,
wdaPort,
metrics,
httpClient,
false,
false,
val tempFileHandler = maestro.utils.TempFileHandler()
val simctlDevice = device.SimctlIOSDevice(
deviceId = udid,
tempFileHandler = tempFileHandler,
)
val xcTestDriverClient = xcuitest.XCTestDriverClient(installer, httpClient, false)
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)
val driverConfig = xcuitest.installer.LocalXCTestInstaller.IOSDriverConfig(
prebuiltRunner = false,
sourceDirectory = "driver-iPhoneSimulator",
context = xcuitest.installer.Context.CLI,
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()
warmup()
}
@@ -551,7 +573,7 @@ class IosDriverBackend(private val udid: String) : DriverBackend {
override fun launch(bundleId: String, clearState: Boolean, env: Map<String, String>) = withReconnect {
runCatching { driver.stopApp(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) }