def setUp(self): """ called before each test method start. """ #if UI object not found. the watcher method will be invoked d.watcher('AUTO_FC_WHEN_ANR').when(text='ANR').when(text='强行关闭') .press('enter') d.wakeup() #wakeup device
def checkSystemWatchers(): if d.watcher("IGNORE_ANR").triggered: raise Exception('AUTO_FC_WHEN_ANR') if d.watcher("IGNORE_CRASH").triggered: raise Exception('IGNORE_CRASH') d.watchers.reset() d.watchers.remove()
def setUp(self): """ called before each test method start. """ #if UI object not found. the watcher method will be invoked d.watcher('AUTO_FC_WHEN_ANR').when(text='ANR').when( text='强行关闭').press('enter') d.wakeup() #wakeup device
def tearDown(self): """ called after each test method end or exception occur. """ #super(VideoPlay, self).tearDown() #d.watcher("AUTO_FC_WHEN_ANR").when(text="ANR").when(text="Wait") .press.back.home() d.watcher("AUTO_FC_WHEN_ANR").when(text="ANR").when(text="Wait") .click(text="确定") for i in xrange(8): d.press('back') d.press('home')# 'home, back,menu'd.press.home() d.press('home')
def setUp(self): """ called before each test method start. """ #a watcher to aviod dialog block test d.watcher("AUTO_FC_WHEN_ANR").when(text="稍后升级").click(text="稍后升级") d.wakeup() for i in xrange(3): d.press('back') d.press('home') d.press('home') for i in xrange(8): d.press('left')
def tearDown(self): """ called after each test method end or exception occur. """ #super(VideoPlay, self).tearDown() #d.watcher("AUTO_FC_WHEN_ANR").when(text="ANR").when(text="Wait") .press.back.home() d.watcher("AUTO_FC_WHEN_ANR").when(text="ANR").when(text="Wait").click( text="确定") for i in xrange(8): d.press('back') d.press('home') # 'home, back,menu'd.press.home() d.press('home')
def setUp(self): """ called before each test method start. """ #super(VideoPlay, self).setUp() #d.watcher("AUTO_FC_WHEN_ANR").when(text="ANR").when(text="Wait") .press.back.home() d.watcher("AUTO_FC_WHEN_ANR").when(text="ANR").when(text="强行关闭") .click(text="确定") d.wakeup() d.press('home') d.press('home') for i in xrange(8): d.press('left')
def setUp(self): """ called before each test method start. """ #super(VideoPlay, self).setUp() #d.watcher("AUTO_FC_WHEN_ANR").when(text="ANR").when(text="Wait") .press.back.home() d.watcher("AUTO_FC_WHEN_ANR").when(text="ANR").when(text="强行关闭").click( text="确定") d.wakeup() d.press('home') d.press('home') for i in xrange(8): d.press('left')
#!/usr/bin/env python from uiautomatorplug.android import device as d from uiautomator import device as dd import unittest import time import sys import commands import string import random import math import os d.watcher("FC_WC").when(textContains = 'Unfortunately')\ .click(text = 'OK') PACKAGE_NAME = 'com.intel.android.gallery3d' ACTIVITY_NAME = PACKAGE_NAME + '/.app.Gallery' PATH = os.getcwd() #Resource-id for gallery main body, it does not change when switch between view GALLEYBODY_RESID = 'com.intel.android.gallery3d:id/cardpop' #Resource-id for action bar of gallery ACTBAR_RESID = 'android:id/action_bar' #Commands for refreshing media REFRESH_MEDIA = 'adb shell am broadcast -a android.intent.action.MEDIA_MOUNTED -d file:///sdcard' #All view could be entry ViewModeList = ['albumview', 'gridview', 'fullview']
def setUp(self): d.watcher("IGNORE_ANR").when(textContains='停止运行').click(text='确定') u.setUp()
def registerSysWatchers(): d.watchers.reset() d.watchers.remove() d.watcher("IGNORE_ANR").when(textContains='无响应').click(text='确定') d.watcher("IGNORE_CRASH").when(textContains='停止运行').click(text='确定') d.watcher("IGNORE_POPWINDOW_WEIBO").when(textContains = '给我们评分').click(text = '不了,谢谢') d.watcher("IGNORE_DRAFT").when(textContains='是否保存草稿').click(text='不保存草稿') d.watcher("IGNORE_LOCATION").when(textContains = '位置信息').click(text = '拒绝') d.watcher("IGNORE_WLAN").when(textContains = 'WLAN').click(text = '确定') d.watcher("IGNORE_NAVIGATION").when(textContains = '离线地图').click(text = '暂不需要')
def checkSystemWatchers(self): self.assertFalse(d.watcher("fc").triggered, "APP force close")
def regesiterWatcher(self): d.watchers.reset() d.watchers.remove() d.watcher(u"fc").when(textContains=u"很抱歉").click(text=u"确定")
def registerSysWatchers(): d.watchers.reset() d.watchers.remove() d.watcher("IGNORE_ANR").when(textContains='无响应').click(text='确定') d.watcher("IGNORE_CRASH").when(textContains='停止运行').click(text='确定')
def setUp(self): d.watcher("IGNORE_DRAFT").when(textContains='是否保存草稿').click(text='不保存草稿') u.setUp()