-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.py
78 lines (76 loc) · 2.86 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
# -*- coding: utf-8 -*-
# Imports the monkeyrunner modules used by this program
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
# Connects to the current device, returning a MonkeyDevice object
device = MonkeyRunner.waitForConnection()
# Installs the Android package. Notice that this method returns a boolean, so
# you can test to see if the installation worked.
device.installPackage('C:\\Users\\Utente\\AndroidStudioProjects\\ingsw_unisannio\\app\\build\\outputs\\apk\\app-debug.apk')
# sets a variable with the package’s internal name
package = 'unisannio.ingsoft.bbm'
# sets a variable with the name of an Activity in the package
activity = '.MainActivity'
# sets the name of the component to start
runComponent = package + '/' + activity
# Runs the component
device.startActivity(component=runComponent)
# Wait for few seconds
MonkeyRunner.sleep(2)
# Takes a screenshot
result = device.takeSnapshot()
# Wait for few seconds
MonkeyRunner.sleep(5)
# Writes the screenshot to a file
result.writeToFile('C:\\Users\\Utente\\Desktop\\screenshoot_monkey\\shot1.png','png')
#Touch the new status button
device.touch(80.0, 267.0, MonkeyDevice.DOWN_AND_UP)
# Wait for few seconds
MonkeyRunner.sleep(5)
# Takes a screenshot
result = device.takeSnapshot()
# Wait for few seconds
MonkeyRunner.sleep(5)
# Writes the screenshot to a file
result.writeToFile('C:\\Users\\Utente\\Desktop\\screenshoot_monkey\\shot2.png','png')
device.touch(223.0,1254.0, MonkeyDevice.DOWN_AND_UP)
# Wait for few seconds
MonkeyRunner.sleep(5)
device.touch(575.0,102.0, MonkeyDevice.DOWN_AND_UP)
# Wait for few seconds
MonkeyRunner.sleep(5)
# Takes a screenshot
result = device.takeSnapshot()
# Wait for few seconds
MonkeyRunner.sleep(5)
# Writes the screenshot to a file
result.writeToFile('C:\\Users\\Utente\\Desktop\\screenshoot_monkey\\shot3.png','png')
MonkeyRunner.sleep(5)
device.touch(281.0,817.0, MonkeyDevice.DOWN_AND_UP)
# Wait for few seconds
MonkeyRunner.sleep(5)
# Takes a screenshot
result = device.takeSnapshot()
# Wait for few seconds
MonkeyRunner.sleep(5)
# Writes the screenshot to a file
result.writeToFile('C:\\Users\\Utente\\Desktop\\screenshoot_monkey\\shot4.png','png')
MonkeyRunner.sleep(5)
device.touch(465.0,680.0, MonkeyDevice.DOWN_AND_UP)
# Wait for few seconds
MonkeyRunner.sleep(5)
# Takes a screenshot
result = device.takeSnapshot()
# Wait for few seconds
MonkeyRunner.sleep(5)
# Writes the screenshot to a file
result.writeToFile('C:\\Users\\Utente\\Desktop\\screenshoot_monkey\\shot5.png','png')
MonkeyRunner.sleep(5)
device.touch(133.0,852.0, MonkeyDevice.DOWN_AND_UP)
# Wait for few seconds
MonkeyRunner.sleep(5)
# Takes a screenshot
result = device.takeSnapshot()
# Wait for few seconds
MonkeyRunner.sleep(5)
# Writes the screenshot to a file
result.writeToFile('C:\\Users\\Utente\\Desktop\\screenshoot_monkey\\shot6.png','png')