Exemplo n.º 1
0
class TestExtReport(unittest.TestCase):
    def setUp(self):
        self.d = atx.connect(platform='dummy')
        self.rp = Report(self.d, save_dir='tmp_report')

    def tearDown(self):
        self.rp.close()
        shutil.rmtree('tmp_report')

    def test_screenshot(self):
        assert self.rp.last_screenshot is None
        self.d.screenshot()
        assert isinstance(self.rp.last_screenshot, Image.Image)
Exemplo n.º 2
0
class TestExtReport(unittest.TestCase):
    def setUp(self):
        self.d = atx.connect(platform='dummy')
        self.rp = Report(self.d, save_dir='tmp_report')

    def tearDown(self):
        self.rp.close()
        shutil.rmtree('tmp_report')

    def test_screenshot(self):
        assert self.rp.last_screenshot is None
        self.d.screenshot()
        assert isinstance(self.rp.last_screenshot, Image.Image)
Exemplo n.º 3
0
def report():
    d = atx.connect()
    rp = Report(d, save_dir='tasks/out/local.test')
    try:
        d.press_home()
        d.click(704, 1296)
        try:
            d.click_image(r"../../../Desktop/setting.1920x1080.png")
        except Exception as error:
            print error
        try:
            d.wait(r"../../../Desktop/timeline.1920x1080.png")
        except Exception as error:
            print error
        d.click_image(r"../../../Desktop/timeline.1920x1080.png")
        rp.info("timeline", screenshot=d.screenshot())
        rp.assert_image_exists(r"../../../Desktop/show_chart.1920x1080.png",
                               scanner=d.screen_image())
        d.press_back()
        d.press_back()
    except Exception as error1:
        print error1
    finally:
        rp.close()
Exemplo n.º 4
0
# -*- coding:utf-8 -*-
import atx
import sys
import wda
import time
from atx.ext.report import Report  # report lib
reload(sys)
sys.setdefaultencoding('utf8')
d = atx.connect('http://192.168.228.50:8100', platform='ios')
print d.status()
d.start_app('com.gao7.wallpaper.pid37ch03')
rp = Report(d, save_dir='report')

rp.patch_uiautomator()  # for android UI test record (optional)
#rp.info("Test started") # or rp.info("Test started", screenshot=d.screenshot())
#rp.error("Oh no.", screenshot=d.screenshot())
dis = d.display
m = dis.width * 0.5
n1 = dis.height * 0.75
n2 = dis.height * 0.25


#获得机器屏幕大小x,y
def getSize():
    x = dis.width
    y = dis.height
    return (x, y)


#屏幕向上滑动
def swipeUp(t):
Exemplo n.º 5
0
        driver(text=u'music_menu_addplaylist').click()
        driver(text=u'Collect').click()
        time.sleep(2)
        driver(text=u'back').click()
        driver(text=u'back').click()
    except Exception, e:
        print("\033[5;35m 错误信息:%s \033[0m" % str(e))


bundleid = sys.argv[1]
gesture_num = sys.argv[2]
#与手机进行连接
driver = atx.connect('http://localhost:8100')
#获取屏幕大小
dis = driver.display
print('宽是:%s 高是:%s' % (dis.width, dis.height))
#打印设备信息
print(driver.status())

# 启动应用
launcher = driver.start_app(bundleid)
print("launcher ok!")
time.sleep(10)
monkey_atx()
print('关闭app...')
driver.stop_app()
#生成测试报告
print('正在生成测试报告...')
rp = Report(driver)
rp.patch_wda()
Exemplo n.º 6
0
 def setUp(self):
     self.d = atx.connect(platform='dummy')
     self.rp = Report(self.d, save_dir='tmp_report')
Exemplo n.º 7
0
# -*- coding:utf-8 -*-
import atx
import sys
import wda
import time
from atx.ext.report import Report  # report lib
from subprocess import call
reload(sys)
sys.setdefaultencoding('utf8')
d = atx.connect('http://192.168.228.207:8100', platform='ios')
print d.status()
d.start_app('com.gao7.wallpaper.pid37ch03')
#rp = Report(d, save_dir='report')
rp = Report(d)
rp.patch_wda()
#rp.patch_uiautomator() # for android UI test record (optional)
#rp.info("Test started") # or rp.info("Test started", screenshot=d.screenshot())
#rp.error("Oh no.", screenshot=d.screenshot())
dis = d.display
m = dis.width * 0.5
n1 = dis.height * 0.75
n2 = dis.height * 0.25


