Пример #1
0
def execute():
    for i in range(2):
        device.touch(50, 50, 'DOWN_AND_UP')
        MonkeyRunner.sleep(4)
        if checkpic.picCompare(device, caseName, 0.9, 1 + 5 * i) == 0:
            return 0
        device.touch(300, 660, 'DOWN_AND_UP')
        MonkeyRunner.sleep(1)
        device.type('joe%d' % (i))
        MonkeyRunner.sleep(0.5)
        device.touch(570, 650, 'DOWN_AND_UP')
        MonkeyRunner.sleep(1)
        device.touch(300, 810, 'DOWN_AND_UP')
        MonkeyRunner.sleep(3)
        if checkpic.keyCheck(device, caseName, 1, 2 + 5 * i, 'Name') == 0:
            return 0
        device.touch(300, 120, 'DOWN_AND_UP')
        MonkeyRunner.sleep(1)
        if checkpic.picCompare(device, caseName, 0.9, 3 + 5 * i) == 0:
            return 0
        device.touch(300, 730, 'DOWN_AND_UP')
        MonkeyRunner.sleep(1)
        device.type('cname%d' % (i))
        MonkeyRunner.sleep(0.5)
        device.touch(570, 650, 'DOWN_AND_UP')
        MonkeyRunner.sleep(1)
        device.touch(300, 890, 'DOWN_AND_UP')
        MonkeyRunner.sleep(3)
        if checkpic.keyCheck(device, caseName, 1, 4 + 5 * i, 'Name') == 0:
            return 0
        device.touch(480, 120, 'DOWN_AND_UP')
        MonkeyRunner.sleep(1)
        if checkpic.keyCheck(device, caseName, 1, 5 + 5 * i, 'world') == 0:
            return 0
        device.touch(40, 40, 'DOWN_AND_UP')
        MonkeyRunner.sleep(1)
