Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions data/runs.json
Original file line number Diff line number Diff line change
Expand Up @@ -742,5 +742,21 @@
"output": "hook raiseToast answered: \"shown\"\ngray box: the app was idle",
"caption": "`mobium hook raiseToast \"Toast raised by test script\"` on MobiumApp, Android 15 emulator, launched with `--gray-box`: the app's own toast says what the hook was sent",
"after": "/img/shots/app_hook-0-after.jpg"
},
"app_audio[0]": {
"tool": "app_audio",
"index": 0,
"command": "mobium audio start --app dev.mobium.mobiumapp",
"verbatim": true,
"exit": 0,
"output": "capturing audio — stop it with action \"stop\" and a path"
},
"app_audio[1]": {
"tool": "app_audio",
"index": 1,
"command": "mobium audio stop -o heard.wav --expect 440",
"verbatim": true,
"exit": 0,
"output": "saved …/heard.wav: 3.746s of audio: 0.0–0.5s silence, 0.5–0.6s sound, no one pitch (-46 dBFS), 0.6–2.6s 440 Hz (-42 dBFS), 2.6–3.7s silence — at media volume 5 of 15"
}
}
23 changes: 23 additions & 0 deletions examples/canonical.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,29 @@
}
}
],
"app_audio": [
{
"title": "Start capturing what an app plays",
"cli": "mobium audio start --app dev.mobium.mobiumapp",
"args": {
"action": "start",
"app": "dev.mobium.mobiumapp"
}
},
{
"title": "Stop, save the capture, and assert what was heard",
"cli": "mobium audio stop -o heard.wav --expect 440",
"args": {
"action": "stop",
"path": "heard.wav",
"expect": [
{
"hz": 440
}
]
}
}
],
"app_background": [
{
"title": "Send the app away for five seconds, and bring it back",
Expand Down
8 changes: 8 additions & 0 deletions examples/dotnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@
"code": "device.Appearance(\"dark\");"
}
],
"app_audio": [
{
"code": "device.AudioStart(\"dev.mobium.mobiumapp\");"
},
{
"code": "var heard = device.AudioExpect(\"heard.wav\", new List<IDictionary<string, object?>>\n{\n new Dictionary<string, object?> { [\"hz\"] = 440 },\n});"
}
],
"app_background": [
{
"code": "device.Background(5);"
Expand Down
8 changes: 8 additions & 0 deletions examples/go.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@
"code": "mode, err := dev.Appearance(ctx, \"dark\")\nif err != nil {\n\treturn err\n}\nfmt.Println(\"appearance is now\", mode)"
}
],
"app_audio": [
{
"code": "if _, err := dev.AudioStart(ctx, \"dev.mobium.mobiumapp\"); err != nil {\n\treturn err\n}"
},
{
"code": "heard, err := dev.AudioExpect(ctx, \"heard.wav\", []mobium.AudioExpected{{Hz: 440}}, 0)\nif err != nil {\n\treturn err\n}\nfmt.Println(heard.Path, len(heard.Timeline), \"segments\")"
}
],
"app_background": [
{
"code": "// \"\" means the app in front.\nif err := dev.Background(ctx, 5, \"\"); err != nil {\n\treturn err\n}"
Expand Down
8 changes: 8 additions & 0 deletions examples/java.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@
"code": "String mode = device.appearance(\"dark\"); // \"dark\", read back"
}
],
"app_audio": [
{
"code": "device.audioStart(\"dev.mobium.mobiumapp\");"
},
{
"code": "Map<String, Object> heard = device.audioExpect(\"heard.wav\", List.of(Map.of(\"hz\", 440)), null);\nSystem.out.println(heard.get(\"timeline\"));"
}
],
"app_background": [
{
"code": "device.background(5); // back in front, resumed, when this returns"
Expand Down
8 changes: 8 additions & 0 deletions examples/javascript.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@
"code": "await device.appearance('dark')"
}
],
"app_audio": [
{
"code": "await device.audio({ action: 'start', app: 'dev.mobium.mobiumapp' })"
},
{
"code": "const heard = await device.audio({ action: 'stop', path: 'heard.wav', expect: [{ hz: 440 }] })\nconsole.log(heard.timeline)"
}
],
"app_background": [
{
"code": "await device.background(5)"
Expand Down
1 change: 1 addition & 0 deletions examples/no-picture.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"apps": "it lists what is installed, and nothing on the screen changes.",
"audio": "it captures what the device plays, and answers with a timeline of sound, silence and pitch; nothing on the screen changes.",
"audit": "it reads the platform's audit of the screen, and nothing on the screen changes.",
"background": "the app is off the screen for the seconds it is away, and back in front when the command returns.",
"biometric": "what it presents goes to a prompt the app put up, and the app's own screen says what it made of it.",
Expand Down
8 changes: 8 additions & 0 deletions examples/python.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@
"code": "device.appearance(\"dark\")"
}
],
"app_audio": [
{
"code": "device.audio(\"start\", app=\"dev.mobium.mobiumapp\")"
},
{
"code": "heard = device.audio(\"stop\", \"heard.wav\", expect=[{\"hz\": 440}])\nfor segment in heard[\"timeline\"]:\n print(segment)"
}
],
"app_background": [
{
"code": "device.background(5)"
Expand Down
4 changes: 4 additions & 0 deletions scripts/capture.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@ def app_screen(name):
before=True, after=True, pause=2.0),
dict(tool="app_record", i=0, setup=settings_root()),
dict(tool="app_record", i=1, setup=["swipe up"]),
# A capture of MobiumApp's Audio Demo: started there, then its 440 Hz tone
# played for two seconds, so the stop's expect has what it asks for.
dict(tool="app_audio", i=0, setup=app_screen("Audio Demo") + ["wait testid=audioState"]),
dict(tool="app_audio", i=1, setup=["tap testid=audioTone", "$sleep 3"]),
dict(tool="app_list_apps", i=0),
dict(tool="app_contexts", i=0, setup=app_screen("WebViews") + ["tap 'text=Plain page'", "wait text=Back"],
after=True),
Expand Down
Loading