#获得机器屏幕大小x,y
def getSize():
    x = dis.width
    y = dis.height
    return (x, y)

Exemplo n.º 8
0
    def PicCom(self):
        os.system('adb shell pm clear com.wuba')
        d = atx.connect()
        d.start_app('com.wuba', 'com.wuba.activity.launch.LaunchActivity')
        time.sleep(1)
        # 三次都点击弹框中的允许
        for i in range(3):
            if d.uiautomator(text=u'允许'):
                d.uiautomator(text=u'允许').click()

        rp = Report(d, save_dir=u'report')
        rp.patch_uiautomator()
        rp.info("Test started", screenshot=d.screenshot())

        #对比城市列表页面
        d.wait(self.pic_aim("*****@*****.**"))
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.adb.get_screenshot(self.pic_save)
        #对比乡镇列表页面
        d.uiautomator(text=u'乡镇').click()
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.adb.get_screenshot(self.pic_save)
        #对比海外列表页面
        d.uiautomator(text=u'海外').click()
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.adb.get_screenshot(self.pic_save)
        self.adb.press_back()
        try:
            d.uiautomator(text=u'取消').click()
        except:
            pass
        # 对比首页大类
        d.wait(self.pic_aim("*****@*****.**"))
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        #对比到家服务
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.adb.get_screenshot(self.pic_save)
        d.swipe(1208, 1356, 317, 1356) #到家服务右滑
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        d.swipe(651, 493, 651, 2066) #首页下滑
        time.sleep(2)
        self.adb.get_screenshot(self.pic_save)

        #兼职页面对比
        d.uiautomator(text=u'兼职').click()
        d.wait(self.pic_aim("*****@*****.**"))
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.adb.get_screenshot(self.pic_save)
        self.adb.press_back()

        #发现页面对比
        # d.uiautomator(text=u'发现').click()
        # self.pic_exist(d, "*****@*****.**")
        # self.pic_exist(d, "*****@*****.**")
        # self.adb.get_screenshot(self.pic_save)

        #发布页面对比
        d.uiautomator(text=u'发布').click()
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        # self.pic_exist(d, "*****@*****.**")   #8.9.0版本去掉
        # self.pic_exist(d, "*****@*****.**")   #8.9.0版本去掉
        # self.pic_exist(d, "*****@*****.**")  #8.9.0版本去掉
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.adb.get_screenshot(self.pic_save)

        #对比消息页面
        d.uiautomator(text=u'消息').click()
        d.wait(self.pic_aim("*****@*****.**"))
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.adb.get_screenshot(self.pic_save)

        # 对比个人中心页面
        d.uiautomator(text=u'个人中心').click()
        d.wait(self.pic_aim("*****@*****.**"))
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        #self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.pic_exist(d, "*****@*****.**")
        self.adb.get_screenshot(self.pic_save)
    # d.click_image(self.pic_aim("*****@*****.**"))
    #     self.adb.press_back()
        rp.close()
Exemplo n.º 9
0
 def setUp(self):
     self.d = atx.connect(platform='dummy')
     self.rp = Report(self.d, save_dir='tmp_report')
Exemplo n.º 10
0
# -*- coding:utf-8 -*-
import atx
import sys
import wda
import time
from atx.ext.report import Report  # report lib
from subprocess import call
reload(sys)
sys.setdefaultencoding('utf8')
d = atx.connect('http://192.168.228.125:8100', platform='ios')
print d.status()
#d.start_app('com.gao7.wallpaper.pid37ch03')
#rp = Report(d, save_dir='report')
rp = Report(d)
rp.patch_wda()
#rp.patch_uiautomator() # for android UI test record (optional)
#rp.info("Test started") # or rp.info("Test started", screenshot=d.screenshot())
#rp.error("Oh no.", screenshot=d.screenshot())
dis = d.display
m = dis.width * 0.5
n1 = dis.height * 0.75
n2 = dis.height * 0.25


#获得机器屏幕大小x,y
def getSize():
    x = dis.width
    y = dis.height
    return (x, y)