Ejemplo n.º 1
0
def runtest(serialno, loop):
    print "liu: in runtest"
    if serialno:
        print "liu: in serialno"
        from uiautomator import Device
        d = Device(serialno)
    else:
        print "liu: in else"
        from uiautomator import device as d

    print "总共 %d 次循环" %loop
    d.watcher("Vellamo out of memory").when(text="Vellamo Out of Memory").click(text="ok")
    for i in range(1, loop+1):
        print "第 %d 次循环" %i
        d.screen.on()
        d.press.home()
        removeRecentList(d, "Benchmarking Application")
        d(description="Apps").click()
        d(text="Vellamo").click()
        time.sleep(2)

        if d(text="Accept").exists:
            d(text="Accept").click()
        if d(text="Welcome").exists:
            d.swipe(500,240,100,240)
            d.swipe(500,240,100,240)
            d.swipe(500,240,100,240)
        d(className="android.support.v4.view.ViewPager", \
            resourceId="com.quicinc.vellamo:id/act_main_pager_portrait")\
            .child(className="android.view.View")[0].click()

        #d(className="android.view.View")[2].click()
        if d(text="Yes").exists:
            d(text="Yes").click()
        while not d(text="Your device's score!").exists:
            time.sleep(2)
        else:
            d.screenshot("%s/screenshot/%d_vellamo_%s.png"\
                    %(sys.path[0], i, now.strftime(ISOFORMAT)))

        d.press.home()
        i += 1

    print "***** test end ********"
Ejemplo n.º 2
0
def reset_gallery_watchers(device):
    device.watcher("Allow Gallery to Access photos").when(text="Allow").click(
        text="Allow")
    device.watcher("Allow Gallery to Access location").when(
        text="Allow").click(text="Allow")
Ejemplo n.º 3
0
__author__ = 'Lambert Liu'

import unittest
import time
from uiautomator import device as d


d.watcher("AUTO_FC_WHEN_ANR").when(text="ANR").when(text="Wait").click(text="Close")
d.watcher("AUTO_FC_WHEN_ANR").triggered
d.watcher("APP_CRASH").when(text="Unfortunately, Settings has stopped.").when(text="Wait").click(text="OK")
d.watcher("APP_CRASH").triggered

class IdleScreenTestCase(unittest.TestCase):


    def setUp(self):
        self.seq = range(10)
    print("Test idle screen")
    d.press.back()
    time.sleep(2)
    d.press.home()
    time.sleep(2)
    # def test_Power_off_on(self):
    #     if d.screen.off():
    #         time.sleep(1)
    #         d.wakeup()
    #         time.sleep(4)
    #     d.long_press.power()
    #     time.sleep(4)
    #     d(text="Reboot",className="android.widget.TextView").click()
    #     time.sleep(40)
Ejemplo n.º 4
0
def reset_watcher():
	d.watcher("AUTO_OK_WHEN_USIM").when(text="USIM卡应用").click(resourceId="com.android.stk:id/button_ok")
Ejemplo n.º 5
0
# In[84]:

d.dump("hierarchy.xml", compressed=False)

# In[104]:

d(scrollable='true').info

# In[82]:

d.dump("hierarchy.xml")

# In[40]:

d.watcher("AUTO_FC_WHEN_ANR").when(clickable="true").click(text="")

# In[23]:

d(scrollable=True).fling.vert.backward()

# In[21]:

d(clickable=True, instance=3).click()

# In[29]:

import xml.sax
import os
from uiautomator import device as d
import re
#coding:utf-8
from uiautomator import device as d
import time
#d.dump("d:/layout.xml")
#d.press.home()
#d(text="Call").click.wait()
i=1
a="Turn off Airplane mode or connect to a wireless network to make a call."
b="Emergency calls restricted by access control."
#watch怎么触发呢?
d.watcher("aaa").when(text=a).when(resourceId="android:id/message").press.home()
while i<101:
	d(resourceId="com.android.dialer:id/floating_action_button").click.wait()
	d(resourceId="com.android.dialer:id/digits").set_text("10010")
	d(resourceId="com.android.dialer:id/dialpad_floating_action_button_voice").click.wait()
	time.sleep(15)
	d(resourceId="com.android.dialer:id/floating_end_call_action_button").click.wait()
	print("第"+str(i)+"次")
	i=i+1
