Exemplo n.º 1
0
    def test_login_0_success(self, data, run_app):
        # 执行登录
        LoginPage(run_app).login_action(data["user"], data["pwd"])

        # 获取登录状态
        assert IndexPage(run_app).get_login_status() is True

        # 执行登出
        LogoutPage(run_app).logout_action()

        uninstall_uiautomator2()
        uninstall_appium_settings()
Exemplo n.º 2
0
    def test_refund(self, data, run_app):
        # 执行登录
        # LoginPage(run_app).login_action("18971335925", "335925")
        LoginPage(run_app).login_action(data["login_phone"], data["login_pwd"])

        # 执行退款,退款金额amount,支付密码pwd,退款次数num,可不输,默认{全额退款,支付密码123456,退款次数1}
        OrderBookPage(run_app).refund(num=3)

        LogoutPage(run_app).logout_action()

        uninstall_appium_settings()
        uninstall_uiautomator2()
Exemplo n.º 3
0
    def test_edit_child_shop_pwd(self, data, run_app):
        # 执行登录
        LoginPage(run_app).login_action(data["login_phone"], data["login_pwd"])

        # 执行添加子门店
        ChildShopPage(run_app).edit_child_shop_login_pwd(
                                        shop_num=data["shop_num"],
                                        pwd=data["new_pwd"]
                                    )

        uninstall_appium_settings()
        uninstall_uiautomator2()
Exemplo n.º 4
0
    def test_scan_0_success(self, data, run_app):
        # 执行登录
        LoginPage(run_app).login_action(data["user"], data["pwd"])

        # 扫一扫付款
        IndexPage(run_app).scan_pay(amount="0.01")

        # 执行登出
        # LogoutPage(run_app).logout_action()

        uninstall_uiautomator2()
        uninstall_appium_settings()
Exemplo n.º 5
0
    def test_add_child_shop(self, data, run_app):
        # 执行登录
        LoginPage(run_app).login_action(data["login_phone"], data["login_pwd"])

        # 执行添加子门店
        ChildShopPage(run_app).add_shop_action(
            shop_name=data["shop_name"],
            shop_address=data["shop_address"],
            people_name=data["people_name"],
            phone_num=data["phone_num"],
            pwd=data["pwd"])

        uninstall_appium_settings()
        uninstall_uiautomator2()
Exemplo n.º 6
0
    def test_screen_order(self, data, run_app):
        # 执行登录
        LoginPage(run_app).login_action(data["login_phone"], data["login_pwd"])

        screen_result = OrderBookPage(run_app).screen_order(
            login_phone=data["login_phone"],
            login_pwd=data["login_pwd"],
            main_store_name=data["main_store_name"],
            store_name=data["store_name"],
            store_id=data["store_id"],
            time_desc=data["time_desc"],
            time_start=data["time_start"],
            time_end=data["time_end"],
            terminal_type=data["terminal_type"],
            terminal_name=data["terminal_name"],
            terminal_id=data["terminal_id"],
            type_source=data["type_source"],
            status=data["status"])

        # 调接口会将APP挤下线 所以在调接口前APP退出登录
        LogoutPage(run_app).logout_action()

        api_res = api_my_order_book(
            login_phone=data["login_phone"],
            login_pwd=data["login_pwd"],
            page="1",
            time_start=screen_result["api_time_start"],
            time_end=screen_result["api_time_end"],
            store_name=screen_result["api_store_name"],
            store_id=screen_result["api_store_id"],
            order_status=screen_result["api_status"],
            terminal_name=screen_result["api_terminal_name"],
            terminal_id=screen_result["api_terminal_id"],
            type_source=screen_result["api_type_source"])

        # 调接口获取付款笔数、付款金额、退款笔数、退款金额 与 筛选后的页面数据进行对比 页面滑动汇总数据存在不稳定性
        assert screen_result["screen_result_success_num"] == str(
            api_res["success_count"])

        assert screen_result["screen_result_success_amount"] == api_res[
            "success_amount"]

        assert screen_result["screen_result_refund_num"] == str(
            api_res["refund_count"])

        assert screen_result["screen_result_refund_amount"] == api_res[
            "refund_amount"]
Exemplo n.º 7
0
    def test_select_order_book(self, data, run_app):
        # 执行登录
        LoginPage(run_app).login_action(data["login_phone"], data["login_pwd"])

        # 执行查看订单并添加备注
        OrderBookPage(run_app).select_pay_success_order(
            note=data["note_pay_success"])

        OrderBookPage(run_app).select_refund_all_order(
            note=data["note_refund_all"])

        OrderBookPage(run_app).select_refund_part_order(
            note=data["note_refund_part"])

        OrderBookPage(run_app).select_first_five_order(data=data, number=5)

        uninstall_appium_settings()
        uninstall_uiautomator2()
    def test_twenty_four_hours(self, data, run_app):

        mail_title = "24小时登录登出监测异常邮件"
        mail_message = "详情情查看附件日志,请实际使用手机测试登录!"

        file_path = LOGS_DIR + log_name

        # 执行登录
        LoginPage(run_app).login_action(data["user"], data["pwd"])

        time.sleep(10)

        # 获取登录状态
        assert IndexPage(run_app).get_login_status() is True

        # 执行登出
        LogoutPage(run_app).logout_action()

        time.sleep(10)

        count_file = os.path.join(TEST_DATA_DIR, "count.txt")

        with open(count_file, "r+") as f:
            count = f.read()
            count = int(count) + 1

            f.seek(0)
            f.truncate()

            f.write(str(count))
            f.close()

        logging.info("已完成 {} 次 自动登录登出测试".format(count))

        uninstall_uiautomator2()
        uninstall_appium_settings()