forked from leancodepl/patrol
-
Notifications
You must be signed in to change notification settings - Fork 0
/
contracts.proto
225 lines (186 loc) · 5.49 KB
/
contracts.proto
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
syntax = "proto3";
package patrol;
option java_package = "pl.leancode.patrol.contracts";
service PatrolAppService {
rpc listDartTests(Empty) returns (ListDartTestsResponse) {}
rpc runDartTest(RunDartTestRequest) returns (RunDartTestResponse) {}
}
message ListDartTestsResponse {
DartTestGroup group = 1;
}
message DartTestGroup {
string name = 1;
repeated DartTestCase tests = 2;
repeated DartTestGroup groups = 3;
}
message DartTestCase {
string name = 1;
}
message RunDartTestRequest {
string name = 1;
}
message RunDartTestResponse {
enum Result {
SUCCESS = 0;
SKIPPED = 1;
FAILURE = 2;
}
Result result = 1;
optional string details = 2;
}
service NativeAutomator {
rpc initialize(Empty) returns (Empty) {}
rpc configure(ConfigureRequest) returns (Empty) {}
// general
rpc pressHome(Empty) returns (Empty) {}
rpc pressBack(Empty) returns (Empty) {}
rpc pressRecentApps(Empty) returns (Empty) {}
rpc doublePressRecentApps(Empty) returns (Empty) {}
rpc openApp(OpenAppRequest) returns (Empty) {}
rpc openQuickSettings(OpenQuickSettingsRequest) returns (Empty) {}
// general UI interaction
rpc getNativeViews(GetNativeViewsRequest) returns (GetNativeViewsResponse) {}
rpc tap(TapRequest) returns (Empty) {}
rpc doubleTap(TapRequest) returns (Empty) {}
rpc enterText(EnterTextRequest) returns (Empty) {}
rpc swipe(SwipeRequest) returns (Empty) {}
rpc waitUntilVisible(WaitUntilVisibleRequest) returns (Empty) {}
// services
rpc enableAirplaneMode(Empty) returns (Empty) {}
rpc disableAirplaneMode(Empty) returns (Empty) {}
rpc enableWiFi(Empty) returns (Empty) {}
rpc disableWiFi(Empty) returns (Empty) {}
rpc enableCellular(Empty) returns (Empty) {}
rpc disableCellular(Empty) returns (Empty) {}
rpc enableBluetooth(Empty) returns (Empty) {}
rpc disableBluetooth(Empty) returns (Empty) {}
rpc enableDarkMode(DarkModeRequest) returns (Empty) {}
rpc disableDarkMode(DarkModeRequest) returns (Empty) {}
// notifications
rpc openNotifications(Empty) returns (Empty) {}
rpc closeNotifications(Empty) returns (Empty) {}
rpc closeHeadsUpNotification(Empty) returns (Empty) {}
rpc getNotifications(GetNotificationsRequest) returns (GetNotificationsResponse) {}
rpc tapOnNotification(TapOnNotificationRequest) returns (Empty) {}
// permissions
rpc isPermissionDialogVisible(PermissionDialogVisibleRequest) returns (PermissionDialogVisibleResponse) {}
rpc handlePermissionDialog(HandlePermissionRequest) returns (Empty) {}
rpc setLocationAccuracy(SetLocationAccuracyRequest) returns (Empty) {}
// other
rpc debug(Empty) returns (Empty) {}
// TODO(bartekpacia): Move this RPC into a new PatrolNativeTestService service because it doesn't fit here
rpc markPatrolAppServiceReady(Empty) returns (Empty) {}
}
message ConfigureRequest {
uint64 findTimeoutMillis = 1;
}
message OpenAppRequest { string appId = 1; }
message TapOnNotificationRequest {
oneof findBy {
uint32 index = 1;
Selector selector = 2;
}
}
// We're defining our own Empty instead of using google.protobuf.Empty because
// the Dart plugin can't easily generate it.
//
// See:
// * https://github.com/google/protobuf.dart/issues/170
message Empty {}
message OpenQuickSettingsRequest {}
message DarkModeRequest { string appId = 1; }
message GetNativeViewsRequest {
Selector selector = 1;
string appId = 2;
}
message GetNativeViewsResponse { repeated NativeView nativeViews = 2;}
message GetNotificationsRequest {}
message GetNotificationsResponse { repeated Notification notifications = 2; }
message TapRequest {
Selector selector = 1;
string appId = 2;
}
message EnterTextRequest {
string data = 1;
string appId = 2;
oneof findBy {
uint32 index = 3;
Selector selector = 4;
}
KeyboardBehavior keyboardBehavior = 5;
enum KeyboardBehavior {
SHOW_AND_DISMISS = 0;
ALTERNATIVE = 1;
}
}
message SwipeRequest {
float startX = 1;
float startY = 2;
float endX = 3;
float endY = 4;
uint32 steps = 5;
string appId = 6;
}
message WaitUntilVisibleRequest {
Selector selector = 1;
string appId = 2;
}
message HandlePermissionRequest {
Code code = 1;
enum Code {
WHILE_USING = 0;
ONLY_THIS_TIME = 1;
DENIED = 2;
}
}
message SetLocationAccuracyRequest {
LocationAccuracy locationAccuracy = 1;
enum LocationAccuracy {
COARSE = 0;
FINE = 1;
}
}
message PermissionDialogVisibleRequest {
uint64 timeoutMillis = 1;
}
message PermissionDialogVisibleResponse {
bool visible = 1;
}
message Selector {
optional string text = 1;
optional string textStartsWith = 2;
optional string textContains = 3;
optional string className = 4;
optional string contentDescription = 5;
optional string contentDescriptionStartsWith = 6;
optional string contentDescriptionContains = 7;
optional string resourceId = 8;
optional uint32 instance = 9;
optional bool enabled = 10;
optional bool focused = 11;
optional string pkg = 12;
}
// Represents a native UI control.
//
// On Android, this is `android.view.View`.
message NativeView {
string className = 1;
string text = 2;
string contentDescription = 3;
bool focused = 4;
bool enabled = 5;
int32 childCount = 6;
string resourceName = 7;
string applicationPackage = 8;
repeated NativeView children = 9;
}
// Represents a notification visible in the notification shade.
message Notification {
optional string appName = 1;
string title = 2;
string content = 3;
string raw = 4;
}
message SubmitTestResultsRequest {
map<string, string> results = 1;
}