Skip to content

Commit 3b2e301

Browse files
authored
An example for app_assistant, so the site builds again (#13)
The generator requires an example for every tool, and app_assistant (mobiumdev/mobium#252) had none: the 2026-10-21 scheduled build failed with KeyError 'app_assistant', and the live site stayed at the 2026-10-20 build. Two scenarios, from the command's own help, in all five clients: "Open Clock" naming the app expected to come forward, and reading reached; and a question, reading the answer it showed. The first is captured on the Android 15 emulator, with Clock in front after. The second is not recorded: a signed-out emulator's Google Assistant answers a question with a web search sheet, read in one run of five, so its output would be third-party search results that change between runs. check_examples: 113 scenarios, 0 problems in every client, .NET included.
1 parent c952723 commit 3b2e301

9 files changed

Lines changed: 71 additions & 0 deletions

File tree

‎data/runs.json‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -768,5 +768,14 @@
768768
"exit": 0,
769769
"output": "pressed \"DON'T SAVE\" on the dialog \"Save this draft?\\nYou can come back to it later.\"",
770770
"after": "/img/shots/app_alert-2-after.jpg"
771+
},
772+
"app_assistant[0]": {
773+
"tool": "app_assistant",
774+
"index": 0,
775+
"command": "mobium assistant \"Open Clock\" --app com.google.android.deskclock",
776+
"verbatim": true,
777+
"exit": 0,
778+
"output": "asked Google Assistant (typed, not spoken): \"Open Clock\"\nit showed no text a screen read can see\nin front: com.google.android.deskclock\ncom.google.android.deskclock came forward",
779+
"after": "/img/shots/app_assistant-0-after.jpg"
771780
}
772781
}

‎examples/canonical.json‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -899,6 +899,24 @@
899899
"args": {}
900900
}
901901
],
902+
"app_assistant": [
903+
{
904+
"title": "Ask the assistant to open an app, and check that it came forward",
905+
"cli": "mobium assistant \"Open Clock\" --app com.google.android.deskclock",
906+
"args": {
907+
"request": "Open Clock",
908+
"app": "com.google.android.deskclock"
909+
}
910+
},
911+
{
912+
"title": "Ask a question, and read the answer it showed",
913+
"cli": "mobium assistant \"What is 15 times 3\" --timeout 20",
914+
"args": {
915+
"request": "What is 15 times 3",
916+
"timeout": 20
917+
}
918+
}
919+
],
902920
"app_hit_test": [
903921
{
904922
"title": "Ask where a tap on an element would really land",

‎examples/dotnet.json‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,14 @@
451451
"code": "var found = device.Audit();\nConsole.WriteLine(found[\"findings\"]);"
452452
}
453453
],
454+
"app_assistant": [
455+
{
456+
"code": "var got = device.Assistant(\"Open Clock\", app: \"com.google.android.deskclock\");\nif (!(got[\"reached\"] is bool reached && reached)) throw new Exception($\"in front: {got[\"front\"]}\");"
457+
},
458+
{
459+
"code": "var got = device.Assistant(\"What is 15 times 3\", timeoutSeconds: 20);\nConsole.WriteLine(got[\"answer\"]);"
460+
}
461+
],
454462
"app_hit_test": [
455463
{
456464
"code": "var hit = device.HitTest(\"testid=submit\");\nConsole.WriteLine(hit[\"reaches\"]);"

‎examples/go.json‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,14 @@
451451
"code": "found, err := dev.Audit(ctx)\nif err != nil {\n\treturn err\n}\nfor _, f := range found.Findings {\n\tfmt.Println(f.Type, f.Summary)\n}"
452452
}
453453
],
454+
"app_assistant": [
455+
{
456+
"code": "got, err := dev.Assistant(ctx, \"Open Clock\", mobium.AssistantOptions{App: \"com.google.android.deskclock\"})\nif err != nil {\n\treturn err\n}\nif got.Reached == nil || !*got.Reached {\n\treturn fmt.Errorf(\"Clock did not come forward: %s is in front\", got.Front)\n}"
457+
},
458+
{
459+
"code": "got, err := dev.Assistant(ctx, \"What is 15 times 3\", mobium.AssistantOptions{Timeout: 20 * time.Second})\nif err != nil {\n\treturn err\n}\nfmt.Println(got.Answer)"
460+
}
461+
],
454462
"app_hit_test": [
455463
{
456464
"code": "hit, err := dev.HitTest(ctx, \"testid=submit\")\nif err != nil {\n\treturn err\n}\nfmt.Println(hit.Reaches)"

‎examples/java.json‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,14 @@
451451
"code": "Map<String, Object> found = device.audit();\nSystem.out.println(found.get(\"findings\"));"
452452
}
453453
],
454+
"app_assistant": [
455+
{
456+
"code": "Map<String, Object> got = device.assistant(\"Open Clock\", \"com.google.android.deskclock\", 0);\nif (!Boolean.TRUE.equals(got.get(\"reached\"))) throw new AssertionError(\"in front: \" + got.get(\"front\"));"
457+
},
458+
{
459+
"code": "Map<String, Object> got = device.assistant(\"What is 15 times 3\", null, 20);\nSystem.out.println(got.get(\"answer\"));"
460+
}
461+
],
454462
"app_hit_test": [
455463
{
456464
"code": "Map<String, Object> hit = device.hitTest(\"testid=submit\");\nSystem.out.println(hit.get(\"reaches\"));"

‎examples/javascript.json‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,14 @@
451451
"code": "const found = await device.audit()\nconsole.log(found.findings)"
452452
}
453453
],
454+
"app_assistant": [
455+
{
456+
"code": "const got = await device.assistant('Open Clock', { app: 'com.google.android.deskclock' })\nif (!got.reached) throw new Error(`in front: ${got.front}`)"
457+
},
458+
{
459+
"code": "const got = await device.assistant('What is 15 times 3', { timeout: 20 })\nconsole.log(got.answer)"
460+
}
461+
],
454462
"app_hit_test": [
455463
{
456464
"code": "const hit = await device.hitTest('testid=submit')\nconsole.log(hit.reaches)"

‎examples/python.json‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,14 @@
451451
"code": "found = device.audit()\nfor f in found[\"findings\"]:\n print(f[\"type\"], f[\"summary\"])"
452452
}
453453
],
454+
"app_assistant": [
455+
{
456+
"code": "got = device.assistant(\"Open Clock\", app=\"com.google.android.deskclock\")\nassert got[\"reached\"], got[\"front\"]"
457+
},
458+
{
459+
"code": "got = device.assistant(\"What is 15 times 3\", timeout=20)\nprint(got[\"answer\"])"
460+
}
461+
],
454462
"app_hit_test": [
455463
{
456464
"code": "hit = device.hit_test(\"testid=submit\")\nprint(hit[\"reaches\"])"

‎scripts/capture.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,10 @@ def app_screen(name):
153153
# played for two seconds, so the stop's expect has what it asks for.
154154
dict(tool="app_audio", i=0, setup=app_screen("Audio Demo") + ["wait testid=audioState"]),
155155
dict(tool="app_audio", i=1, setup=["tap testid=audioTone", "$sleep 3"]),
156+
# The assistant, asked in typed text from the home screen: Clock is
157+
# terminated first, so the picture shows the assistant bringing it forward.
158+
dict(tool="app_assistant", i=0, setup=["terminate com.google.android.deskclock", "press home"], after=True,
159+
pause=2.0, restore=["terminate com.google.android.deskclock", "press home"]),
156160
dict(tool="app_list_apps", i=0),
157161
dict(tool="app_contexts", i=0, setup=app_screen("WebViews") + ["tap 'text=Plain page'", "wait text=Back"],
158162
after=True),
22.6 KB
Loading

0 commit comments

Comments
 (0)