def recharge_wechat_input(self, amount, case_name, second):  #输入金额进行充值
     try:
         time.sleep(second)
         Utils.getElementById(self, MyHelper.driver,
                              MyPage.resid_my_button).click()
         Utils.getElementById(self, MyHelper.driver,
                              MyPage.resid_recharge).click()
         Utils.getElementById(
             self, MyHelper.driver,
             FinancialOperationPage.resid_recharge_money_input).send_keys(
                 amount)
         Utils.getElementById(
             self, MyHelper.driver,
             FinancialOperationPage.resid_recharge_wechatpay).click()
         Utils.getElementById(
             self, MyHelper.driver,
             FinancialOperationPage.resid_recharge_commit).click()
         if amount < 10:
             # 不能低于10元提示,截图
             Utils.getImage(self, MyHelper.driver, case_name, second)
             time.sleep(1)
             pass
         else:
             # 跳转登录微信,手机物理键返回
             MyHelper.driver.keyevent(4)
             pass
         if second > 0:
             Utils.getImage(self, MyHelper.driver, case_name, second)
         else:
             Utils.getImage(self, MyHelper.driver, case_name, 1)
     except Exception as e:
         print("发现异常")
         print(e)
         raise SystemError
 def to_cash_with_drawl(self,case_name):
     try:
         util=Utils()
         util.getElementById(CashWithDrawalHelper.driver,MyPage.resid_my_button).click()
         util.getElementById(CashWithDrawalHelper.driver,MyPage.resid_my_record).click()
         util.take_screenShot(CashWithDrawalHelper.driver, case_name, 2)
         util.getElementById(CashWithDrawalHelper.driver,MyPage.resid_back_button).click()
     except Exception as e:
         print("发现异常")
         print(e)
         raise SystemError
    def exit_room(self):
        try:
            # HotAnchorHelper.to_hot_page()
            # HotAnchorHelper.to_anchor_room()
            self.driver.keyevent(4)  # 方法一 手机物理键

            hot_anchor_page = HotAnchorPage()
            Utils.getElementById().click()  # 方法二 直播间右上方退出按钮,为保万一最好点击两次=。=
            pass
        except Exception as e:
            print("发现异常")
            print(e)
            raise SystemError
 def to_my_page(self, case_name, second):
     try:
         time.sleep(second)
         my_page = MyPage()
         util = Utils()
         util.getElementById(MyHelper.driver,
                             my_page.resid_my_button).click()
         if second > 0:
             util.getImage(MyHelper.driver, case_name, second)
         else:
             util.getImage(MyHelper.driver, case_name, second)
     except Exception as e:
         print("发现异常")
         print(e)
         raise SystemError
 def to_hot_page(self, case_name, second=0):
     try:
         hot_anchor_page = HotAnchorPage()
         util = Utils()
         util.getElementById(HotAnchorHelper.driver,
                             hot_anchor_page.resid_home_button).click()
         if second > 0:
             #util.take_screenShot(LoginHelper.driver, case_name, second)
             util.getImage(HotAnchorHelper.driver, case_name, second)
         else:
             #util.take_screenShot(LoginHelper.driver, case_name, 0)
             util.getImage(HotAnchorHelper.driver, case_name, 0)
         print("本次测试完成")
     except Exception as e:
         print("发现异常")
         print(e)
         raise SystemError
    def to_exhibition_room(self, case_name, second):
        try:
            time.sleep(second)
            my_page = MyPage()
            util = Utils()
            util.getElementById(MyHelper.driver,
                                my_page.resid_exhibitionRoom_button).click()
            print("点击大奖展厅完成")
            if second > 0:
                util.take_screenShot(MyHelper.driver, case_name, second)
            else:
                util.take_screenShot(MyHelper.driver, case_name, 0)

            pass
        except Exception as e:
            print("发现异常")
            print(e)
            raise SystemError
Beispiel #7
0
 def Talk(self, text, case_name, second):
     try:
         # 点击输入框并输入,发送
         Utils.getElementById(HotAnchorPage.resid_edit_mess).send_keys(text)
         Utils.getElementById(HotAnchorPage.resid_send_mess).click()
         if second > 0:
             Utils.take_screenShot(HotAnchorHelper.driver, case_name,
                                   second)
             # Utils.getImage(HotAnchorHelper.driver, case_name, second)
         else:
             Utils.take_screenShot(HotAnchorHelper.driver, case_name,
                                   second)
             # Utils.getImage(HotAnchorHelper.driver, case_name, 0)
         print("本次测试完成")
     except Exception as e:
         print("发现异常")
         print(e)
         raise SystemError