Пример #2
0
def execute():
    device.touch(550, 50, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    device.touch(300, 630, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    device.touch(300, 310, 'DOWN_AND_UP')
    MonkeyRunner.sleep(1)
    device.touch(300, 880, 'DOWN_AND_UP')
    MonkeyRunner.sleep(5)
    login()
    if checkpic.picCompare(device, caseName, 1, 1) == 0:
        return 0
    #France
    device.touch(550, 50, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    device.touch(300, 630, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    device.touch(300, 390, 'DOWN_AND_UP')
    MonkeyRunner.sleep(1)
    device.touch(300, 880, 'DOWN_AND_UP')
    MonkeyRunner.sleep(5)
    login()
    if checkpic.picCompare(device, caseName, 1, 2) == 0:
        return 0
    #Deutsch
    device.touch(550, 50, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    device.touch(300, 630, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    device.touch(300, 460, 'DOWN_AND_UP')
    MonkeyRunner.sleep(1)
    device.touch(300, 880, 'DOWN_AND_UP')
    MonkeyRunner.sleep(5)
    login()
    if checkpic.picCompare(device, caseName, 1, 3) == 0:
        return 0
    #Italy
    device.touch(550, 50, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    device.touch(300, 630, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    device.touch(300, 540, 'DOWN_AND_UP')
    MonkeyRunner.sleep(1)
    device.touch(300, 880, 'DOWN_AND_UP')
    MonkeyRunner.sleep(5)
    login()
    if checkpic.picCompare(device, caseName, 1, 4) == 0:
        return 0
    #Spain
    device.touch(550, 50, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    device.touch(300, 630, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    device.touch(300, 620, 'DOWN_AND_UP')
    MonkeyRunner.sleep(1)
    device.touch(300, 880, 'DOWN_AND_UP')
    MonkeyRunner.sleep(5)
    login()
    if checkpic.picCompare(device, caseName, 1, 5) == 0:
        return 0
    #Turkey
    device.touch(550, 50, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    device.touch(300, 630, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    device.touch(300, 700, 'DOWN_AND_UP')
    MonkeyRunner.sleep(1)
    device.touch(300, 880, 'DOWN_AND_UP')
    MonkeyRunner.sleep(5)
    login()
    if checkpic.picCompare(device, caseName, 1, 6) == 0:
        return 0
    #Svenska
    device.touch(550, 50, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    device.touch(300, 630, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    device.touch(300, 780, 'DOWN_AND_UP')
    MonkeyRunner.sleep(1)
    device.touch(300, 880, 'DOWN_AND_UP')
    MonkeyRunner.sleep(5)
    login()
    if checkpic.picCompare(device, caseName, 1, 7) == 0:
        return 0
    #Netherland
    device.touch(550, 50, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    device.touch(300, 630, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    device.drag((300, 800), (300, 100), 0.1, 1)
    MonkeyRunner.sleep(1)
    device.touch(300, 530, 'DOWN_AND_UP')
    MonkeyRunner.sleep(1)
    device.touch(300, 880, 'DOWN_AND_UP')
    MonkeyRunner.sleep(5)
    login()
    if checkpic.picCompare(device, caseName, 1, 8) == 0:
        return 0
    #Dansk
    device.touch(550, 50, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    device.touch(300, 630, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    device.drag((300, 800), (300, 100), 0.1, 1)
    MonkeyRunner.sleep(1)
    device.touch(300, 610, 'DOWN_AND_UP')
    MonkeyRunner.sleep(1)
    device.touch(300, 880, 'DOWN_AND_UP')
    MonkeyRunner.sleep(5)
    login()
    if checkpic.picCompare(device, caseName, 1, 9) == 0:
        return 0
    #Pykistan
    device.touch(550, 50, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    device.touch(300, 630, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    device.drag((300, 800), (300, 100), 0.1, 1)
    MonkeyRunner.sleep(1)
    device.touch(300, 690, 'DOWN_AND_UP')
    MonkeyRunner.sleep(1)
    device.touch(300, 880, 'DOWN_AND_UP')
    MonkeyRunner.sleep(5)
    login()
    if checkpic.picCompare(device, caseName, 1, 10) == 0:
        return 0
    #Polski
    device.touch(550, 50, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    device.touch(300, 630, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    device.drag((300, 800), (300, 100), 0.1, 1)
    MonkeyRunner.sleep(1)
    device.touch(300, 770, 'DOWN_AND_UP')
    MonkeyRunner.sleep(1)
    device.touch(300, 880, 'DOWN_AND_UP')
    MonkeyRunner.sleep(5)
    login()
    if checkpic.picCompare(device, caseName, 1, 11) == 0:
        return 0
Пример #3
0
def execute():
	device.touch(100,300,'DOWN_AND_UP')
	MonkeyRunner.sleep(3)
	if checkpic.picCompare(device,caseName,0.9,1)==0:
			return 0
	device.touch(300,130,'DOWN_AND_UP')
	MonkeyRunner.sleep(1)
	device.touch(300,340,'DOWN_AND_UP')
	MonkeyRunner.sleep(1)
	device.touch(400,430,'DOWN_AND_UP')
	MonkeyRunner.sleep(3)
	device.touch(40,40,'DOWN_AND_UP')
	MonkeyRunner.sleep(1.5)
	device.touch(100,300,'DOWN_AND_UP')
	MonkeyRunner.sleep(3)
	device.touch(300,130,'DOWN_AND_UP')
	MonkeyRunner.sleep(1)
	if checkpic.keyCheck(device,caseName,1,2,'taxRate')==0:
			return 0
	device.touch(240,340,'DOWN_AND_UP')
	MonkeyRunner.sleep(1)
	device.touch(400,430,'DOWN_AND_UP')
	MonkeyRunner.sleep(3)
	if checkpic.keyCheck(device,caseName,1,3,'taxRate')==0:
			return 0
	device.touch(400,200,'DOWN_AND_UP')
	MonkeyRunner.sleep(1)
	if checkpic.keyCheck(device,caseName,1,4,'production')==0:
			return 0
	device.touch(300,330,'DOWN_AND_UP')
	MonkeyRunner.sleep(2)
	if checkpic.keyCheck(device,caseName,1,5,'resourceInfo')==0:
			return 0
	device.touch(80,320,'DOWN_AND_UP')
	MonkeyRunner.sleep(2)
	device.touch(300,410,'DOWN_AND_UP')
	MonkeyRunner.sleep(2)
	if checkpic.keyCheck(device,caseName,1,6,'resourceInfo')==0:
			return 0
	device.touch(80,320,'DOWN_AND_UP')
	MonkeyRunner.sleep(2)
	device.touch(300,490,'DOWN_AND_UP')
	MonkeyRunner.sleep(2)
	if checkpic.keyCheck(device,caseName,1,7,'resourceInfo')==0:
			return 0
	device.touch(80,320,'DOWN_AND_UP')
	MonkeyRunner.sleep(2)
	device.touch(300,560,'DOWN_AND_UP')
	MonkeyRunner.sleep(2)
	if checkpic.keyCheck(device,caseName,1,8,'resourceInfo')==0:
			return 0
	device.touch(80,320,'DOWN_AND_UP')
	MonkeyRunner.sleep(2)
	device.touch(300,630,'DOWN_AND_UP')
	MonkeyRunner.sleep(2)
	if checkpic.keyCheck(device,caseName,0.99,9,'menu')==0:
			return 0
	device.touch(80,320,'DOWN_AND_UP')
	MonkeyRunner.sleep(2)
	device.touch(490,130,'DOWN_AND_UP')
	MonkeyRunner.sleep(3)
	if checkpic.keyCheck(device,caseName,0.99,10,'menu')==0:
			return 0
Пример #4
0
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice, MonkeyImage
import checkpic
import pprint
caseName='City_Buildings'

device = MonkeyRunner.waitForConnection()
device.touch(30,540,'DOWN_AND_UP')#home
MonkeyRunner.sleep(2)
device.touch(300,180,'DOWN_AND_UP')
MonkeyRunner.sleep(1.5)
device.touch(230,340,'DOWN_AND_UP')
MonkeyRunner.sleep(7)
checkpic.picCompare(device,caseName,0.95,1)
device.touch(100,600,'DOWN_AND_UP')#Barracks
MonkeyRunner.sleep(2)
device.touch(300,310,'DOWN_AND_UP')
MonkeyRunner.sleep(1.5)
device.touch(230,340,'DOWN_AND_UP')
MonkeyRunner.sleep(3)
device.touch(560,770,'DOWN_AND_UP')
MonkeyRunner.sleep(2)
device.touch(300,220,'DOWN_AND_UP')
Пример #5
0
def execute():
    device.touch(440, 920, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    device.touch(500, 920, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    device.touch(80, 40, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    device.touch(500, 920, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    if checkpic.picCompare(device, caseName, 0.99, 1) == 0:
        return 0
    device.touch(300, 190, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    device.type('joe')
    MonkeyRunner.sleep(1)
    device.touch(300, 280, 'DOWN_AND_UP')
    MonkeyRunner.sleep(1)
    device.touch(300, 280, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    device.type('~!@#$%^&*()_+QWERTYUIOP{}|ASDFGHJKL:"')
    device.touch(300, 500, 'DOWN_AND_UP')
    MonkeyRunner.sleep(1)
    device.touch(300, 500, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    for i in range(21):
        device.type('~!@#$%^&*()_+QWERTYUIOP{}|ASDFGHJKL:"ZXCVBNM<>?')
        device.press('KEYCODE_SPACE', 'DOWN_AND_UP')
        device.type("`1234567890-=qwertyuiop[]\sadfghjkl;'zxcvbnm,./")
        device.press('KEYCODE_ENTER', 'DOWN_AND_UP')
    device.touch(560, 220, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    device.touch(550, 40, 'DOWN_AND_UP')
    MonkeyRunner.sleep(5)
    if checkpic.picCompare(device, caseName, 0.99, 2) == 0:
        return 0
    device.press('KEYCODE_BACK', 'DOWN_AND_UP')
    MonkeyRunner.sleep(60)
    device.touch(440, 920, 'DOWN_AND_UP')
    device1.touch(520, 1200, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    device.touch(500, 120, 'DOWN_AND_UP')
    device1.touch(130, 150, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    device.touch(300, 240, 'DOWN_AND_UP')
    device1.touch(360, 320, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    if checkpic.keyCheck(device, caseName, 1, 3, 'mailContent') == 0:
        imageB = device1.takeSnapshot()
        num = 0
        while os.path.isfile(
                '/Users/chenbiao/Desktop/auto/fault/error_%s_3_1_%d.png' %
            (caseName, num)):
            num = num + 1
        imageB.writeToFile(
            '/Users/chenbiao/Desktop/auto/fault/error_%s_3_1_%d.png' %
            (caseName, num), 'png')
        return 0
    #reply
    device1.touch(80, 1200, 'DOWN_AND_UP')
    MonkeyRunner.sleep(1)
    device1.touch(360, 700, 'DOWN_AND_UP')
    MonkeyRunner.sleep(1)
    for i in range(21):
        device1.type('~!@#$%^&*()_+QWERTYUIOP{}|ASDFGHJKL:"ZXCVBNM<>?')
        device1.press('KEYCODE_SPACE', 'DOWN_AND_UP')
        device1.type("`1234567890-=qwertyuiop[]\sadfghjkl;'zxcvbnm,./")
        device1.press('KEYCODE_ENTER', 'DOWN_AND_UP')
    MonkeyRunner.sleep(1)
    device1.press('KEYCODE_BACK', 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    device1.touch(640, 60, 'DOWN_AND_UP')
    MonkeyRunner.sleep(3)
    #FWD
    device1.touch(250, 1200, 'DOWN_AND_UP')
    MonkeyRunner.sleep(1)
    device1.touch(360, 240, 'DOWN_AND_UP')
    MonkeyRunner.sleep(1)
    device1.type('chb')
    MonkeyRunner.sleep(1)
    device1.touch(640, 60, 'DOWN_AND_UP')
    MonkeyRunner.sleep(1)
    device1.touch(640, 60, 'DOWN_AND_UP')
    MonkeyRunner.sleep(3)
    #repeat FWD
    device1.touch(250, 1200, 'DOWN_AND_UP')
    MonkeyRunner.sleep(1)
    device1.touch(360, 240, 'DOWN_AND_UP')
    MonkeyRunner.sleep(1)
    device1.type('chb')
    MonkeyRunner.sleep(1)
    device1.touch(640, 60, 'DOWN_AND_UP')
    MonkeyRunner.sleep(1)
    device1.touch(640, 60, 'DOWN_AND_UP')
    MonkeyRunner.sleep(3)
    #block device1.touch(480,900,'DOWN_AND_UP')
    #MonkeyRunner.sleep(3)
    device.press('KEYCODE_BACK', 'DOWN_AND_UP')
    MonkeyRunner.sleep(1)
    device.press('KEYCODE_BACK', 'DOWN_AND_UP')
    MonkeyRunner.sleep(60)
    device.touch(440, 920, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    device.touch(120, 120, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    if checkpic.keyCheck(device, caseName, 1, 4, 'mailList') == 0:
        return 0
    device.touch(530, 50, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    device.touch(40, 240, 'DOWN_AND_UP')
    MonkeyRunner.sleep(1)
    device.touch(40, 350, 'DOWN_AND_UP')
    MonkeyRunner.sleep(1)
    device.touch(490, 920, 'DOWN_AND_UP')
    MonkeyRunner.sleep(1)
    if checkpic.keyCheck(device, caseName, 1, 5, 'mailList') == 0:
        return 0
    device.touch(300, 240, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    if checkpic.keyCheck(device, caseName, 1, 6, 'mailSubject') == 0:
        return 0
    device.touch(560, 40, 'DOWN_AND_UP')
    MonkeyRunner.sleep(1)
    device.touch(560, 40, 'DOWN_AND_UP')
    MonkeyRunner.sleep(1)
    device.touch(560, 40, 'DOWN_AND_UP')
    MonkeyRunner.sleep(1)
    device.touch(490, 40, 'DOWN_AND_UP')
    MonkeyRunner.sleep(1)
    if checkpic.keyCheck(device, caseName, 1, 7, 'mailSubject') == 0:
        return 0
    device.touch(40, 40, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    if checkpic.keyCheck(device, caseName, 1, 8, 'mailList') == 0:
        return 0
    device.touch(530, 50, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    device.touch(40, 240, 'DOWN_AND_UP')
    MonkeyRunner.sleep(1)
    device.touch(40, 350, 'DOWN_AND_UP')
    MonkeyRunner.sleep(1)
    device.touch(300, 920, 'DOWN_AND_UP')
    MonkeyRunner.sleep(1)
    if checkpic.keyCheck(device, caseName, 1, 9, 'mailList') == 0:
        return 0
Пример #6
0
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice, MonkeyImage
import checkpic
import pprint
caseName = 'View_switch'

device = MonkeyRunner.waitForConnection()
device.touch(50, 920, 'DOWN_AND_UP')
MonkeyRunner.sleep(3)
checkpic.picCompare(device, caseName, 0.9, 1)
device.touch(50, 920, 'DOWN_AND_UP')
MonkeyRunner.sleep(3)
checkpic.picCompare(device, caseName, 0.9, 2)
device.touch(50, 920, 'DOWN_AND_UP')
MonkeyRunner.sleep(3)
checkpic.picCompare(device, caseName, 0.9, 3)
for i in range(30):
    device.touch(50, 920, 'DOWN_AND_UP')
    MonkeyRunner.sleep(0.3)
MonkeyRunner.sleep(0.5)
checkpic.picCompare(device, caseName, 0.9, 4)
for i in range(31):
    device.touch(50, 920, 'DOWN_AND_UP')
    MonkeyRunner.sleep(0.3)
MonkeyRunner.sleep(0.5)
checkpic.picCompare(device, caseName, 0.9, 5)
for i in range(31):
    device.touch(50, 920, 'DOWN_AND_UP')
    MonkeyRunner.sleep(0.3)
MonkeyRunner.sleep(0.5)
checkpic.picCompare(device, caseName, 0.9, 6)
device.touch(50, 920, 'DOWN_AND_UP')
Пример #7
0
device = MonkeyRunner.waitForConnection()
device.startActivity('com.kabam.fortress/.KBNActivity')
MonkeyRunner.sleep(7)
device.touch(200, 50, 'DOWN_AND_UP')
MonkeyRunner.sleep(1)
device.type(mid)
MonkeyRunner.sleep(0.5)
device.touch(500, 50, 'DOWN_AND_UP')
MonkeyRunner.sleep(0.5)
device.touch(500, 50, 'DOWN_AND_UP')
MonkeyRunner.sleep(0.5)
device.touch(420, 450, 'DOWN_AND_UP')
MonkeyRunner.sleep(20)
pprint.pprint('start check 1')
checkpic.picCompare(device, caseName, 0.9, 1)
pprint.pprint('check 1 completed')
device.touch(160, 330, 'DOWN_AND_UP')
MonkeyRunner.sleep(1)
device.touch(300, 850, 'DOWN_AND_UP')
MonkeyRunner.sleep(1.5)
device.touch(300, 900, 'DOWN_AND_UP')
MonkeyRunner.sleep(40)
pprint.pprint('start check 2')
checkpic.picCompare(device, caseName, 0.9, 2)
pprint.pprint('check 2 completed')
device.touch(450, 820, 'DOWN_AND_UP')
MonkeyRunner.sleep(5)
device.touch(450, 600, 'DOWN_AND_UP')
MonkeyRunner.sleep(5)
device.touch(450, 600, 'DOWN_AND_UP')
Пример #8
0
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice, MonkeyImage
import checkpic
import pprint
caseName='Field_resource_buildings'

device = MonkeyRunner.waitForConnection()
device.touch(50,920,'DOWN_AND_UP')
MonkeyRunner.sleep(3)
device.touch(100,400,'DOWN_AND_UP')#farm
MonkeyRunner.sleep(2)
device.touch(300,180,'DOWN_AND_UP')
MonkeyRunner.sleep(1.5)
device.touch(230,340,'DOWN_AND_UP')
MonkeyRunner.sleep(8)
checkpic.picCompare(device,caseName,0.95,1)
device.touch(300,120,'DOWN_AND_UP')
MonkeyRunner.sleep(1.5)
checkpic.picCompare(device,caseName,0.99,2)
device.touch(50,50,'DOWN_AND_UP')
MonkeyRunner.sleep(1.5)
device.touch(510,350,'DOWN_AND_UP')#Lumber mill
MonkeyRunner.sleep(2)
device.touch(300,300,'DOWN_AND_UP')
MonkeyRunner.sleep(1.5)
device.touch(230,340,'DOWN_AND_UP')
MonkeyRunner.sleep(8)
checkpic.picCompare(device,caseName,0.95,3)
device.touch(300,120,'DOWN_AND_UP')
MonkeyRunner.sleep(1.5)
checkpic.picCompare(device,caseName,0.99,4)
device.touch(50,50,'DOWN_AND_UP')
Пример #9
0
def execute():
	device.touch(570,195,'DOWN_AND_UP')
	MonkeyRunner.sleep(2)
	device.touch(300,210,'DOWN_AND_UP')
	MonkeyRunner.sleep(2)
	device.touch(460,460,'DOWN_AND_UP')
	MonkeyRunner.sleep(5)
	if checkpic.picCompare(device,caseName,0.99,1)==0:
			return 0
	device.touch(300,340,'DOWN_AND_UP')
	MonkeyRunner.sleep(2)
	device.touch(460,460,'DOWN_AND_UP')
	MonkeyRunner.sleep(5)
	if checkpic.picCompare(device,caseName,0.99,2)==0:
			return 0
	device.touch(300,470,'DOWN_AND_UP')
	MonkeyRunner.sleep(2)
	device.touch(460,520,'DOWN_AND_UP')
	MonkeyRunner.sleep(5)
	if checkpic.picCompare(device,caseName,0.99,3)==0:
			return 0
	device.touch(300,610,'DOWN_AND_UP')
	MonkeyRunner.sleep(2)
	device.touch(460,520,'DOWN_AND_UP')
	MonkeyRunner.sleep(5)
	if checkpic.picCompare(device,caseName,0.99,4)==0:
			return 0
	device.touch(550,60,'DOWN_AND_UP')
	MonkeyRunner.sleep(2)
	if checkpic.keyCheck(device,caseName,0.95,5,'buffIcon')==0:
			return 0
	device.touch(570,195,'DOWN_AND_UP')
	MonkeyRunner.sleep(2)
	device.touch(300,740,'DOWN_AND_UP')
	MonkeyRunner.sleep(2)
	device.touch(460,460,'DOWN_AND_UP')
	MonkeyRunner.sleep(5)
	if checkpic.picCompare(device,caseName,0.99,6)==0:
			return 0
	device.touch(300,880,'DOWN_AND_UP')
	MonkeyRunner.sleep(2)
	device.touch(460,460,'DOWN_AND_UP')
	MonkeyRunner.sleep(5)
	if checkpic.picCompare(device,caseName,0.99,7)==0:
			return 0
	device.drag((300,800),(300,100),0.1,1)
	MonkeyRunner.sleep(1)
	device.touch(300,610,'DOWN_AND_UP')
	MonkeyRunner.sleep(2)
	device.touch(460,460,'DOWN_AND_UP')
	MonkeyRunner.sleep(5)
	if checkpic.picCompare(device,caseName,0.99,8)==0:
			return 0
	device.touch(300,740,'DOWN_AND_UP')
	MonkeyRunner.sleep(2)
	device.touch(460,460,'DOWN_AND_UP')
	MonkeyRunner.sleep(5)
	if checkpic.picCompare(device,caseName,0.99,9)==0:
			return 0
	device.touch(300,880,'DOWN_AND_UP')
	MonkeyRunner.sleep(2)
	device.touch(460,460,'DOWN_AND_UP')
	MonkeyRunner.sleep(5)
	if checkpic.picCompare(device,caseName,0.99,10)==0:
			return 0
	device.touch(550,60,'DOWN_AND_UP')
Пример #10
0
MonkeyRunner.sleep(0.5)
device.press('KEYCODE_SPACE', 'DOWN_AND_UP')
MonkeyRunner.sleep(0.5)
device.press('KEYCODE_DEL', 'DOWN_AND_UP')
MonkeyRunner.sleep(0.5)
device.press('KEYCODE_1', 'DOWN_AND_UP')
MonkeyRunner.sleep(0.5)
device.touch(460, 400, 'DOWN_AND_UP')
MonkeyRunner.sleep(0.5)
device.touch(int(500 * h), int(50 * w), 'DOWN_AND_UP')
MonkeyRunner.sleep(0.5)
device.touch(int(450 * h), int(300 * w), 'DOWN_AND_UP')
MonkeyRunner.sleep(3)
device.touch(int(300 * h), int(900 * w), 'DOWN_AND_UP')
MonkeyRunner.sleep(60)
imageB = device.takeSnapshot()
MonkeyRunner.sleep(3)
device.press('KEYCODE_HOME', 'DOWN_AND_UP')
MonkeyRunner.sleep(2)
device.touch(150 * w, 590 * h, 'DOWN_AND_UP')
MonkeyRunner.sleep(1)
device.touch(250 * w, 550 * h, 'DOWN_AND_UP')
MonkeyRunner.sleep(1)
device.touch(1000 * w, 20 * h, 'DOWN_AND_UP')

if checkpic.picCompare(imageA, imageB, 1024 * w, 600 * h, 0.9):
    pprint.pprint('pass')
else:
    pprint.pprint('fail')
    imageB.writeToFile(
        '/Users/chenbiao/Desktop/auto/fault/error_%s.png' % caseName, 'png')
Пример #11
0
def execute():
    device.touch(350, 920, 'DOWN_AND_UP')
    de.touch(260, 840, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    device.touch(300, 470, 'DOWN_AND_UP')
    de.touch(240, 350, 'DOWN_AND_UP')
    MonkeyRunner.sleep(3)
    device.touch(300, 290, 'DOWN_AND_UP')
    de.touch(100, 200, 'DOWN_AND_UP')
    MonkeyRunner.sleep(1)
    device.type('joe')
    de.press('J', 'DOWN_AND_UP')
    MonkeyRunner.sleep(0.5)
    device.touch(570, 830, 'DOWN_AND_UP')
    de.press('O', 'DOWN_AND_UP')
    MonkeyRunner.sleep(0.5)
    device.touch(570, 830, 'DOWN_AND_UP')
    de.press('E', 'DOWN_AND_UP')
    MonkeyRunner.sleep(0.5)
    device.touch(300, 500, 'DOWN_AND_UP')
    MonkeyRunner.sleep(1)
    device.type('testalliance')
    MonkeyRunner.sleep(0.5)
    device.touch(570, 830, 'DOWN_AND_UP')
    MonkeyRunner.sleep(0.5)
    device.touch(570, 830, 'DOWN_AND_UP')
    MonkeyRunner.sleep(1)
    device.touch(300, 880, 'DOWN_AND_UP')
    MonkeyRunner.sleep(6)
    de.touch(400, 200, 'DOWN_AND_UP')
    if checkpic.keyCheck(device, caseName, 1, 1, 'menu') == 0:
        return 0
    de.touch(240, 300, 'DOWN_AND_UP')
    device.touch(40, 40, 'DOWN_AND_UP')
    MonkeyRunner.sleep(1)
    de.touch(240, 800, 'DOWN_AND_UP')
    MonkeyRunner.sleep(3)
    device.touch(350, 920, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    device.touch(300, 600, 'DOWN_AND_UP')
    MonkeyRunner.sleep(1)
    device.touch(300, 350, 'DOWN_AND_UP')
    MonkeyRunner.sleep(0.5)
    device.touch(500, 920, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    device.touch(220, 120, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    if checkpic.keyCheck(device, caseName, 1, 2, 'menu') == 0:
        return 0
    device.touch(300, 400, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    if checkpic.keyCheck(device, caseName, 1, 3, 'Pinfo') == 0:
        return 0
    device.touch(430, 630, 'DOWN_AND_UP')
    MonkeyRunner.sleep(3)
    device.touch(430, 630, 'DOWN_AND_UP')
    MonkeyRunner.sleep(3)
    device.touch(430, 630, 'DOWN_AND_UP')
    MonkeyRunner.sleep(3)
    device.touch(430, 630, 'DOWN_AND_UP')
    MonkeyRunner.sleep(3)
    device.touch(430, 630, 'DOWN_AND_UP')
    MonkeyRunner.sleep(5)
    if checkpic.keyCheck(device, caseName, 1, 4, 'Pinfo') == 0:
        return 0
    device.touch(550, 80, 'DOWN_AND_UP')
    de.touch(260, 840, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    de.touch(180, 80, 'DOWN_AND_UP')
    device.touch(40, 40, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    de.touch(130, 280, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    de.touch(360, 570, 'DOWN_AND_UP')
    MonkeyRunner.sleep(3)
    de.touch(360, 570, 'DOWN_AND_UP')
    MonkeyRunner.sleep(3)
    de.touch(360, 570, 'DOWN_AND_UP')
    MonkeyRunner.sleep(3)
    de.touch(360, 570, 'DOWN_AND_UP')
    MonkeyRunner.sleep(3)
    de.touch(360, 570, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    de.touch(440, 70, 'DOWN_AND_UP')
    MonkeyRunner.sleep(1)
    de.touch(30, 30, 'DOWN_AND_UP')
    device.touch(350, 920, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    device.touch(220, 120, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    device.touch(300, 400, 'DOWN_AND_UP')
    MonkeyRunner.sleep(5)
    if checkpic.keyCheck(device, caseName, 1, 5, 'Pinfo') == 0:
        return 0
    device.touch(420, 760, 'DOWN_AND_UP')
    MonkeyRunner.sleep(5)
    if checkpic.keyCheck(device, caseName, 1, 6, 'menu') == 0:
        return 0
    device.touch(90, 120, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    device.touch(460, 920, 'DOWN_AND_UP')
    MonkeyRunner.sleep(1.5)
    device.touch(170, 680, 'DOWN_AND_UP')
    MonkeyRunner.sleep(5)
    if checkpic.picCompare(device, caseName, 0.9, 7) == 0:
        return 0
    device.touch(350, 920, 'DOWN_AND_UP')
    MonkeyRunner.sleep(3)
    #if checkpic.keyCheck(device,caseName,1,8,'menu')==0:
    #return 0
    device.touch(300, 380, 'DOWN_AND_UP')
    MonkeyRunner.sleep(4)
    device.touch(170, 210, 'DOWN_AND_UP')
    MonkeyRunner.sleep(2)
    device.type('joe')
    MonkeyRunner.sleep(0.5)
    device.touch(570, 830, 'DOWN_AND_UP')
    MonkeyRunner.sleep(0.5)
    device.touch(570, 830, 'DOWN_AND_UP')
    MonkeyRunner.sleep(1)
    device.touch(490, 210, 'DOWN_AND_UP')
    MonkeyRunner.sleep(3)
    if checkpic.keyCheck(device, caseName, 0.99, 8, 'menu') == 0:
        return 0
    device.touch(40, 40, 'DOWN_AND_UP')