forked from YueChen-C/py-ios-device
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
190 lines (140 loc) · 4.26 KB
/
test.py
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
"""
@Date : 2021-02-24
@Author : liyachao
"""
import time
from ios_device import py_ios_device
from ios_device.py_ios_device import PyiOSDevice
xcuitest_bundle_id = "cn.xx.autotest.xctrunner"
app_bundle_id = "com.tencent.xin"
def callback(res):
print(res)
def test_get_process():
process = py_ios_device.get_processes()
print(process)
def test_get_process_obj():
channel = PyiOSDevice()
process = channel.get_processes()
print(process)
channel.stop()
def test_get_channel():
channels = py_ios_device.get_channel()
print(channels)
def test_get_channel_obj():
channel = PyiOSDevice()
channels = channel.get_channel()
print(channels)
channel.stop()
def test_start_get_gpu():
channel = py_ios_device.start_get_gpu(callback=callback)
time.sleep(5)
py_ios_device.stop_get_gpu(channel)
channel.stop()
def test_start_get_gpu_obj():
channel = PyiOSDevice()
channel.start_get_gpu(callback=callback)
time.sleep(5)
channel.stop_get_gpu()
channel.stop()
def test_get_device():
device = py_ios_device.get_device()
app_list = device.get_apps()
print(app_list)
for index in app_list:
print(index.get("CFBundleDisplayName"))
print(index.get("CFBundleIdentifier"))
def test_get_device_obj():
channel = PyiOSDevice()
device = channel.get_device()
app_list = device.get_apps()
print(app_list)
channel.stop()
def test_launch_app():
py_ios_device.launch_app(app_bundle_id)
def test_launch_app_obj():
channel = PyiOSDevice()
channel.launch_app(app_bundle_id)
channel.stop()
def test_get_applications():
app_list = py_ios_device.get_applications()
print(app_list)
def test_get_applications_obj():
channel = PyiOSDevice()
app_list = channel.get_applications()
print(app_list)
channel.stop()
def test_start_xcuitest():
channel = py_ios_device.start_xcuitest(bundle_id=xcuitest_bundle_id, callback=callback)
time.sleep(5)
py_ios_device.stop_xcuitest(channel)
channel.stop()
def test_start_xcuitest_obj():
channel = PyiOSDevice()
channel.start_xcuitest(bundle_id=xcuitest_bundle_id, callback=callback)
time.sleep(5)
channel.stop_xcuitest()
channel.stop()
def test_start_get_fps():
channel = py_ios_device.start_get_fps(callback=callback)
time.sleep(5)
py_ios_device.stop_get_fps(channel)
channel.stop()
def test_start_get_fps_obj():
channel = PyiOSDevice()
channel.start_get_fps(callback=callback)
time.sleep(5)
channel.stop_get_fps()
channel.stop()
def test_start_get_graphics_fps():
channel = py_ios_device.start_get_graphics_fps(callback=callback)
time.sleep(5)
py_ios_device.stop_get_graphics_fps(channel)
channel.stop()
def test_start_get_graphics_fps_obj():
channel = PyiOSDevice()
channel.start_get_graphics_fps(callback=callback)
time.sleep(5)
channel.stop_get_graphics_fps()
channel.stop()
def test_start_get_mobile_notifications():
channel = py_ios_device.start_get_mobile_notifications(callback=callback)
time.sleep(5)
py_ios_device.stop_get_mobile_notifications(channel)
channel.stop()
def test_start_get_mobile_notifications_obj():
channel = PyiOSDevice()
channel.start_get_mobile_notifications(callback=callback)
time.sleep(5)
channel.stop_get_mobile_notifications()
channel.stop()
def test_get_netstat():
netstat = py_ios_device.get_netstat(216)
print(netstat)
def test_get_netstat_obj():
channel = PyiOSDevice()
netstat = channel.get_netstat(216)
print(netstat)
channel.stop()
if __name__ == "__main__":
# test_get_process()
# test_get_process_obj()
# test_get_channel()
# test_get_channel_obj()
# test_start_get_gpu()
# test_start_get_gpu_obj()
# test_get_device()
# test_get_device_obj()
# test_launch_app()
# test_launch_app_obj()
# test_get_applications()
# test_get_applications_obj()
# test_start_xcuitest()
# test_start_xcuitest_obj()
# test_start_get_fps()
# test_start_get_fps_obj()
# test_start_get_graphics_fps()
# test_start_get_graphics_fps_obj()
# test_start_get_mobile_notifications()
# test_start_get_mobile_notifications_obj()
# test_get_netstat()
test_get_netstat_obj()