forked from dtmilano/CulebraTester2-public
-
Notifications
You must be signed in to change notification settings - Fork 0
/
openapi.yaml
1152 lines (1048 loc) · 30.1 KB
/
openapi.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openapi: 3.0.0
info:
title: CulebraTester
description: >
## Snaky Android Test
---
If you want to be able to try out the API using the **Execute** or **TRY** button from this page
- an android device should be connected using `adb`
- the server should have been started using `./culebratester2 start-server`
then you will be able to invoke the API and see the responses.
version: 2.0.12
servers:
- url: "http://localhost:9987/v2"
paths:
/culebra/help/{api}:
get:
summary: Gets help
description: Gets help info about the *API* specified as parameter.
For example you can obtain information about
* /uiDevice/click
* /device/displayRealSize
* /uiDevice/screenshot
* etc.
responses:
200:
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/Help"
default:
$ref: '#/components/responses/error'
parameters:
- name: api
in: path
description: Specify the API help is about
required: true
schema:
type: string
/culebra/info:
get:
summary: Gets information about this app
description: Gets information about this app
responses:
200:
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/CulebraInfo'
default:
$ref: '#/components/responses/error'
/device/displayRealSize:
get:
summary: Gets display real size
description: Gets the display real size
responses:
200:
description: Display real size
content:
application/json:
schema:
$ref: "#/components/schemas/DisplayRealSize"
default:
$ref: '#/components/responses/error'
/targetContext/startActivity:
get:
summary: Starts an Activity
description: Starts an Activity
parameters:
- name: "pkg"
in: query
required: true
description: the package name
schema:
type: string
- name: "cls"
in: query
required: true
description: the class name
schema:
type: string
responses:
200:
$ref: '#/components/responses/ok'
default:
$ref: '#/components/responses/error'
/objectStore/list:
get:
summary: Lists the objects in store
description: Lists the objects in store
responses:
200:
description: OK
content:
application/json:
schema:
type: array
items:
type: object
properties:
oid:
type: integer
object:
type: object
default:
$ref: '#/components/responses/error'
/uiDevice/dumpWindowHierarchy:
get:
summary: Dumps the window hierarchy
description: Dumps the window hierarchy
parameters:
- name: format
in: query
required: false
description: the output format
schema:
type: string
responses:
200:
description: Window hierarchy
content:
application/json:
schema:
$ref: "#/components/schemas/WindowHierarchy"
application/xml:
schema:
$ref: "#/components/schemas/WindowHierarchy"
default:
$ref: '#/components/responses/error'
/uiDevice/click:
get:
summary: Clicks at the specified location
description: Clicks at the specified location
parameters:
- name: "x"
in: query
required: true
description: x coordinate
schema:
type: integer
minimum: 0
- name: "y"
in: query
required: true
description: y coordinate
schema:
type: integer
minimum: 0
responses:
200:
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/StatusResponse"
text/plain:
schema:
type: string
example: OK
default:
$ref: '#/components/responses/error'
/uiDevice/findObject:
get:
summary: Finds an object
description: Finds an object. The object found, if any, can be later used in other call like API.click.
parameters:
- name: resourceId
in: query
description: the resource id
example: 'com.android.calendar:id/d0_label'
schema:
type: string
- name: uiSelector
in: query
description: the selector sets the resource name criteria for matching. A UI element will be considered a match if its resource name exactly matches the selector parameter and all other criteria for this selector are met.
The format of the selector string is
`sel@[$]value,...`
Where `sel` can be one of
- clazz or className
- clickable
- depth
- desc
- index
- instance
- package
- parentIndex
- res
- scrollable
- text
`@` replaces the `=` sign that is used to separate parameters and values in the URL. If the first character of value is `$` then a `Pattern` is created.
example: '[email protected]:id/d0_label,instance@1'
schema:
type: string
- name: bySelector
in: query
description: the selector sets the resource name criteria for matching. A UI element will be considered a match if its resource name exactly matches the selector parameter and all other criteria for this selector are met.
The format of the selector string is
`sel@[$]value,...`
Where `sel` can be one of
- checkable
- clazz
- clickable
- depth
- desc
- package
- res
- scrollable
- text
`@` replaces the `=` sign that is used to separate parameters and values in the URL. If the first character of value is `$` then a `Pattern` is created.
example: '[email protected]:id/d0_label,depth@2'
schema:
type: string
responses:
200:
description: Object found
content:
application/json:
schema:
$ref: '#/components/schemas/ObjectRef'
example:
oid: 1
className: 'android.widget.TextView'
404:
description: Object not found
content:
application/json:
schema:
$ref: '#/components/schemas/StatusResponse'
example:
status: ERROR
errorStatusResponse: 1001
errorMessage: Object not found
default:
$ref: '#/components/responses/error'
post:
summary: Finds an object
description: Finds an object. The object found, if any, can be later used in other call like API.click.
requestBody:
description: Selector
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Selector'
responses:
200:
description: Object found
content:
application/json:
schema:
$ref: '#/components/schemas/ObjectRef'
example:
oid: 1
className: 'android.widget.Button'
404:
description: Object not found
content:
application/json:
schema:
$ref: '#/components/schemas/StatusResponse'
example:
status: ERROR
errorStatusResponse: 1001
errorMessage: Object not found
default:
$ref: '#/components/responses/error'
/uiDevice/findObjects:
get:
summary: Finds *all* objects that match the selector criteria.
description: Finds an object. The object found, if any, can be later used in other call like API.click.
parameters:
- name: bySelector
in: query
description: the selector sets the resource name criteria for matching. A UI element will be considered a match if its resource name exactly matches the selector parameter and all other criteria for this selector are met.
The format of the selector string is
`sel@[$]value,...`
Where `sel` can be one of
- checkable
- clazz
- clickable
- depth
- desc
- package
- res
- scrollable
- text
`@` replaces the `=` sign that is used to separate parameters and values in the URL. If the first character of value is `$` then a `Pattern` is created.
example: '[email protected]:id/d0_label,depth@2'
schema:
type: string
responses:
200:
description: Objects found
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/ObjectRef'
example: [{'oid': 1, 'className': 'android.widget.Button'}, {'oid': 2, 'className': 'android.widget.TextView'}]
404:
description: Object not found
content:
application/json:
schema:
$ref: '#/components/schemas/StatusResponse'
example:
status: ERROR
errorStatusResponse: 1001
errorMessage: Object not found
default:
$ref: '#/components/responses/error'
/uiDevice/currentPackageName:
get:
summary: Gets the current package name
description: Gets the current package name
responses:
200:
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/CurrentPackageName'
default:
$ref: '#/components/responses/error'
/uiDevice/displayHeight:
get:
summary: Gets the display height
description: Gets the display height
responses:
200:
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/DisplayHeight'
default:
$ref: '#/components/responses/error'
/uiDevice/displayRotation:
get:
summary: Gets the display rotation
description: Gets the display rotation
responses:
200:
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/DisplayRotation'
default:
$ref: '#/components/responses/error'
/uiDevice/displaySizeDp:
get:
summary: Gets the display size in DP
description: Gets the display size in DP
responses:
200:
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/DisplaySizeDp'
default:
$ref: '#/components/responses/error'
/uiDevice/displayWidth:
get:
summary: Gets the display width
description: Gets the display width
responses:
200:
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/DisplayWidth'
default:
$ref: '#/components/responses/error'
/uiDevice/lastTraversedText:
get:
summary: Retrieves the text from the last UI traversal event received.
description: Retrieves the text from the last UI traversal event received.
responses:
200:
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/LastTraversedText'
default:
$ref: '#/components/responses/error'
/uiDevice/productName:
get:
summary: Retrieves the product name of the device.
description: Retrieves the product name of the device.
responses:
200:
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/ProductName'
default:
$ref: '#/components/responses/error'
/uiDevice/pressBack:
get:
summary: Simulates a short press on the BACK button.
description: Simulates a short press on the BACK button.
responses:
200:
$ref: '#/components/responses/ok'
default:
$ref: '#/components/responses/error'
/uiDevice/pressDelete:
get:
summary: Simulates a short press on the DELETE key.
description: Simulates a short press on the DELETE key.
responses:
200:
$ref: '#/components/responses/ok'
default:
$ref: '#/components/responses/error'
/uiDevice/pressEnter:
get:
summary: Simulates a short press on the ENTER key.
description: Simulates a short press on the ENTER key.
responses:
200:
$ref: '#/components/responses/ok'
default:
$ref: '#/components/responses/error'
/uiDevice/pressHome:
get:
summary: Simulates a short press on the HOME button.
description: Simulates a short press on the HOME button.
responses:
200:
$ref: '#/components/responses/ok'
default:
$ref: '#/components/responses/error'
/uiDevice/pressRecentApps:
get:
summary: Simulates a short press on the Recent Apps button.
description: Simulates a short press on the Recent Apps button.
responses:
200:
$ref: '#/components/responses/ok'
default:
$ref: '#/components/responses/error'
/uiDevice/swipe:
get:
summary: Performs a swipe.
description: Performs a swipe from one coordinate to another using the number of steps to determine smoothness and speed. Each step execution is throttled to 5ms per step. So for a 100 steps, the swipe will take about 1/2 second to complete.
parameters:
- name: startX
description: from x
in: query
required: true
schema:
type: integer
minimum: 0
- name: startY
description: from y
in: query
required: true
schema:
type: integer
minimum: 0
- name: endX
description: to x
in: query
required: true
schema:
type: integer
minimum: 0
- name: endY
description: end y
in: query
required: true
schema:
type: integer
minimum: 0
- name: steps
description: is the number of move steps sent to the system
in: query
required: true
schema:
type: integer
minimum: 0
responses:
200:
$ref: '#/components/responses/ok'
default:
$ref: '#/components/responses/error'
post:
summary: Performs a swipe between points in the Point array.
description: Each step execution is throttled to 5ms per step. So for a 100 steps, the swipe will take about 1/2 second to complete
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/SwipeBody'
responses:
200:
$ref: '#/components/responses/ok'
default:
$ref: '#/components/responses/error'
/uiDevice/waitForIdle:
get:
summary: Waits for the current application to idle.
description: Waits for the current application to idle.
parameters:
- name: timeout
description: in milliseconds
in: query
schema:
type: integer
format: int64
default: 10000
responses:
200:
$ref: '#/components/responses/ok'
default:
$ref: '#/components/responses/error'
/uiDevice/waitForWindowUpdate:
get:
summary: Waits for a window content update event to occur.
description: If a package name for the window is specified, but the current window does not have the same package name, the function returns immediately.
parameters:
- name: packageName
description: the specified window package name (can be null or not present). If null, a window update from any front-end window will end the wait
in: query
required: false
schema:
type: string
- name: timeout
description: in milliseconds
in: query
required: true
schema:
type: integer
format: int64
responses:
200:
$ref: '#/components/responses/ok'
default:
$ref: '#/components/responses/error'
/uiDevice/pressKeyCode:
get:
summary: Simulates a short press using a key code.
description: Simulates a short press using a key code.
parameters:
- name: keyCode
description: the key code of the event.
in: query
required: true
schema:
type: integer
- name: metaState
description: an integer in which each bit set to 1 represents a pressed meta key
in: query
required: false
schema:
type: integer
responses:
200:
$ref: '#/components/responses/ok'
default:
$ref: '#/components/responses/error'
/uiDevice/screenshot:
get:
summary: Gets the device screenshot
description: >
Gets the device screenshot and can be influenced by the parameters.
For example the `scale` of the screenshot or its `quality` can be specified.
**NOTE**: [`UiDevice.takeScreenshot()`](https://developer.android.com/reference/android/support/test/uiautomator/UiDevice.html#takeScreenshot(java.io.File,%20float,%20int)) usually ignores these parameters so expect no change.
responses:
200:
description: OK
content:
image/png:
schema:
type: string
format: binary
examples:
exernal-image-example:
summary: External example image
externalValue: "https://raw.githubusercontent.com/wiki/dtmilano/AndroidViewClient/images/emulator-launcher-shortcuts.png"
400:
description: Cannot obtain screenshot
content:
application/json:
schema:
$ref: "#/components/schemas/StatusResponse"
parameters:
- name: "scale"
in: query
required: false
description: The scale of the screenshot (i.e. 0.5)
schema:
type: number
format: float
minimum: 0
exclusiveMinimum: true
maximum: 1.0
example: 0.5
- name: "quality"
in: query
required: false
description: The quality of the screenshot (i.e. 100)
schema:
type: integer
minimum: 1
maximum: 100
example: 90
/uiObject2/{oid}/click:
get:
summary: Clicks on the specified object.
description: The target object should have been found using `findObject` with a `selector`.
parameters:
- name: oid
in: path
required: true
description: The object ID
schema:
type: integer
responses:
200:
$ref: '#/components/responses/ok'
default:
$ref: '#/components/responses/error'
/uiObject2/{oid}/dump:
get:
summary: Dumps the specified object.
description: The target object should have been found using `findObject` with a `selector`.
parameters:
- name: oid
in: path
required: true
description: The object ID
schema:
type: integer
responses:
200:
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Selector'
default:
$ref: '#/components/responses/error'
/uiObject2/{oid}/getText:
get:
summary: Gets the text content.
description: The target object should have been found using `findObject` with a `selector`.
parameters:
- name: oid
in: path
required: true
description: The object ID
schema:
type: integer
responses:
200:
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/Text'
default:
$ref: '#/components/responses/error'
/uiObject2/{oid}/longClick:
get:
summary: Long-clicks on the specified object.
description: The target object should have been found using `findObject` with a `selector`.
parameters:
- name: oid
in: path
required: true
description: The object ID
schema:
type: integer
responses:
200:
$ref: '#/components/responses/ok'
default:
$ref: '#/components/responses/error'
/uiObject2/{oid}/setText:
post:
summary: Sets the text content if this object is an editable field.
description: The target object should have been found using `findObject` with a `selector`.
parameters:
- name: oid
in: path
required: true
description: The object ID
schema:
type: integer
requestBody:
description: Text to enter in the field
required: true
content:
application/json:
schema:
type: object
properties:
text:
type: string
responses:
200:
$ref: '#/components/responses/ok'
default:
$ref: '#/components/responses/error'
components:
schemas:
StatusResponse:
type: object
required:
- status
properties:
status:
type: string
enum:
- OK
- ERROR
- UNKNOWKN
statusCode:
type: integer
errorMessage:
type: string
example:
status: ERROR
statusCode: 100
errorMessage: Operation could not be completed
CulebraInfo:
type: object
properties:
versionName:
type: string
versionCode:
type: integer
required:
- versionName
- versionCode
CurrentPackageName:
type: object
properties:
currentPackageName:
type: string
description: the current package name
example:
currentPackageName: 'com.android.calendar'
DisplayHeight:
type: object
properties:
displayHeight:
type: integer
description: the current display height
example:
displayHeight: 1776
DisplayRotationEnum:
type: integer
description: the current display rotation
# the generation of this enum is incorrect: i.e.: 0("0")
enum:
- 0
- 180
- 270
- 90
DisplayRotation:
type: object
properties:
displayRotation:
type: integer
description: the current display rotation
enum:
- 0
- 180
- 270
- 90
# there no way of doing this
# schema:
# $ref: '#/components/schemas/DisplayRotation'
# and even though, the generated enum is wrong
example:
displayRotation: 0
DisplaySizeDp:
type: object
properties:
displaySizeDpX:
type: integer
description: the display x in DP
displaySizeDpY:
type: integer
description: the display y in DP
example:
displaySizeDpX: 2400
displaySizeDpY: 1080
DisplayWidth:
type: object
properties:
displayWidth:
type: integer
description: the current display width
example:
displayHeight: 1080
Help:
type: object
required:
- text
properties:
text:
type: string
example:
text: CulebraTester Help
DisplayRealSize:
type: object
required:
- device
- x
- y
properties:
device:
type: string
x:
type: integer
y:
type: integer
artWidth:
type: integer
artHeight:
type: integer
screenshotWidth:
type: integer
screenshotX:
type: integer
screenshotY:
type: integer
example:
device: emulator
x: 960
y: 1080
screenshotWidth: 960
LastTraversedText:
type: object
properties:
lastTraversedText:
type: string
description: text of the last traversal event, else return an empty string
example:
lastTraversedText: ""
WindowHierarchyChild:
type: object
properties:
id:
type: integer
parent:
type: integer
text:
type: string
package:
type: string
checkable:
type: boolean
clickable:
type: boolean
index:
type: integer
contentDescription:
type: string
focusable:
type: boolean
resourceId:
type: string
enabled:
type: boolean
password:
type: boolean
longClickable:
type: boolean
longText:
type: string
clazz:
type: string
scrollable:
type: boolean
selected:
type: boolean
checked:
type: boolean
focused:
type: boolean
bounds:
type: array
items:
type: integer
children:
type: array
items:
$ref: '#/components/schemas/WindowHierarchyChild'
example:
$ref: '#/components/examples/windowHierarchyChild'
WindowHierarchy:
type: object
properties:
id:
type: string
text: