Beispiel #1
0
def run(device):
    d = Driver.init_dirver(device)
    device_path = d.device_info['model'].replace(" ", "_")
    if not os.path.exists(device_path):os.mkdir(device_path)
    os.chdir(device_path)
    print('-'*10,'\n',d,'-'*10,'\n')

    ###############资金代码#########
    # el = d(resourceId="com.nonoapp:id/iv_close")
    # eb = d(resourceId="com.nonoapp:id/ib_close")
    # watcher(el)
    # watcher(eb)

    with open('testreport.html', 'wb') as file:
        runner = HTMLTestRunner(stream=file, title=d.device_info['model'] + '自动化测试报告', description='用例执行情况:')
        runner.run(DEFAULT_TEST_SUITE)
Beispiel #2
0
        assert records in text
        print('提现记录:{}'.format(text))
        assert Driver.d(resourceId="com.nonoapp:id/tv_wallet_record_status").get_text() == "提现成功"

    @testcase(reruns=2)
    def test_09_transaction_records_withdraw(self):
        """交易记录--提现"""
        HomePage().click_mine_view()
        SitTester().click("交易记录").click("提现").sleep(2)
        text = Driver.d(resourceId="com.nonoapp:id/tv_finance_actual_amount").get_text()
        records = str(withdraw_amount - 2 if withdraw_amount < 20000 else withdraw_amount - 3)
        assert records in text
        print('提现记录:{}'.format(text))
        assert Driver.d(resourceId="com.nonoapp:id/tv_finance_desc").get_text() == "提现"
        Driver.d(resourceId="com.nonoapp:id/tv_finance_desc").click()
        time.sleep(3)
        Driver.screenshot()


if __name__ == "__main__":
    d = Driver.init_dirver('192.168.37.24')
    from utils.utils import watcher
    el = d(resourceId="com.nonoapp:id/iv_close")
    watcher(el)
    # debug_case(7, 8, 9)
    debug_case(1)




Beispiel #3
0
# -*- coding: utf-8 -*-
from common.utils.Driver import Driver

class SafeKeyboard:
    def click_confirm_button(self):
        if Driver.d.device_info['serial'] == "APU7N16908000390":
            Driver.d.click(0.881, 0.823)
            return
        Driver.d(text='确定').click()


if __name__ == "__main__":
    d = Driver.init_dirver('192.168.33.5')
    d(text='确定').click()
Beispiel #4
0
    with open('testreport.html', 'wb') as file:
        runner = HTMLTestRunner(stream=file, title=d.device_info['model'] + '自动化测试报告', description='用例执行情况:')
        runner.run(DEFAULT_TEST_SUITE)

if __name__ == "__main__":
    argparse = argparse.ArgumentParser()
    argparse.add_argument("-d", "--device", help="device ip for connect")
    argparse.add_argument("-a", "--app", help="app path or url")
    args = argparse.parse_args()
    devices = [device for device in args.device.split('/') if device]
    app = args.app
    success = []
    for device in devices:
        try:
            d = Driver.init_dirver(device)
            if app:
                app_path = os.path.abspath(app)
                install_app(d,app)
            success.append(device)
        except Exception as e:
            print("失败设备{},\n{}\n".format(device,e))
    if not success:
        print('没有成功安装App的设备')
        sys.exit(-1)
    if not os.path.exists(test_report_dirname):
        os.mkdir(test_report_dirname)
    os.chdir(test_report_dirname)
    pool = Pool(len(success))
    print(success)
    #todo: 单个进程抛错无法被捕获
Beispiel #5
0
        print(response.output)
    else:
        raise Exception("install_app arg should be a url or a file path")


def xml2json():
    pass


def get_phone_ip(serial=None):
    cmd = 'adb'
    if serial is not None:
        cmd = cmd + ' -s ' + serial
    cmd = cmd + ' shell ifconfig wlan0'
    wlan0 = subprocess.Popen(cmd.split(),
                             stdout=subprocess.PIPE,
                             stderr=subprocess.PIPE).communicate()[0]
    wlan0 = bytes.decode(wlan0)
    for item in wlan0.split():
        if 'addr:1' in item:
            addr = item.split(':')[1]
    return addr


# todo: watcher 1.弹窗,2.程序异常退出tosat
if __name__ == '__main__':
    # todo: 异常捕获,防御代码的编写思路
    d = Driver.init_dirver('192.168.37.40')

    ocr(text="查看更多").click()