Skip to content

Commit 9003d33

Browse files
authored
app_alert: accept is yes on a dialog of one or two buttons, and --button presses one (mobiumdev/mobium#195) (#11)
The second example's title said accept presses the platform's accept button; since #195 it is yes on a dialog of one or two buttons, a dialog of three is refused, and every answer says which button it pressed. A third example presses Don't Save on the three-button alert by caption, with a straight apostrophe, in all five clients. All three recaptured on the Android 15 emulator against Mobium at 38df00f.
1 parent 6b16f8f commit 9003d33

13 files changed

Lines changed: 37 additions & 4 deletions

‎data/runs.json‎

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@
248248
"command": "mobium alert",
249249
"verbatim": true,
250250
"exit": 0,
251-
"output": "a dialog is on screen: \"Discard changes?\\nThey will be lost.\"",
251+
"output": "a dialog is on screen: \"Discard changes?\\nThey will be lost.\"\nbuttons: \"KEEP EDITING\", \"DISCARD\"",
252252
"after": "/img/shots/app_alert-0-after.jpg"
253253
},
254254
"app_locale[0]": {
@@ -480,7 +480,7 @@
480480
"command": "mobium alert accept",
481481
"verbatim": true,
482482
"exit": 0,
483-
"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",
483+
"output": "accepted the dialog \"Discard changes?\\nThey will be lost.\": pressed \"DISCARD\"",
484484
"after": "/img/shots/app_alert-1-after.jpg"
485485
},
486486
"app_long_press:long-press testid=pressTarget": {
@@ -758,5 +758,15 @@
758758
"verbatim": true,
759759
"exit": 0,
760760
"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"
761+
},
762+
"app_alert[2]": {
763+
"tool": "app_alert",
764+
"index": 2,
765+
"before": "/img/shots/app_alert-2-before.jpg",
766+
"command": "mobium alert --button \"Don't Save\"",
767+
"verbatim": true,
768+
"exit": 0,
769+
"output": "pressed \"DON'T SAVE\" on the dialog \"Save this draft?\\nYou can come back to it later.\"",
770+
"after": "/img/shots/app_alert-2-after.jpg"
761771
}
762772
}

‎examples/canonical.json‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,23 @@
1717
],
1818
"app_alert": [
1919
{
20-
"title": "Ask whether a system dialog is up, and what it says",
20+
"title": "Ask whether a dialog is up, what it says, and its buttons",
2121
"cli": "mobium alert",
2222
"args": {}
2323
},
2424
{
25-
"title": "Answer it with the platform's accept button",
25+
"title": "Say yes to a dialog of one or two buttons",
2626
"cli": "mobium alert accept",
2727
"args": {
2828
"action": "accept"
2929
}
30+
},
31+
{
32+
"title": "Press a button by its caption, on a dialog of three",
33+
"cli": "mobium alert --button \"Don't Save\"",
34+
"args": {
35+
"button": "Don't Save"
36+
}
3037
}
3138
],
3239
"app_appearance": [

‎examples/dotnet.json‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
},
1515
{
1616
"code": "device.AnswerAlert(true);"
17+
},
18+
{
19+
"code": "var pressed = device.PressAlertButton(\"Don't Save\");\nConsole.WriteLine($\"pressed {pressed}\");"
1720
}
1821
],
1922
"app_appearance": [

‎examples/go.json‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
},
1515
{
1616
"code": "if err := dev.AnswerAlert(ctx, true); err != nil {\n\treturn err\n}"
17+
},
18+
{
19+
"code": "pressed, err := dev.PressAlertButton(ctx, \"Don't Save\")\nif err != nil {\n\treturn err\n}\nfmt.Println(\"pressed\", pressed)"
1720
}
1821
],
1922
"app_appearance": [

‎examples/java.json‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
},
1515
{
1616
"code": "device.answerAlert(true);"
17+
},
18+
{
19+
"code": "String pressed = device.pressAlertButton(\"Don't Save\");\nSystem.out.println(\"pressed \" + pressed);"
1720
}
1821
],
1922
"app_appearance": [

‎examples/javascript.json‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
},
1515
{
1616
"code": "await device.answerAlert(true)"
17+
},
18+
{
19+
"code": "const result = await device.pressAlertButton(\"Don't Save\")\nconsole.log(`pressed ${result.pressed}`)"
1720
}
1821
],
1922
"app_appearance": [

‎examples/python.json‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
},
1515
{
1616
"code": "device.answer_alert(accept=True)"
17+
},
18+
{
19+
"code": "result = device.press_alert_button(\"Don't Save\")\nprint(\"pressed\", result[\"pressed\"])"
1720
}
1821
],
1922
"app_appearance": [

‎scripts/capture.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ def app_screen(name):
114114
dict(tool="app_alert", i=0, setup=app_screen("Dialog Demo") + ["tap 'text=Two-button alert'", "wait 'text=Discard changes?'"], after=True,
115115
restore=["alert dismiss"]),
116116
dict(tool="app_alert", i=1, setup=app_screen("Dialog Demo") + ["tap 'text=Two-button alert'", "wait 'text=Discard changes?'"], before=True, after=True),
117+
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),
117118
dict(tool="app_locale", i=0, after=False,
118119
restore=["locale org.wikipedia ''"]),
119120
dict(tool="app_locale", i=None, cmd="launch org.wikipedia",
226 Bytes
Loading
227 Bytes
Loading

0 commit comments

Comments
 (0)