Beispiel #8
0
    def Talkd(self, case_name, second):
        try:
            Utils.getElementById(HotAnchorPage.resid_edit_mess).click()
            # 点击表情,选择一个表情扔出去!,发送
            # 坐标点击表情呀~~~

            Utils.getElementById(HotAnchorPage.resid_send_mess).click()
            if second > 0:
                Utils.take_screenShot(HotAnchorHelper.driver, case_name,
                                      second)
                # Utils.getImage(HotAnchorHelper.driver, case_name, second)
            else:
                Utils.take_screenShot(HotAnchorHelper.driver, case_name,
                                      second)
                # Utils.getImage(HotAnchorHelper.driver, case_name, 0)
            print("本次测试完成")
        except Exception as e:
            print("发现异常")
            print(e)
            raise SystemError
 def clear_cache_cancel(self, case_name, second):  #清理缓存点取消
     try:
         time.sleep(second)
         my_page = MyPage()
         util = Utils()
         util.getElementById(MyHelper.driver, my_page.resid_my_button)
         # 点击清理缓存,会弹出确认框
         util.getElementById(MyHelper.driver,
                             my_page.resid_clear_cache).click()
         # 由于uiauto定位不到确认框元素,此处采用绝对定位
         # 取消  128  680,245-744
         # 确定  449  695,600 746
         # 点击取消
         time.sleep(2)
         util.tap(MyHelper.driver, 128, 680, 245, 744)
         if second > 0:
             util.take_screenShot(MyHelper.driver, case_name, second)
         else:
             util.take_screenShot(MyHelper.driver, case_name, 0)
     except Exception as e:
         print("发现异常")
         print(e)
         Utils.getElementById(self, MyHelper.driver,
                              MyPage.resid_back_button)
         raise SystemError
Beispiel #10
0
 def to_my_info(self, case_name,
                second):  #去我的个人信息页面   param:case_name-用例名称,second-截图等待秒数
     try:
         my_info_page = MyInfoPage()
         util = Utils()
         util.getElementById(MyInfoHelper.driver,
                             my_info_page.resid_my_button).click()
         util.getElementById(MyInfoHelper.driver,
                             my_info_page.resid_myinfo_button).click()
         if (second > 1):
             util.getImage(MyInfoHelper.driver, case_name, second)
         else:
             util.getImage(MyInfoHelper.driver, case_name, 1)
         util.getElementById(MyInfoHelper.driver,
                             my_info_page.resid_back_button).click()
     except Exception as e:
         print("发现异常")
         print(e)
         raise SystemError
Beispiel #11
0
 def edit_nickname_right(
         self,
         nick_name="",
         case_name="",
         second=0):  #修改昵称   param:case_name-用例名称,second-截图等待秒数
     try:
         my_info_page = MyInfoPage()
         util = Utils()
         util.getElementById(MyInfoHelper.driver,
                             my_info_page.resid_my_button).click()
         util.getElementById(MyInfoHelper.driver,
                             my_info_page.resid_myinfo_button).click()
         util.getElementById(MyInfoHelper.driver,
                             my_info_page.resid_myinfo_nickname).click()
         util.getElementById(MyInfoHelper.driver,
                             my_info_page.resid_nickname_input).click()
         util.getElementById(MyInfoHelper.driver,
                             my_info_page.resid_nickname_input).clear()
         util.getElementById(
             MyInfoHelper.driver,
             my_info_page.resid_nickname_input).send_keys(nick_name)
         util.getElementById(MyInfoHelper.driver,
                             my_info_page.resid_savename_button).click()
         if (second > 1):
             util.getImage(MyInfoHelper.driver, case_name, second)
         else:
             util.getImage(MyInfoHelper.driver, case_name, 1)
         util.getElementById(MyInfoHelper.driver,
                             my_info_page.resid_back_button).click()
         time.sleep(1)
     except Exception as e:
         print("发现异常")
         print(e)
         raise SystemError
