Esempio n. 1
0
    def test_report_all(self, data, run_app):
        # 执行登录
        # LoginPage(run_app).login_action(data["login_phone"], data["login_pwd"])

        # 执行查看订单
        ReportPage(run_app).select_all_report(week=data["week"])

        uninstall_appium_settings()
        uninstall_uiautomator2()
Esempio n. 2
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()
Esempio 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()
    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()
Esempio n. 5
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()
Esempio n. 6
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()
Esempio n. 7
0
    def test_wechat_login_0_success(self, data, run_app):

        # 安卓端还缺少服务协议

        # 绑定微信登录,并登录
        WechatLoginPage(run_app).binding_wechat_login(phone=data["phone"])

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

        # 点击我的 跳转到我也页
        IndexPage(run_app).click_my_button()

        # 获取绑定状态并断言
        assert WechatLoginPage(run_app).get_wecaht_login_status() == "已绑定"

        # 防止短信还未消失 干扰点击设置按钮
        time.sleep(3)

        # 退出登录
        LogoutPage(run_app).logout_action()

        # 执行微信登录
        WechatLoginPage(run_app).wechat_login()

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

        # 点击我的 跳转到我也页
        IndexPage(run_app).click_my_button()

        # 获取绑定状态并断言
        assert WechatLoginPage(run_app).get_wecaht_login_status() == "已绑定"

        # 解绑
        WechatLoginPage(run_app).untying_wecaht_login()

        # 获取绑定状态并断言
        assert WechatLoginPage(run_app).get_wecaht_login_status() == "未绑定"

        # 登出
        LogoutPage(run_app).logout_action()

        # 解绑后的确认并断言 再次打开APP的状态显示
        assert WechatLoginPage(run_app).after_untying_wecaht_login() == "账号绑定"

        uninstall_uiautomator2()
        uninstall_appium_settings()
    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()
Esempio n. 10
0
# WebDriverWait(driver, 20).until(ec.visibility_of_element_located(loc))
# driver.find_element(*loc).click()
#
# # 点击 设置 按钮
# loc = MobileBy.ANDROID_UIAUTOMATOR, 'new UiSelector().resourceId("android:id/title").text("设置")'
# WebDriverWait(driver, 20).until(ec.visibility_of_element_located(loc))
# driver.find_element(*loc).click()
#
# # 退出按钮
# loc = MobileBy.ANDROID_UIAUTOMATOR, 'new UiSelector().resourceId("com.tencent.mm:id/d8").text("退出")'
# WebDriverWait(driver, 20).until(ec.visibility_of_element_located(loc))
# driver.find_element(*loc).click()
#
# # 退出登录
# loc = MobileBy.ANDROID_UIAUTOMATOR, 'new UiSelector().resourceId("com.tencent.mm:id/dc").text("退出登录")'
# WebDriverWait(driver, 20).until(ec.visibility_of_element_located(loc))
# driver.find_element(*loc).click()
#
# # 确认退出按钮
# loc = MobileBy.ID, "com.tencent.mm:id/b47"
# WebDriverWait(driver, 20).until(ec.visibility_of_element_located(loc))
# driver.find_element(*loc).click()
#
# time.sleep(8)

driver.quit()

# 卸载配置应用
uninstall_uiautomator2()
uninstall_appium_settings()