feat: Maestro driver integration + DeviceDriver architecture (#32)

* proto(driver): drop launcher_activity from LaunchRequest

* refactor(driver): rename Driver to DeviceDriver, drop launcherActivity from Launch

* refactor(driver): rename package maestro to sidecar

* feat(driver): add ChromeDriver backed by chromedp

* feat(hierarchy): replace XML parser with TreeNode JSON parser

* refactor(driver): update mock and runner to DeviceDriver, drop launcherActivity

* feat(runner): add platform routing for web vs sidecar

* test(verifier): update hierarchy fixtures from XML to TreeNode JSON

* feat(sidecar): extract readLogcat/readProcMetrics; add MaestroDriverBackend

- Extract readLogcat() and readProcMetrics() as internal package-level
  helpers parameterised by serial
- Add MaestroDriverBackend wiring maestro-client AndroidDriver
- Drop launcherActivity from DriverBackend interface and StubDriverBackend
- Add maestro-utils and micrometer-core as explicit compile deps

* refactor(sidecar): inject DriverBackend into DriverService; drop launcherActivity

- Remove serial and default backend from DriverService constructor
- Make backend a required parameter
- Drop launcherActivity from launch RPC handler
- Create MaestroDriverBackend in Main.kt when platform is android

* test(sidecar): update tests for dropped launcherActivity and required backend

* chore(sidecar): remove unnecessary micrometer-core direct dependency
This commit is contained in:
pj authored and GitHub committed 2026-04-22 19:02:39 +07:00
1 parent b667abbbca
commit d5b6f6ccaf
26 files changed
+880 -450

No files matched your search

+4 -3
View File
@@ -9,12 +9,13 @@ import (
// TestStateAxFindWorks verifies that a Parse+PushSnapshot+extract round trip
// actually lets the spec resolve selectors through state.ax.find.
// Reads /tmp/live-dump.json (Maestro TreeNode JSON format); skipped if absent.
func TestStateAxFindWorks(t *testing.T) {
xmlText, err := os.ReadFile("/tmp/live-dump.xml")
jsonText, err := os.ReadFile("/tmp/live-dump.json")
if err != nil {
t.Skip("live-dump.xml not present")
t.Skip("live-dump.json not present")
}
tree, err := hierarchy.Parse(string(xmlText))
tree, err := hierarchy.Parse(string(jsonText))
if err != nil {
t.Fatal(err)
}
+16 -16
View File
@@ -1,19 +1,19 @@
package verifier
const listHierarchyXML = `<?xml version="1.0" encoding="UTF-8"?>
<hierarchy rotation="0">
<node index="0" class="android.widget.FrameLayout" package="test.app" bounds="[0,0][1080,2400]">
<node index="0" class="android.widget.TextView" text="Items" bounds="[100,200][900,300]" />
<node index="1" class="android.view.View" content-desc="primary_action" clickable="true" enabled="true" bounds="[64,2200][1016,2320]" />
<node index="2" class="android.view.View" content-desc="secondary_action" clickable="true" enabled="true" bounds="[980,80][1060,160]" />
</node>
</hierarchy>`
const listHierarchyJSON = `{
"attributes": {"class": "android.widget.FrameLayout", "package": "test.app", "bounds": "[0,0,1080,2400]"},
"children": [
{"attributes": {"class": "android.widget.TextView", "text": "Items", "bounds": "[100,200,900,300]"}, "children": []},
{"attributes": {"content-desc": "primary_action", "bounds": "[64,2200,1016,2320]"}, "children": [], "clickable": true, "enabled": true},
{"attributes": {"content-desc": "secondary_action", "bounds": "[980,80,1060,160]"}, "children": [], "clickable": true, "enabled": true}
]
}`
const formHierarchyXML = `<?xml version="1.0" encoding="UTF-8"?>
<hierarchy rotation="0">
<node index="0" class="android.widget.FrameLayout" package="test.app" bounds="[0,0][1080,2400]">
<node index="0" class="android.view.View" content-desc="text_field" clickable="true" enabled="true" bounds="[64,320][1016,440]" />
<node index="1" class="android.view.View" content-desc="primary_action" clickable="true" enabled="true" bounds="[64,2200][1016,2320]" />
<node index="2" class="android.view.View" content-desc="secondary_action" clickable="true" enabled="true" bounds="[32,80][112,160]" />
</node>
</hierarchy>`
const formHierarchyJSON = `{
"attributes": {"class": "android.widget.FrameLayout", "package": "test.app", "bounds": "[0,0,1080,2400]"},
"children": [
{"attributes": {"content-desc": "text_field", "bounds": "[64,320,1016,440]"}, "children": [], "clickable": true, "enabled": true},
{"attributes": {"content-desc": "primary_action", "bounds": "[64,2200,1016,2320]"}, "children": [], "clickable": true, "enabled": true},
{"attributes": {"content-desc": "secondary_action", "bounds": "[32,80,112,160]"}, "children": [], "clickable": true, "enabled": true}
]
}`
+6 -6
View File
@@ -65,7 +65,7 @@ func TestIntegrationSpecFiresInputActions(t *testing.T) {
t.Fatal(err)
}
tree, err := hierarchy.Parse(formHierarchyXML)
tree, err := hierarchy.Parse(formHierarchyJSON)
if err != nil {
t.Fatal(err)
}
@@ -105,7 +105,7 @@ func TestIntegrationSpecPropertiesEvaluate(t *testing.T) {
t.Fatal(err)
}
tree, err := hierarchy.Parse(listHierarchyXML)
tree, err := hierarchy.Parse(listHierarchyJSON)
if err != nil {
t.Fatal(err)
}
@@ -134,21 +134,21 @@ func TestIntegrationSpecPropertiesEvaluate(t *testing.T) {
func TestIntegrationSpecActionsFireOnEachRoute(t *testing.T) {
cases := []struct {
name string
xml string
hierarchy string
snapshots Snapshots
expectKind ActionKind
expectOns []string
}{
{
name: "list",
xml: listHierarchyXML,
hierarchy: listHierarchyJSON,
snapshots: listSnapshots(),
expectKind: ActionKindTap,
expectOns: []string{"desc:primary_action", "desc:secondary_action"},
},
{
name: "form",
xml: formHierarchyXML,
hierarchy: formHierarchyJSON,
snapshots: formSnapshots(),
expectKind: ActionKindTap,
expectOns: []string{"desc:primary_action", "desc:secondary_action"},
@@ -161,7 +161,7 @@ func TestIntegrationSpecActionsFireOnEachRoute(t *testing.T) {
if err := v.Load(bundleIntegrationSpec(t)); err != nil {
t.Fatal(err)
}
tree, err := hierarchy.Parse(tc.xml)
tree, err := hierarchy.Parse(tc.hierarchy)
if err != nil {
t.Fatal(err)
}