diff --git a/data/runs.json b/data/runs.json index 561bc40..9c76a00 100644 --- a/data/runs.json +++ b/data/runs.json @@ -248,7 +248,7 @@ "command": "mobium alert", "verbatim": true, "exit": 0, - "output": "a dialog is on screen: \"Discard changes?\\nThey will be lost.\"", + "output": "a dialog is on screen: \"Discard changes?\\nThey will be lost.\"\nbuttons: \"KEEP EDITING\", \"DISCARD\"", "after": "/img/shots/app_alert-0-after.jpg" }, "app_locale[0]": { @@ -480,7 +480,7 @@ "command": "mobium alert accept", "verbatim": true, "exit": 0, - "output": "accepted the dialog \"Discard changes?\\nThey will be lost.\" — this answered it and did not choose an outcome: on a permission prompt accept and dismiss do not mean grant and deny, and on iOS they are the other way round. Tap the button by ref if you need a particular answer", + "output": "accepted the dialog \"Discard changes?\\nThey will be lost.\": pressed \"DISCARD\"", "after": "/img/shots/app_alert-1-after.jpg" }, "app_long_press:long-press testid=pressTarget": { @@ -758,5 +758,15 @@ "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" + }, + "app_alert[2]": { + "tool": "app_alert", + "index": 2, + "before": "/img/shots/app_alert-2-before.jpg", + "command": "mobium alert --button \"Don't Save\"", + "verbatim": true, + "exit": 0, + "output": "pressed \"DON'T SAVE\" on the dialog \"Save this draft?\\nYou can come back to it later.\"", + "after": "/img/shots/app_alert-2-after.jpg" } } diff --git a/examples/canonical.json b/examples/canonical.json index 8bfa89d..ed7353d 100644 --- a/examples/canonical.json +++ b/examples/canonical.json @@ -17,16 +17,23 @@ ], "app_alert": [ { - "title": "Ask whether a system dialog is up, and what it says", + "title": "Ask whether a dialog is up, what it says, and its buttons", "cli": "mobium alert", "args": {} }, { - "title": "Answer it with the platform's accept button", + "title": "Say yes to a dialog of one or two buttons", "cli": "mobium alert accept", "args": { "action": "accept" } + }, + { + "title": "Press a button by its caption, on a dialog of three", + "cli": "mobium alert --button \"Don't Save\"", + "args": { + "button": "Don't Save" + } } ], "app_appearance": [ diff --git a/examples/dotnet.json b/examples/dotnet.json index 13058aa..ad5b6c3 100644 --- a/examples/dotnet.json +++ b/examples/dotnet.json @@ -14,6 +14,9 @@ }, { "code": "device.AnswerAlert(true);" + }, + { + "code": "var pressed = device.PressAlertButton(\"Don't Save\");\nConsole.WriteLine($\"pressed {pressed}\");" } ], "app_appearance": [ diff --git a/examples/go.json b/examples/go.json index 17908c3..f1d7371 100644 --- a/examples/go.json +++ b/examples/go.json @@ -14,6 +14,9 @@ }, { "code": "if err := dev.AnswerAlert(ctx, true); err != nil {\n\treturn err\n}" + }, + { + "code": "pressed, err := dev.PressAlertButton(ctx, \"Don't Save\")\nif err != nil {\n\treturn err\n}\nfmt.Println(\"pressed\", pressed)" } ], "app_appearance": [ diff --git a/examples/java.json b/examples/java.json index 482d90b..533628f 100644 --- a/examples/java.json +++ b/examples/java.json @@ -14,6 +14,9 @@ }, { "code": "device.answerAlert(true);" + }, + { + "code": "String pressed = device.pressAlertButton(\"Don't Save\");\nSystem.out.println(\"pressed \" + pressed);" } ], "app_appearance": [ diff --git a/examples/javascript.json b/examples/javascript.json index 2e71940..6d863f6 100644 --- a/examples/javascript.json +++ b/examples/javascript.json @@ -14,6 +14,9 @@ }, { "code": "await device.answerAlert(true)" + }, + { + "code": "const result = await device.pressAlertButton(\"Don't Save\")\nconsole.log(`pressed ${result.pressed}`)" } ], "app_appearance": [ diff --git a/examples/python.json b/examples/python.json index 996cd61..8b30e9e 100644 --- a/examples/python.json +++ b/examples/python.json @@ -14,6 +14,9 @@ }, { "code": "device.answer_alert(accept=True)" + }, + { + "code": "result = device.press_alert_button(\"Don't Save\")\nprint(\"pressed\", result[\"pressed\"])" } ], "app_appearance": [ diff --git a/scripts/capture.py b/scripts/capture.py index ce21362..da0d041 100644 --- a/scripts/capture.py +++ b/scripts/capture.py @@ -114,6 +114,7 @@ def app_screen(name): dict(tool="app_alert", i=0, setup=app_screen("Dialog Demo") + ["tap 'text=Two-button alert'", "wait 'text=Discard changes?'"], after=True, restore=["alert dismiss"]), dict(tool="app_alert", i=1, setup=app_screen("Dialog Demo") + ["tap 'text=Two-button alert'", "wait 'text=Discard changes?'"], before=True, after=True), + dict(tool="app_alert", i=2, setup=app_screen("Dialog Demo") + ["tap 'text=Three-button alert'", "wait 'text=Save this draft?'"], before=True, after=True), dict(tool="app_locale", i=0, after=False, restore=["locale org.wikipedia ''"]), dict(tool="app_locale", i=None, cmd="launch org.wikipedia", diff --git a/static/img/shots/app_alert-0-after.jpg b/static/img/shots/app_alert-0-after.jpg index ab2cf23..c6cf1a5 100644 Binary files a/static/img/shots/app_alert-0-after.jpg and b/static/img/shots/app_alert-0-after.jpg differ diff --git a/static/img/shots/app_alert-1-after.jpg b/static/img/shots/app_alert-1-after.jpg index 39aa389..f555da0 100644 Binary files a/static/img/shots/app_alert-1-after.jpg and b/static/img/shots/app_alert-1-after.jpg differ diff --git a/static/img/shots/app_alert-1-before.jpg b/static/img/shots/app_alert-1-before.jpg index 441571f..063aca4 100644 Binary files a/static/img/shots/app_alert-1-before.jpg and b/static/img/shots/app_alert-1-before.jpg differ diff --git a/static/img/shots/app_alert-2-after.jpg b/static/img/shots/app_alert-2-after.jpg new file mode 100644 index 0000000..000e405 Binary files /dev/null and b/static/img/shots/app_alert-2-after.jpg differ diff --git a/static/img/shots/app_alert-2-before.jpg b/static/img/shots/app_alert-2-before.jpg new file mode 100644 index 0000000..8407a75 Binary files /dev/null and b/static/img/shots/app_alert-2-before.jpg differ