Beispiel #12
0
    def edit_nickname_error(
            self,
            nick_name="",
            case_name="",
            second=0):  #修改昵称   param:case_name-用例名称,second-截图等待秒数
        try:
            my_info_page = MyInfoPage()
            util = Utils()
            util.getElementById(MyInfoHelper.driver,
                                my_info_page.resid_my_button).click()
            util.getElementById(MyInfoHelper.driver,
                                my_info_page.resid_myinfo_button).click()
            util.getElementById(MyInfoHelper.driver,
                                my_info_page.resid_myinfo_nickname).click()
            util.getElementById(MyInfoHelper.driver,
                                my_info_page.resid_nickname_input).click()
            if (nick_name == ""):
                util.getElementById(
                    MyInfoHelper.driver,
                    my_info_page.resid_savename_button).click()
            else:
                util.getElementById(MyInfoHelper.driver,
                                    my_info_page.resid_nickname_input).clear()
                util.getElementById(
                    MyInfoHelper.driver,
                    my_info_page.resid_nickname_input).send_keys(nick_name)
                util.getElementById(
                    MyInfoHelper.driver,
                    my_info_page.resid_savename_button).click()
                time.sleep(1)
                util.getElementById(MyInfoHelper.driver,
                                    my_info_page.resid_mes_button).click()
                time.sleep(1)
            if (second > 1):
                util.getImage(MyInfoHelper.driver, case_name, second)
            else:
                util.getImage(MyInfoHelper.driver, case_name, 0)

            util.tap(MyInfoHelper.driver, 28, 72, 56,
                     110)  #此处返回使用绝对坐标来点击,使用id会有获取不到元素异常
            time.sleep(1)
            util.tap(MyInfoHelper.driver, 28, 72, 56, 110)
            #util.getElementById(MyInfoHelper.driver,my_info_page.resid_back_button).click()
            #MyInfoHelper.driver.find_element_by_xpath("//*[@resource-id='com.dbljoy.lottery:id/img_goback']").click()
            time.sleep(1)
            #util.getElementById(MyInfoHelper.driver,my_info_page.resid_back_button).click()
            #MyInfoHelper.driver.find_element_by_xpath("//*[@resource-id='com.dbljoy.lottery:id/img_goback']").click()
        except Exception as e:
            print("发现异常")
            print(e)
            raise SystemError
Beispiel #13
0
 def exit(
     self,
     stat=0,
     case_name="",
     second=0
 ):  #退出登录  param:stat-是否确认退出,1是确定0是取消,case_name--用例名称,second-截图等待秒数
     try:
         Utils.getElementById(self, MyInfoHelper.driver,
                              MyInfoPage.resid_my_button).click()
         Utils.getElementById(self, MyInfoHelper.driver,
                              MyInfoPage.resid_myinfo_button).click()
         Utils.getElementById(self, MyInfoHelper.driver,
                              MyInfoPage.resid_myinfo_exit_button).click()
         if (stat > 0):
             Utils.tap(self, MyInfoHelper.driver,
                       MyInfoPage.resposition_confirm_x1,
                       MyInfoPage.resposition_confirm_y1,
                       MyInfoPage.resposition_confirm_x2,
                       MyInfoPage.resposition_confirm_y2)
             time.sleep(1)
             Utils.getImage(self, MyInfoHelper.driver, case_name, 1)
             Utils.getElementById(self, MyInfoHelper.driver,
                                  LoginPage.password).click()
             Utils.getElementById(self, MyInfoHelper.driver,
                                  LoginPage.password).send_keys("111111")
             Utils.getElementById(self, MyInfoHelper.driver,
                                  LoginPage.loginButton).click()
             time.sleep(4)
         else:
             Utils.tap(self, MyInfoHelper.driver,
                       MyInfoPage.resposition_cancel_x1,
                       MyInfoPage.resposition_cancel_y1,
                       MyInfoPage.resposition_cancel_x2,
                       MyInfoPage.resposition_cancel_y2)
             Utils.getImage(self, MyInfoHelper.driver, case_name, 1)
             Utils.tap(self, MyInfoHelper.driver, 28, 72, 56,
                       110)  #此处返回使用绝对坐标来点击,使用id会有获取不到元素异常
     except Exception as e:
         print("发现异常")
         print(e)
         raise SystemError
     time.sleep(1)