#coding:utf-8
from uiautomator import device as d
import time
#d.dump("d:/layout.xml")
#d.press.home()
#d(text="Call").click.wait()
i = 1
a = "Turn off Airplane mode or connect to a wireless network to make a call."
b = "Emergency calls restricted by access control."
#watch怎么触发呢?
d.watcher("aaa").when(text=a).when(
    resourceId="android:id/message").press.home()
while i < 101:
    d(resourceId="com.android.dialer:id/floating_action_button").click.wait()
    d(resourceId="com.android.dialer:id/digits").set_text("10010")
    d(resourceId="com.android.dialer:id/dialpad_floating_action_button_voice"
      ).click.wait()
    time.sleep(15)
    d(resourceId="com.android.dialer:id/floating_end_call_action_button"
      ).click.wait()
    print("第" + str(i) + "次")
    i = i + 1
Ejemplo n.º 8
0
__author__ = 'Lambert Liu'

import unittest
import time
from uiautomator import device as d

d.watcher("AUTO_FC_WHEN_ANR").when(text="ANR").when(text="Wait").click(
    text="Close")
d.watcher("AUTO_FC_WHEN_ANR").triggered
d.watcher("APP_CRASH").when(text="Unfortunately, Settings has stopped.").when(
    text="Wait").click(text="OK")
d.watcher("APP_CRASH").triggered


class IdleScreenTestCase(unittest.TestCase):
    def setUp(self):
        self.seq = range(10)

    print("Test idle screen")
    d.press.back()
    time.sleep(2)
    d.press.home()
    time.sleep(2)

    # def test_Power_off_on(self):
    #     if d.screen.off():
    #         time.sleep(1)
    #         d.wakeup()
    #         time.sleep(4)
    #     d.long_press.power()
    #     time.sleep(4)
Ejemplo n.º 9
0
from uiautomator import device as d
from uiautomator import Device
import time

d = Device('A1CEBNA227ZK')


def screnn_on(d):
    if d.screen == "on":
        pass
    else:
        d.screen.on()


if __name__ == '__main__':
    # screnn_on(d)
    # d.click(943, 1798)
    # d.long_click(48, 1262)
    # for i in range(3):
    #     timepp=time.strftime("%Y-%m-%d-%H-%M-%S", time.localtime())
    #     print(timepp)
    #     d.drag(100 ,1000, 100, 10,steps=100)
    #     d.screenshot("%s.png"%timepp)
    # d.open.notification()
    # d.open.quick_settings()
    d.watcher("²Ëµ¥").when(text="²Ëµ¥").click(text="²Ëµ¥")
    d.press("back")
    # d.watchers.run()
    if d(text='Force Close').exists:
        d(text='Force Close').click()
    # or get the dumped content(unicode) from return.
Ejemplo n.º 10
0
def reset_watcher():
    d.watcher("AUTO_OK_WHEN_USIM").when(text="USIM卡应用").click(
        resourceId="com.android.stk:id/button_ok")
Ejemplo n.º 11
0
 def setUp(self):
     super(IreaderTest, self).setUp()
     d.wakeup()
     d.watcher("AUTO_FC_WHEN_ANR").when(text="ANR").when(text="Wait") \
                          .press.back.home()
     d.press('home')
Ejemplo n.º 12
0
 def tearDown(self):
     super(IreaderTest, self).tearDown()
     d.watcher("AUTO_FC_WHEN_ANR").when(text="ANR").when(text="Wait") \
                          .press.back.home()
     d.press('back')
     d.press('home')