Beispiel #14
0
    def identity_relname(
        self,
        relname="",
        relcard="",
        case_name="",
        second=0
    ):  #实名认证   param:relname-真实姓名,relcard-身份证号,case_name-用例名称,second-截图等待秒数
        try:

            my_info_page = MyInfoPage()
            util = Utils()
            util.getElementById(MyInfoHelper.driver,
                                my_info_page.resid_my_button).click()
            util.getElementById(MyInfoHelper.driver,
                                my_info_page.resid_myinfo_button).click()
            util.getElementById(MyInfoHelper.driver,
                                my_info_page.resid_myinfo_identity).click()
            if (relname == "" and relcard == ""):
                pass
            else:
                util.getElementById(
                    MyInfoHelper.driver,
                    my_info_page.resid_identity_relname).click()
                util.getElementById(
                    MyInfoHelper.driver,
                    my_info_page.resid_identity_relname).clear()
                util.getElementById(
                    MyInfoHelper.driver,
                    my_info_page.resid_identity_relname).send_keys(relname)
                if (relcard == ""):
                    pass
                else:
                    util.getElementById(
                        MyInfoHelper.driver,
                        my_info_page.resid_identity_relcard).click()
                    util.getElementById(
                        MyInfoHelper.driver,
                        my_info_page.resid_identity_relcard).clear()
                    util.getElementById(
                        MyInfoHelper.driver,
                        my_info_page.resid_identity_relcard).send_keys(relcard)
            util.getElementById(
                MyInfoHelper.driver,
                my_info_page.resid_identity_commit_button).click()
            if (second > 1):
                util.getImage(MyInfoHelper.driver, case_name, second)
            else:
                util.getImage(MyInfoHelper.driver, case_name, 0)
            util.tap(MyInfoHelper.driver, 28, 72, 56,
                     110)  #此处返回使用绝对坐标来点击,使用id会有获取不到元素异常
            time.sleep(1)
            util.tap(MyInfoHelper.driver, 28, 72, 56, 110)
        except Exception as e:
            print("发现异常")
            print(e)
            raise SystemError
    def login(self, mobile, pwd, case_name, second, driver_stat):
        try:

            if driver_stat == 1:
                print("driver_stat=1,初始化driver")
                LoginHelper.driver = BaseHelper.get_redmi_driver(
                    self)  # 创建driver
            else:

                pass
            loginPage = LoginPage()
            util = Utils()
            if mobile == "":
                util.getElementById(LoginHelper.driver,
                                    loginPage.mobile).click()
                util.getElementById(LoginHelper.driver,
                                    loginPage.mobile).clear()
            else:
                util.getElementById(LoginHelper.driver,
                                    loginPage.mobile).click()
                util.getElementById(LoginHelper.driver,
                                    loginPage.mobile).clear()
                util.getElementById(LoginHelper.driver,
                                    loginPage.mobile).send_keys(mobile)
            if pwd == "":
                util.getElementById(LoginHelper.driver,
                                    loginPage.password).click()
                util.getElementById(LoginHelper.driver,
                                    loginPage.password).clear()
            else:
                util.getElementById(LoginHelper.driver,
                                    loginPage.password).click()
                util.getElementById(LoginHelper.driver,
                                    loginPage.password).clear()
                util.getElementById(LoginHelper.driver,
                                    loginPage.password).send_keys(pwd)
            util.getElementById(LoginHelper.driver, loginPage.seepwd).click()
            # util.clearText(loginPage.password, driver);
            # util.clearText(driver, loginPage.password);
            LoginHelper.driver.hide_keyboard()
            util.getElementById(LoginHelper.driver,
                                loginPage.loginButton).click()
            if second > 0:
                #util.take_screenShot(LoginHelper.driver, case_name, second)
                util.getImage(LoginHelper.driver, case_name, second)
            else:
                #util.take_screenShot(LoginHelper.driver, case_name, 0)
                util.getImage(LoginHelper.driver, case_name, 0)
            print("本次测试完成")

        except Exception as e:
            print("发现异常")
            print(e)
            raise SystemError
    def recharge_wechat_click(self, amount, case_name, second):  # 点击金额进行充值
        try:
            time.sleep(second)
            Utils.getElementById(self, MyHelper.driver,
                                 MyPage.resid_my_button).click()
            Utils.getElementById(self, MyHelper.driver,
                                 MyPage.resid_recharge).click()
            if (amount == 10):
                Utils.getElementById(
                    self, MyHelper.driver,
                    FinancialOperationPage.resid_recharge_ten).click()

            elif (amount == 20):
                Utils.getElementById(
                    self, MyHelper.driver,
                    FinancialOperationPage.resid_recharge_twenty).click()

            elif (amount == 50):
                Utils.getElementById(
                    self, MyHelper.driver,
                    FinancialOperationPage.resid_recharge_fifty).click()
            elif (amount == 100):
                Utils.getElementById(
                    self, MyHelper.driver,
                    FinancialOperationPage.resid_recharge_oneHundred).click()
            elif (amount == 150):
                Utils.getElementById(
                    self, MyHelper.driver, FinancialOperationPage.
                    resid_recharge_oneHundredAndFifty).click()
            elif (amount == 200):
                Utils.getElementById(
                    self, MyHelper.driver,
                    FinancialOperationPage.resid_recharge_twoHundred).click()
            elif (amount == 300):
                Utils.getElementById(
                    self, MyHelper.driver,
                    FinancialOperationPage.resid_recharge_threeHundred).click(
                    )
            elif (amount == 500):
                Utils.getElementById(
                    self, MyHelper.driver,
                    FinancialOperationPage.resid_recharge_fiveHundred).click()
            else:
                print("请输入要点击选择的正确金额")
                raise SystemError
            Utils.getElementById(
                self, MyHelper.driver,
                FinancialOperationPage.resid_recharge_wechatpay).click()
            Utils.getElementById(
                self, MyHelper.driver,
                FinancialOperationPage.resid_recharge_commit).click()
            # 微信验证登录页面,使用adb返回按钮
            if amount < 10:
                # 不能低于10元提示,截图
                Utils.getImage(self, MyHelper.driver, case_name, second)
                time.sleep(1)
                pass
            else:
                # 跳转登录微信,手机物理键返回
                MyHelper.driver.keyevent(4)
                pass

            if second > 0:
                Utils.getImage(self, MyHelper.driver, case_name, second)
            else:
                Utils.getImage(self, MyHelper.driver, case_name, 1)
            Utils.getElementById(
                self, MyHelper.driver,
                FinancialOperationPage.resid_recharge_wechat_back).click()
            Utils.getElementById(
                self, MyHelper.driver,
                FinancialOperationPage.resid_back_button).click()
        except Exception as e:
            print("发现异常")
            print(e)
            raise SystemError
Beispiel #17
0
 def get_code_by_mobile(
         self,
         mobile="",
         case_name="",
         second=0):  #实名认证   param:mobile-手机号,case_name-用例名称,second-截图等待秒数
     try:
         my_info_page = MyInfoPage()
         util = Utils()
         util.getElementById(MyInfoHelper.driver,
                             my_info_page.resid_my_button).click()
         util.getElementById(MyInfoHelper.driver,
                             my_info_page.resid_myinfo_button).click()
         util.getElementById(MyInfoHelper.driver,
                             my_info_page.resid_myinfo_updatepwd).click()
         util.getElementById(MyInfoHelper.driver,
                             my_info_page.resid_updatepwd_mobile).click()
         util.getElementById(
             MyInfoHelper.driver,
             my_info_page.resid_updatepwd_mobile).send_keys(mobile)
         util.getElementById(
             MyInfoHelper.driver,
             my_info_page.resid_updatepwd_get_code_button).click()
         if (second > 1):
             util.getImage(MyInfoHelper.driver, case_name, second)
         else:
             util.getImage(MyInfoHelper.driver, case_name, 1)
         util.tap(MyInfoHelper.driver, 28, 72, 56,
                  110)  #此处返回使用绝对坐标来点击,使用id会有获取不到元素异常
         time.sleep(1)
         util.tap(MyInfoHelper.driver, 28, 72, 56, 110)
     except Exception as e:
         print("发现异常")
         print(e)
         raise SystemError