class TestLogin(unittest.TestCase):  # 创建测试类
    @classmethod  # 类方法,只执行一次,但必须要加注解@classmethod,且名字固定为setUpClass
    def setUpClass(cls):

        # cls.d = u2.connect('192.168.199.168')
        # cls.d = u2.connect_usb('127.0.0.1:62025')
        cls.watcherframe = WatcherFrame(outdevice=TestDeviceID)  #实例化
        cls.watcherframe.new_create_watcher()
        cls.watcherframe.new_create_watcher(outwatchername='OK',
                                            outconditiontextname='OK',
                                            outclicktextname='OK')
        cls.watcherframe.start_watcher()
        print('\n')
        pass

    @classmethod  # 类方法,只执行一次,但必须要加注解@classmethod,且名字固定为tearDownClass
    def tearDownClass(cls):
        print('\n')
        cls.watcherframe.close_all_watchers()
        pass

    def setUp(self):  # 每条用例执行测试之前都要执行此方法
        self.baseframe = BaseFrame(outdevice=TestDeviceID)  #实例化
        print('\n')
        #pass

    def tearDown(self):  # 每条用例执行测试之后都要执行此方法
        print('\n')
        pass

    #登录的测试方法
    def definelogin(self,
                    outtestcasediscription=None,
                    isStartApp=False,
                    isclickloginwithpassword=False,
                    outphonenumberinput=None,
                    outpwdinput=None,
                    outprepagetext=None,
                    outpretoastmessage=None,
                    outexceptiontext=None):

        # packagename = "com.ahdi.qrindo.merchant"
        # phonenumberid = "com.ahdi.qrindo.merchant:id/et_phonenumber"

        if outphonenumberinput == None:
            phonenumberinput = '81122336666'
        else:
            phonenumberinput = outphonenumberinput

        # pwdid = "com.ahdi.qrindo.merchant:id/et_pwd"

        if outpwdinput == None:
            pwdinput = "abc123456"
        else:
            pwdinput = outpwdinput

        # loginbuttonid = "com.ahdi.qrindo.merchant:id/btn_login"
        loginbuttonid = "com.ahdi.qrindo.merchant:id/btn_login"

        if outtestcasediscription == None:
            testcasediscription = '测试用例'
        else:
            testcasediscription = outtestcasediscription
        if isStartApp:
            self.baseframe.startapp(AppPackageName)
        if isclickloginwithpassword:
            self.baseframe.findbyresourceId_and_click(OTPLogInWithPasswordId)
        self.baseframe.findbyresourceId_and_input(AccountInputId,
                                                  phonenumberinput)  # 输入账号
        self.baseframe.findbyresourceId_and_input(PasswordInputId,
                                                  pwdinput)  # 输入密码
        pretoastmessage = self.baseframe.findbyresourceId_and_click(
            LoginButtonId, outpretoastmessage=outpretoastmessage)  # 点击登录按钮
        if pretoastmessage == None:
            if outprepagetext == None:
                prepagetext = None
            else:
                prepagetext = outprepagetext

            if prepagetext == None:
                self.assertTrue(
                    False,
                    '断言错误,请填写预期显示控件的text内容,即确保outprepagetext字段内容不为None,然后再运行测试用例'
                )
            else:
                preele = self.baseframe.findbytext(
                    prepagetext)  # 确认有显示文字“QRindo-Merchant”
                self.assertTrue(preele)
        else:
            toastmessage = self.baseframe.getToast()
            self.assertEqual(pretoastmessage, toastmessage)

        if outexceptiontext == 'OK':
            print("")
        elif outexceptiontext == 'Login':
            eleenable = self.baseframe.findbytext_and_return_enabledstatus(
                'Login')
            self.assertFalse(eleenable)
        elif outexceptiontext == 'Try again':
            self.baseframe.findbytext_and_click(outexceptiontext)

        print("%s.---测试通过" % testcasediscription)

    @data(
        ("账号密码错误提示", True, True, "81234567891234", "123456",
         "Incorrect account number or login password. Please try again(PP001)",
         None, "Try again"), ("登录账号长度小于8位,login按钮置灰", False, False, "1234567",
                              "123456", "Login", None, "Login"),
        ("密码长度小于6位,login按钮置灰", False, False, "12345678", "12345", "Login",
         None, "Login"),
        ("非8或08开头的账号提示非印尼号", False, False, "12345678", "123456", "Login",
         "You have entered an invalid Indonesia number", None),
        ("正确的账号密码登录成功", False, False, "81122336666", "abc123456", "Show all",
         None, None))
    @unpack
    def test_login(self, outtestcasediscription, isStartApp, isotplogin,
                   outphonenumberinput, outpwdinput, outprepagetext,
                   outpretoastmessage, outexceptiontext):
        self.definelogin(outtestcasediscription, isStartApp, isotplogin,
                         outphonenumberinput, outpwdinput, outprepagetext,
                         outpretoastmessage, outexceptiontext)
class TestSettings(unittest.TestCase):  # 创建测试类
    @classmethod  # 类方法,只执行一次,但必须要加注解@classmethod,且名字固定为setUpClass
    def setUpClass(cls):
        cls.baseframe = BaseFrame(GlobalConfig.globaldevice)
        cls.baseframe.findbyresourceId_and_click(
            "com.ahdi.qrindo.merchant:id/iv_cashier_right_top")  # 点击页面右上角的更多图标
        cls.baseframe.findbyresourceId_and_click(
            "com.ahdi.qrindo.merchant:id/tv_my_account")  # 点击设置选项
        pass

    @classmethod  # 类方法,只执行一次,但必须要加注解@classmethod,且名字固定为tearDownClass
    def tearDownClass(cls):
        cls.baseframe.findbyresourceId_and_click(
            "com.ahdi.qrindo.merchant:id/btn_back")  # 点击设置左上角的返回按钮
        pass

    def setUp(self):  # 每条用例执行测试之前都要执行此方法
        self.baseframe = BaseFrame(GlobalConfig.globaldevice)  #实例化
        #pass

    def tearDown(self):  # 每条用例执行测试之后都要执行此方法
        pass

    def define_setpre(self,
                      outnotificationsswitchid=None,
                      outsoundalertswitchid=None,
                      outnprestatus=None,
                      outsprestatus=None):
        if outnotificationsswitchid == None:
            notificationsswitchid = 'com.ahdi.qrindo.merchant:id/iv_notice'
        else:
            notificationsswitchid = outnotificationsswitchid

        if outsoundalertswitchid == None:
            soundalertswitchid = 'com.ahdi.qrindo.merchant:id/iv_sound'
        else:
            soundalertswitchid = outsoundalertswitchid
        if outnprestatus == None:
            nprestatus = True
        else:
            nprestatus = outnprestatus

        if outsprestatus == None:
            sprestatus = True
        else:
            sprestatus = outsprestatus

        getswitchstatus_beforeclick = self.define_getswitchstatus_beforeclick(
            outnotificationsswitchid=notificationsswitchid,
            outsoundalertswitchid=soundalertswitchid)
        nstatus = getswitchstatus_beforeclick[0]
        sstatus = getswitchstatus_beforeclick[1]

        if nstatus != nprestatus:
            self.baseframe.findbyresourceId_and_click(
                notificationsswitchid)  # 点击notificationsswitch
        else:
            pass

        getswitchstatus_beforeclick = self.define_getswitchstatus_beforeclick(
            outnotificationsswitchid=notificationsswitchid,
            outsoundalertswitchid=soundalertswitchid)
        nstatus = getswitchstatus_beforeclick[0]
        sstatus = getswitchstatus_beforeclick[1]
        if sstatus != sprestatus:
            self.baseframe.findbyresourceId_and_click(
                soundalertswitchid)  # 点击soundalertswitchid
        else:
            pass

        getswitchstatus_beforeclick = self.define_getswitchstatus_beforeclick(
            outnotificationsswitchid=notificationsswitchid,
            outsoundalertswitchid=soundalertswitchid)
        nstatus = getswitchstatus_beforeclick[0]
        sstatus = getswitchstatus_beforeclick[1]
        print("前置条件设置为-------------------------")
        print("n:", nstatus)
        print('s:', sstatus)

    def define_aresult(self,
                       outnotificationsswitchid=None,
                       outsoundalertswitchid=None):
        if outnotificationsswitchid == None:
            notificationsswitchid = 'com.ahdi.qrindo.merchant:id/iv_notice'
        else:
            notificationsswitchid = outnotificationsswitchid

        if outsoundalertswitchid == None:
            soundalertswitchid = 'com.ahdi.qrindo.merchant:id/iv_sound'
        else:
            soundalertswitchid = outsoundalertswitchid

        getswitchstatus_beforeclick = self.define_getswitchstatus_beforeclick(
            outnotificationsswitchid=notificationsswitchid,
            outsoundalertswitchid=soundalertswitchid)
        nstatus = getswitchstatus_beforeclick[0]
        sstatus = getswitchstatus_beforeclick[1]
        print("实际结果为-------------------------")
        print("n:", nstatus)
        print('s:', sstatus)

    def define_getswitchstatus_beforeclick(self,
                                           outnotificationsswitchid=None,
                                           outsoundalertswitchid=None):
        if outnotificationsswitchid == None:
            notificationsswitchid = 'com.ahdi.qrindo.merchant:id/iv_notice'
        else:
            notificationsswitchid = outnotificationsswitchid

        if outsoundalertswitchid == None:
            soundalertswitchid = 'com.ahdi.qrindo.merchant:id/iv_sound'
        else:
            soundalertswitchid = outsoundalertswitchid
        switchstatus = []
        after_notificationsswitch_eleinfo_selected = self.baseframe.findbyresourceId_and_return_selectedstatus(
            notificationsswitchid)
        switchstatus.append(after_notificationsswitch_eleinfo_selected)
        after_soundalertswitch_eleinfo_selected = self.baseframe.findbyresourceId_and_return_selectedstatus(
            soundalertswitchid)
        switchstatus.append(after_soundalertswitch_eleinfo_selected)
        return switchstatus

    def define_getswitchstatus(self,
                               clickselect,
                               outnotificationsswitchid=None,
                               outsoundalertswitchid=None):
        if outnotificationsswitchid == None:
            notificationsswitchid = 'com.ahdi.qrindo.merchant:id/iv_notice'
        else:
            notificationsswitchid = outnotificationsswitchid

        if outsoundalertswitchid == None:
            soundalertswitchid = 'com.ahdi.qrindo.merchant:id/iv_sound'
        else:
            soundalertswitchid = outsoundalertswitchid
        switchstatus = []
        if clickselect == 'n':
            self.baseframe.findbyresourceId_and_click(
                notificationsswitchid)  # 点击notificationsswitch
        elif clickselect == 's':
            self.baseframe.findbyresourceId_and_click(
                soundalertswitchid)  # 点击soundalertswitchid
        else:
            print("clickselect参数错误!clickselect参数只能是n或s,请确保参数正确")
        after_notificationsswitch_eleinfo_selected = self.baseframe.findbyresourceId_and_return_selectedstatus(
            notificationsswitchid)
        switchstatus.append(after_notificationsswitch_eleinfo_selected)
        after_soundalertswitch_eleinfo_selected = self.baseframe.findbyresourceId_and_return_selectedstatus(
            soundalertswitchid)
        switchstatus.append(after_soundalertswitch_eleinfo_selected)
        return switchstatus

    def define_assertluoji(self,
                           outnotificationsswitchid=None,
                           outsoundalertswitchid=None,
                           outclickselect=None):
        if outnotificationsswitchid == None:
            notificationsswitchid = 'com.ahdi.qrindo.merchant:id/iv_notice'
        else:
            notificationsswitchid = outnotificationsswitchid

        if outsoundalertswitchid == None:
            soundalertswitchid = 'com.ahdi.qrindo.merchant:id/iv_sound'
        else:
            soundalertswitchid = outsoundalertswitchid

        if outclickselect == None:
            clickselect = 'n'
        else:
            clickselect = outclickselect

        print("开始测试-------------------------")
        notificationsswitch_eleinfo_selected = self.baseframe.findbyresourceId_and_return_selectedstatus(
            notificationsswitchid)
        print('notificationsswitch_eleinfo_selected:',
              notificationsswitch_eleinfo_selected)
        soundalertswitch_eleinfo_selected = self.baseframe.findbyresourceId_and_return_selectedstatus(
            soundalertswitchid)
        print('soundalertswitch_eleinfo_selected:',
              notificationsswitch_eleinfo_selected)

        if notificationsswitch_eleinfo_selected == True and soundalertswitch_eleinfo_selected == True:
            switchstatus = self.define_getswitchstatus(clickselect,
                                                       notificationsswitchid,
                                                       soundalertswitchid)
            after_notificationsswitch_eleinfo_selected = switchstatus[0]
            after_soundalertswitch_eleinfo_selected = switchstatus[1]
            if clickselect == 'n':
                self.assertNotEqual(
                    notificationsswitch_eleinfo_selected,
                    after_notificationsswitch_eleinfo_selected)
                self.assertFalse(after_soundalertswitch_eleinfo_selected)
                self.define_aresult(notificationsswitchid,
                                    soundalertswitchid)  #打印实际结果
                self.baseframe.findbyresourceId_and_click(
                    notificationsswitchid)  # 点击notificationsswitch
            if clickselect == 's':
                self.assertEqual(notificationsswitch_eleinfo_selected,
                                 after_notificationsswitch_eleinfo_selected)
                self.assertNotEqual(soundalertswitch_eleinfo_selected,
                                    after_soundalertswitch_eleinfo_selected)
                self.define_aresult(notificationsswitchid,
                                    soundalertswitchid)  # 打印实际结果
                self.baseframe.findbyresourceId_and_click(
                    soundalertswitchid)  # 点击soundalertswitchid

        elif notificationsswitch_eleinfo_selected == True and soundalertswitch_eleinfo_selected == False:
            switchstatus = self.define_getswitchstatus(clickselect,
                                                       notificationsswitchid,
                                                       soundalertswitchid)
            after_notificationsswitch_eleinfo_selected = switchstatus[0]
            after_soundalertswitch_eleinfo_selected = switchstatus[1]
            if clickselect == 'n':
                self.assertNotEqual(
                    notificationsswitch_eleinfo_selected,
                    after_notificationsswitch_eleinfo_selected)
                self.assertFalse(after_soundalertswitch_eleinfo_selected)
                self.define_aresult(notificationsswitchid,
                                    soundalertswitchid)  # 打印实际结果
                self.baseframe.findbyresourceId_and_click(
                    notificationsswitchid)  # 点击notificationsswitch
                self.baseframe.findbyresourceId_and_click(
                    soundalertswitchid)  # 点击soundalertswitchid
            if clickselect == 's':
                self.assertEqual(notificationsswitch_eleinfo_selected,
                                 after_notificationsswitch_eleinfo_selected)
                self.assertNotEqual(soundalertswitch_eleinfo_selected,
                                    after_soundalertswitch_eleinfo_selected)
                self.define_aresult(notificationsswitchid,
                                    soundalertswitchid)  # 打印实际结果
                self.baseframe.findbyresourceId_and_click(
                    soundalertswitchid)  # 点击soundalertswitchid

        elif notificationsswitch_eleinfo_selected == False and soundalertswitch_eleinfo_selected == False:
            switchstatus = self.define_getswitchstatus(clickselect,
                                                       notificationsswitchid,
                                                       soundalertswitchid)
            after_notificationsswitch_eleinfo_selected = switchstatus[0]
            after_soundalertswitch_eleinfo_selected = switchstatus[1]
            if clickselect == 'n':
                self.assertNotEqual(
                    notificationsswitch_eleinfo_selected,
                    after_notificationsswitch_eleinfo_selected)
                self.assertNotEqual(soundalertswitch_eleinfo_selected,
                                    after_soundalertswitch_eleinfo_selected)
                self.define_aresult(notificationsswitchid,
                                    soundalertswitchid)  # 打印实际结果
                self.baseframe.findbyresourceId_and_click(
                    notificationsswitchid)  # 点击notificationsswitch
            if clickselect == 's':
                self.assertEqual(notificationsswitch_eleinfo_selected,
                                 after_notificationsswitch_eleinfo_selected)
                self.assertEqual(soundalertswitch_eleinfo_selected,
                                 after_soundalertswitch_eleinfo_selected)
                self.define_aresult(notificationsswitchid,
                                    soundalertswitchid)  # 打印实际结果

    # @unittest.skip('test_021')  # 跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_021(self):
        """
        Notifications与Sound Alert的开关逻辑,Notifications与Sound Alert都是开着的
        """
        outnotificationsswitchid = None
        outsoundalertswitchid = None
        outclickselect = None
        outnprestatus = None
        outsprestatus = None
        self.define_setpre()
        self.define_assertluoji()
        print(
            "当Notifications与Sound Alert开关都处于开启状态,关闭Notifications开关,Notifications与Sound Alert都关闭.---测试通过"
        )
        # self.baseframe.getdeviceinfo()
        # self.baseframe.d.screenshot("home.jpg"

    # @unittest.skip('test_022')  # 跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_022(self):
        """
        Notifications与Sound Alert的开关逻辑,Notifications开,Sound Alert关
        """
        outnotificationsswitchid = None
        outsoundalertswitchid = None
        outclickselect = 's'
        outnprestatus = None
        outsprestatus = False
        self.define_setpre(outnotificationsswitchid=outnotificationsswitchid,
                           outsoundalertswitchid=outsoundalertswitchid,
                           outnprestatus=outnprestatus,
                           outsprestatus=outsprestatus)
        self.define_assertluoji(
            outnotificationsswitchid=outnotificationsswitchid,
            outsoundalertswitchid=outsoundalertswitchid,
            outclickselect=outclickselect)
        print(
            "当Notifications开启但Sound Alert关闭时,关闭Notifications开关,Notifications与Sound Alert都关闭.---测试通过"
        )
        # self.baseframe.getdeviceinfo()
        # self.baseframe.d.screenshot("home.jpg"

    # @unittest.skip('test_023')  # 跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_023(self):
        """
        Notifications与Sound Alert的开关逻辑,Notifications关,Sound Alert关
        """
        outnotificationsswitchid = None
        outsoundalertswitchid = None
        outclickselect = 's'
        outnprestatus = False
        outsprestatus = False
        self.define_setpre(outnotificationsswitchid=outnotificationsswitchid,
                           outsoundalertswitchid=outsoundalertswitchid,
                           outnprestatus=outnprestatus,
                           outsprestatus=outsprestatus)
        self.define_assertluoji(
            outnotificationsswitchid=outnotificationsswitchid,
            outsoundalertswitchid=outsoundalertswitchid,
            outclickselect=outclickselect)
        print(
            "当Notifications和Sound Alert都关闭时,打开Notifications开关,Notifications与Sound Alert都开启.---测试通过"
        )

    # @unittest.skip('test_031')  # 跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_031(self):
        """
        Notifications与Sound Alert的开关逻辑,Notifications与Sound Alert都是开着的
        """
        outnotificationsswitchid = None
        outsoundalertswitchid = None
        outclickselect = None
        outnprestatus = None
        outsprestatus = None
        self.define_setpre(outnotificationsswitchid=outnotificationsswitchid,
                           outsoundalertswitchid=outsoundalertswitchid,
                           outnprestatus=outnprestatus,
                           outsprestatus=outsprestatus)
        self.define_assertluoji(
            outnotificationsswitchid=outnotificationsswitchid,
            outsoundalertswitchid=outsoundalertswitchid,
            outclickselect=outclickselect)
        print(
            "当Notifications与Sound Alert开关都处于开启状态,关闭Sound Alert开关,Notifications开启,Sound Alert关闭.---测试通过"
        )

    # @unittest.skip('test_032')  # 跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_032(self):
        """
        Notifications与Sound Alert的开关逻辑,Notifications开,Sound Alert关
        """
        outnotificationsswitchid = None
        outsoundalertswitchid = None
        outclickselect = None
        outnprestatus = None
        outsprestatus = False
        self.define_setpre(outnotificationsswitchid=outnotificationsswitchid,
                           outsoundalertswitchid=outsoundalertswitchid,
                           outnprestatus=outnprestatus,
                           outsprestatus=outsprestatus)
        self.define_assertluoji(
            outnotificationsswitchid=outnotificationsswitchid,
            outsoundalertswitchid=outsoundalertswitchid,
            outclickselect=outclickselect)
        print(
            "当Notifications开启但Sound Alert关闭时,打开Sound Alert开关,Notifications与Sound Alert都开启.---测试通过"
        )
        # self.baseframe.getdeviceinfo()
        # self.baseframe.d.screenshot("home.jpg"

    # @unittest.skip('test_033')  # 跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_033(self):
        """
        Notifications与Sound Alert的开关逻辑,Notifications关,Sound Alert关
        """
        outnotificationsswitchid = None
        outsoundalertswitchid = None
        outclickselect = None
        outnprestatus = False
        outsprestatus = False
        self.define_setpre(outnotificationsswitchid=outnotificationsswitchid,
                           outsoundalertswitchid=outsoundalertswitchid,
                           outnprestatus=outnprestatus,
                           outsprestatus=outsprestatus)
        self.define_assertluoji(
            outnotificationsswitchid=outnotificationsswitchid,
            outsoundalertswitchid=outsoundalertswitchid,
            outclickselect=outclickselect)
        print(
            "当Notifications和Sound Alert都关闭时,企图打开Sound Alert开关,Notifications与Sound Alert都关闭.---测试通过"
        )

    def define_versionupdate(self,
                             outversionid=None,
                             outprelastversiontext=None,
                             outtoastmessage=None):
        if outversionid == None:
            versionid = "com.ahdi.qrindo.merchant:id/tv_version_code"
        else:
            versionid = outversionid

        if outprelastversiontext == None:
            prelastversiontext = "V1.0.1"
        else:
            prelastversiontext = outprelastversiontext

        lastversiontext = self.baseframe.findbyresourceId_and_return_text(
            versionid)
        if lastversiontext == prelastversiontext:
            pretoastmessage = self.baseframe.findbyresourceId_and_click(
                versionid, outtoastmessage)
            self.assertEqual(outtoastmessage, pretoastmessage)
        else:
            self.assertFalse(True)

    # @unittest.skip('test_051')  # 跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_051(self):
        """
        最新版本号,点击版本号,toast提示为'It's the latest version'
        """
        versionid = "com.ahdi.qrindo.merchant:id/tv_version_code"
        prelastversiontext = "V1.0.1"
        toastmessage = "It's the latest version"

        self.define_versionupdate(outversionid=versionid,
                                  outprelastversiontext=prelastversiontext,
                                  outtoastmessage=toastmessage)
        print("最新版本号,点击版本号,toast提示'It's the latest version'.---测试通过")
class TestLogin(unittest.TestCase):  # 创建测试类
    @classmethod  # 类方法,只执行一次,但必须要加注解@classmethod,且名字固定为setUpClass
    def setUpClass(cls):

        # cls.d = u2.connect('192.168.199.168')
        # cls.d = u2.connect_usb('127.0.0.1:62025')
        cls.watcherframe = WatcherFrame(GlobalConfig.globaldevice)  #实例化
        cls.watcherframe.new_create_watcher()
        cls.watcherframe.new_create_watcher(outwatchername='OK',
                                            outconditiontextname='OK',
                                            outclicktextname='OK')
        cls.watcherframe.start_watcher()
        print('\n')
        pass

    @classmethod  # 类方法,只执行一次,但必须要加注解@classmethod,且名字固定为tearDownClass
    def tearDownClass(cls):
        print('\n')
        cls.watcherframe.close_all_watchers()
        pass

    def setUp(self):  # 每条用例执行测试之前都要执行此方法
        self.baseframe = BaseFrame(GlobalConfig.globaldevice)  #实例化
        print('\n')
        #pass

    def tearDown(self):  # 每条用例执行测试之后都要执行此方法
        print('\n')
        pass

    def definelogin(self,
                    outadborder=None,
                    outphonenumberid=None,
                    outphonenumberinput=None,
                    outpwdid=None,
                    outpwdinput=None,
                    outloginbuttonid=None,
                    outprepagetext=None,
                    outpretoastmessage=None):
        if outadborder == None:
            adborder = "com.ahdi.qrindo.merchant"
        else:
            adborder = outadborder

        if outphonenumberid == None:
            phonenumberid = "com.ahdi.qrindo.merchant:id/et_phonenumber"
        else:
            phonenumberid = outphonenumberid

        if outphonenumberinput == None:
            phonenumberinput = '81122336666'
        else:
            phonenumberinput = outphonenumberinput

        if outpwdid == None:
            pwdid = "com.ahdi.qrindo.merchant:id/et_pwd"
        else:
            pwdid = outpwdid

        if outpwdinput == None:
            pwdinput = "abc123456"
        else:
            pwdinput = outpwdinput

        if outloginbuttonid == None:
            loginbuttonid = "com.ahdi.qrindo.merchant:id/btn_login"
        else:
            loginbuttonid = outloginbuttonid

        # self.baseframe.adbshell(adborder)
        # self.baseframe.findbytext_and_click(adborder)
        self.baseframe.startapp(adborder)
        self.baseframe.findbyresourceId_and_input(phonenumberid,
                                                  phonenumberinput)  # 输入账号
        self.baseframe.findbyresourceId_and_input(pwdid, pwdinput)  # 输入密码
        pretoastmessage = self.baseframe.findbyresourceId_and_click(
            loginbuttonid, outpretoastmessage=outpretoastmessage)  # 点击登录按钮
        if pretoastmessage == None:
            if outprepagetext == None:
                prepagetext = None
            else:
                prepagetext = outprepagetext

            if prepagetext == None:
                self.assertTrue(
                    False,
                    '断言错误,请填写预期显示控件的text内容,即确保outprepagetext字段内容不为None,然后再运行测试用例'
                )
            else:
                preele = self.baseframe.findbytext(
                    prepagetext)  # 确认有显示文字“QRindo-Merchant”
                self.assertTrue(preele)
        else:
            toastmessage = self.baseframe.getToast()
            self.assertEqual(pretoastmessage, toastmessage)

    # @unittest.skip('test_020')  # 跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_020(self):
        """
        正确的账号和密码,登录成功
        """
        outadborder = None
        outphonenumberid = None
        outphonenumberinput = None
        outpwdid = None
        outpwdinput = None
        outloginbuttonid = None
        outprepagetext = 'QRindo-Merchant'
        outpretoastmessage = None

        self.definelogin(outprepagetext=outprepagetext)
        print("已经注册商户的正确的钱包账号和密码,登录成功.---测试通过")

    # @unittest.skip('test_001')  # 跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_001(self):
        """
        非8或08开头的手机
        """
        outadborder = None
        outphonenumberid = None
        outphonenumberinput = '1122336666'
        outpwdid = None
        outpwdinput = '123456'
        outloginbuttonid = None
        outprepagetext = None
        outpretoastmessage = 'You have entered an invalid Indonesia number'
        self.definelogin(outphonenumberinput=outphonenumberinput,
                         outpwdinput=outpwdinput,
                         outpretoastmessage=outpretoastmessage)
        print(
            "非8或08开头的手机号登录,toast提示 'You have entered an invalid Indonesia number'.---测试通过"
        )

    # @unittest.skip('test_002')  # 跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_002(self):
        """
        正确的钱包账号和密码,非商户
        """
        outadborder = None
        outphonenumberid = None
        outphonenumberinput = '81122337788'
        outpwdid = None
        outpwdinput = 'a123456'
        outloginbuttonid = None
        outprepagetext = 'Login account is not bound to the merchant(MC320)'
        outpretoastmessage = None
        self.definelogin(outphonenumberinput=outphonenumberinput,
                         outpwdinput=outpwdinput,
                         outprepagetext=outprepagetext)
        self.baseframe.findbytext_and_click('OK')
        print(
            "没有注册商户的正确的钱包账号和密码,登录提示'Login account is not bound to the merchant(MC320)'.---测试通过"
        )

    # @unittest.skip('test_003')  # 跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_003(self):
        """
        未注册的印尼手机号码
        """
        outadborder = None
        outphonenumberid = None
        outphonenumberinput = '86754893987'
        outpwdid = None
        outpwdinput = 'a123456'
        outloginbuttonid = None
        outprepagetext = 'Incorrect account number or login password. Please try again(PP001)'
        outpretoastmessage = None
        self.definelogin(outphonenumberinput=outphonenumberinput,
                         outpwdinput=outpwdinput,
                         outprepagetext=outprepagetext)
        self.baseframe.findbytext_and_click('OK')
        print(
            "没有注册商户的钱包账号登录,提示'Incorrect account number or login password. Please try again(PP001)'.---测试通过"
        )

    # @unittest.skip('test_004')  # 跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_004(self):
        """
        已注册的账号,错误的密码及锁定
        """
        for i in range(0, 5):
            outadborder = None
            outphonenumberid = None
            outphonenumberinput = '833669911'
            outpwdid = None
            outpwdinput = '123456'
            outloginbuttonid = None
            outprepagetext = 'Incorrect account number or login password. Please try again(PP001)'
            outpretoastmessage = None
            self.definelogin(outphonenumberinput=outphonenumberinput,
                             outpwdinput=outpwdinput,
                             outprepagetext=outprepagetext)
            self.baseframe.findbytext_and_click('OK')
            print('密码错误%s此---' % str(i + 1))
        outadborder = None
        outphonenumberid = None
        outphonenumberinput = '833669911'
        outpwdid = None
        outpwdinput = '123456'
        outloginbuttonid = None
        outprepagetext = 'Login password entered incorrectly too many times. Please wait 5hours 60mins before trying again or reset password(PP013)'
        outpretoastmessage = None
        self.definelogin(outphonenumberinput=outphonenumberinput,
                         outpwdinput=outpwdinput,
                         outprepagetext=outprepagetext)
        self.baseframe.findbytext_and_click('OK')
        print(
            "正确的钱包账号,错误的密码,提示'Incorrect account number or login password. Please try again(PP001)',错误第五次后提示 'Login password entered incorrectly too many times. Please wait 5hours 60mins before trying again or reset password(PP013)'.---测试通过"
        )

    # @unittest.skip('test_005')  # 跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_005(self):
        """
        账号长度输入小于8位,密码位数等于6位,登录按钮置灰不可用
        """
        outadborder = None
        outphonenumberid = None
        outphonenumberinput = '1234567'
        outpwdid = None
        outpwdinput = '123456'
        outloginbuttonid = None
        outprepagetext = 'Log in'
        outpretoastmessage = None
        self.definelogin(outphonenumberinput=outphonenumberinput,
                         outpwdinput=outpwdinput,
                         outprepagetext=outprepagetext)
        eleenable = self.baseframe.findbytext_and_return_enabledstatus(
            'Log in')
        self.assertFalse(eleenable)
        print("账号长度输入小于8位,密码位数等于6位,登录按钮置灰不可用.---测试通过")

    # @unittest.skip('test_006')  # 跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_006(self):
        """
        账号长度输入等于8位,密码位数小于6位,登录按钮置灰不可用
        """
        outadborder = None
        outphonenumberid = None
        outphonenumberinput = '12345678'
        outpwdid = None
        outpwdinput = '12345'
        outloginbuttonid = None
        outprepagetext = 'Log in'
        outpretoastmessage = None
        self.definelogin(outphonenumberinput=outphonenumberinput,
                         outpwdinput=outpwdinput,
                         outprepagetext=outprepagetext)
        eleenable = self.baseframe.findbytext_and_return_enabledstatus(
            'Log in')
        self.assertFalse(eleenable)
        print("账号长度输入等于8位,密码位数小于6位,登录按钮置灰不可用.---测试通过")

    # @unittest.skip('test_007')  # 跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_007(self):
        """
        账号长度输入大于13位时,密码位数等于6位,登录按钮置灰不可用
        """
        outadborder = None
        outphonenumberid = None
        outphonenumberinput = '12345678901234'
        outpwdid = None
        outpwdinput = '123456'
        outloginbuttonid = None
        outprepagetext = 'Log in'
        outpretoastmessage = None
        self.definelogin(outphonenumberinput=outphonenumberinput,
                         outpwdinput=outpwdinput,
                         outprepagetext=outprepagetext)
        eleenable = self.baseframe.findbytext_and_return_enabledstatus(
            'Log in')
        self.assertFalse(eleenable)
        print("账号长度输入大于13位时,密码位数等于6位,登录按钮置灰不可用.---测试通过")
        # eleinfo_text = self.baseframe.findbyresourceId_and_return_text("com.ahdi.qrindo.merchant:id/et_phonenumber")
        # textlong = len(eleinfo_text)
        # print("textlong:",textlong )
        # self.assertEqual(textlong,14)

    # @unittest.skip('test_008')  # 跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_008(self):
        """
        账号长度输入等于13位时,密码位数大于24位,登录按钮置灰不可用
        """
        outadborder = None
        outphonenumberid = None
        outphonenumberinput = '1234567890123'
        outpwdid = None
        outpwdinput = '1234567890123456789012345'
        outloginbuttonid = None
        outprepagetext = 'Log in'
        outpretoastmessage = None
        self.definelogin(outphonenumberinput=outphonenumberinput,
                         outpwdinput=outpwdinput,
                         outprepagetext=outprepagetext)
        eleenable = self.baseframe.findbytext_and_return_enabledstatus(
            'Log in')
        self.assertFalse(eleenable)
        print("账号长度输入等于13位时,密码位数大于24位,登录按钮置灰不可用.---测试通过")
class TestLogin(unittest.TestCase):  # 创建测试类
    @classmethod  # 类方法,只执行一次,但必须要加注解@classmethod,且名字固定为setUpClass
    def setUpClass(cls):

        # cls.d = u2.connect('192.168.199.168')
        # cls.d = u2.connect_usb('127.0.0.1:62025')
        cls.watcherframe = WatcherFrame(GlobalConfig.globaldevice)  #实例化
        cls.watcherframe.new_create_watcher()
        cls.watcherframe.new_create_watcher(outwatchername='OK',
                                            outconditiontextname='OK',
                                            outclicktextname='OK')
        cls.watcherframe.start_watcher()
        print('\n')
        pass

    @classmethod  # 类方法,只执行一次,但必须要加注解@classmethod,且名字固定为tearDownClass
    def tearDownClass(cls):
        print('\n')
        cls.watcherframe.close_all_watchers()
        pass

    def setUp(self):  # 每条用例执行测试之前都要执行此方法
        self.baseframe = BaseFrame(GlobalConfig.globaldevice)  #实例化
        print('\n')
        #pass

    def tearDown(self):  # 每条用例执行测试之后都要执行此方法
        print('\n')
        pass

    #登录的测试方法
    def definelogin(self,
                    outtestcasediscription=None,
                    outphonenumberinput=None,
                    outpwdinput=None,
                    outprepagetext=None,
                    outpretoastmessage=None,
                    outexceptiontext=None):

        packagename = "com.ahdi.qrindo.merchant"
        phonenumberid = "com.ahdi.qrindo.merchant:id/et_phonenumber"

        if outphonenumberinput == None:
            phonenumberinput = '81122336666'
        else:
            phonenumberinput = outphonenumberinput

        pwdid = "com.ahdi.qrindo.merchant:id/et_pwd"

        if outpwdinput == None:
            pwdinput = "abc123456"
        else:
            pwdinput = outpwdinput

        loginbuttonid = "com.ahdi.qrindo.merchant:id/btn_login"

        if outtestcasediscription == None:
            testcasediscription = '测试用例'
        else:
            testcasediscription = outtestcasediscription

        self.baseframe.startapp(packagename)
        self.baseframe.findbyresourceId_and_input(phonenumberid,
                                                  phonenumberinput)  # 输入账号
        self.baseframe.findbyresourceId_and_input(pwdid, pwdinput)  # 输入密码
        pretoastmessage = self.baseframe.findbyresourceId_and_click(
            loginbuttonid, outpretoastmessage=outpretoastmessage)  # 点击登录按钮
        if pretoastmessage == None:
            if outprepagetext == None:
                prepagetext = None
            else:
                prepagetext = outprepagetext

            if prepagetext == None:
                self.assertTrue(
                    False,
                    '断言错误,请填写预期显示控件的text内容,即确保outprepagetext字段内容不为None,然后再运行测试用例'
                )
            else:
                preele = self.baseframe.findbytext(
                    prepagetext)  # 确认有显示文字“QRindo-Merchant”
                self.assertTrue(preele)
        else:
            toastmessage = self.baseframe.getToast()
            self.assertEqual(pretoastmessage, toastmessage)

        if outexceptiontext == 'OK':
            print("")
        elif outexceptiontext == 'Log in':
            eleenable = self.baseframe.findbytext_and_return_enabledstatus(
                'Log in')
            self.assertFalse(eleenable)
        print("%s.---测试通过" % testcasediscription)

    @staticmethod  #根据不同的参数生成测试用例
    def getTestFunc(outtestcasediscription, outphonenumberinput, outpwdinput,
                    outprepagetext, outpretoastmessage, outexceptiontext):
        def func(self):
            self.definelogin(outtestcasediscription, outphonenumberinput,
                             outpwdinput, outprepagetext, outpretoastmessage,
                             outexceptiontext)

        return func

    @unittest.skip('test_020')  # 跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_020(self):
        """
        正确的账号和密码,登录成功
        """
        outadborder = None
        outphonenumberid = None
        outphonenumberinput = None
        outpwdid = None
        outpwdinput = None
        outloginbuttonid = None
        outprepagetext = 'QRindo-Merchant'
        outpretoastmessage = None

        self.definelogin(outprepagetext=outprepagetext)
        print("已经注册商户的正确的钱包账号和密码,登录成功.---测试通过")
Exemple #5
0
class TestTips(unittest.TestCase):  # 创建测试类
    @classmethod  # 类方法,只执行一次,但必须要加注解@classmethod,且名字固定为setUpClass
    def setUpClass(cls):
        cls.watcherframe = WatcherFrame(GlobalConfig.globaldevice)  #实例化
        cls.watcherframe.start_all_watchers()
        pass

    @classmethod  # 类方法,只执行一次,但必须要加注解@classmethod,且名字固定为tearDownClass
    def tearDownClass(cls):
        cls.watcherframe.close_all_watchers()
        pass

    def setUp(self):  # 每条用例执行测试之前都要执行此方法
        self.watcherframe = WatcherFrame(GlobalConfig.globaldevice)  #实例化
        self.baseframe = BaseFrame(GlobalConfig.globaldevice)  #实例化
        print("测试用例开跑-----------------------------------------------")
        #pass

    def tearDown(self):  # 每条用例执行测试之后都要执行此方法
        print("测试用例跑完-----------------------------------------------")
        pass

    def define_tips(self,
                    outtipooptionsid=None,
                    outoptiontext=None,
                    outfixedfeeinputid=None,
                    outfixedfeeinputtext=None,
                    outfixedfeeconfirmid=None,
                    outpercentagefeeinputid=None,
                    outpercentagefeeinputtext=None,
                    outpercentagefeeconfirmid=None,
                    outpretext=None,
                    outbeisaoid=None,
                    outzhusaoid=None,
                    outmoneyinputid=None,
                    outmoneyinputtext=None,
                    outpretoastmessage=None):
        if outtipooptionsid == None:
            tipooptionsid = 'com.ahdi.qrindo.merchant:id/tv_tips_show'
        else:
            tipooptionsid = outtipooptionsid

        if outoptiontext == None:
            optiontext = 'No Tips'
        else:
            optiontext = outoptiontext

        if outfixedfeeinputid == None:
            fixedfeeinputid = 'com.ahdi.qrindo.merchant:id/edt_pwd'
        else:
            fixedfeeinputid = outfixedfeeinputid

        if outfixedfeeinputtext == None:
            fixedfeeinputtext = '1000'
        else:
            fixedfeeinputtext = outfixedfeeinputtext

        if outfixedfeeconfirmid == None:
            fixedfeeconfirmid = 'com.ahdi.qrindo.merchant:id/btn_confirm'
        else:
            fixedfeeconfirmid = outfixedfeeconfirmid

        if outpercentagefeeinputid == None:
            percentagefeeinputid = 'com.ahdi.qrindo.merchant:id/edt_pwd'
        else:
            percentagefeeinputid = outpercentagefeeinputid

        if outpercentagefeeinputtext == None:
            percentagefeeinputtext = '100'
        else:
            percentagefeeinputtext = outpercentagefeeinputtext

        if outpercentagefeeconfirmid == None:
            percentagefeeconfirmid = 'com.ahdi.qrindo.merchant:id/btn_confirm'
        else:
            percentagefeeconfirmid = outpercentagefeeconfirmid

        if outpretext == None:
            pretext = 'No Tips'
        else:
            pretext = outpretext

        if outbeisaoid == None:
            beisaoid = 'com.ahdi.qrindo.merchant:id/iv_cashier_show_qr'
        else:
            beisaoid = outbeisaoid

        if outzhusaoid == None:
            zhusaoid = 'com.ahdi.qrindo.merchant:id/iv_cashier_scan_qr'
        else:
            zhusaoid = outzhusaoid

        if outmoneyinputid == None:
            moneyinputid = 'com.ahdi.qrindo.merchant:id/edt_pay_num'
        else:
            moneyinputid = outmoneyinputid

        if outmoneyinputtext == None:
            moneyinputtext = None
        else:
            moneyinputtext = outmoneyinputtext

        if optiontext == 'com.ahdi.qrindo.merchant:id/btn_back':
            cancelid = optiontext
            cancelpretext = self.baseframe.findbyresourceId_and_return_text(
                tipooptionsid)  # 查看小费选项显示内容
            self.baseframe.findbyresourceId_and_click(tipooptionsid)  # 点击小费选项
            self.baseframe.findbyresourceId_and_click(
                cancelid
            )  # # 选择小费选项_No Tips、Consumer Input、Fixed Fee、Percentage Fee、Cancel
            resulttext = self.baseframe.findbyresourceId_and_return_text(
                tipooptionsid)  # 查看小费选项显示内容
            self.assertEqual(cancelpretext, resulttext)
        else:
            self.baseframe.findbyresourceId_and_click(tipooptionsid)  #点击小费选项
            self.baseframe.findbytext_and_click(
                optiontext
            )  # # 选择小费选项_No Tips、Consumer Input、Fixed Fee、Percentage Fee、Cancel

            if optiontext == 'Fixed Fee':
                self.baseframe.findbyresourceId_and_input(
                    fixedfeeinputid, fixedfeeinputtext)  # 输入固定金额费用
                self.baseframe.findbyresourceId_and_click(
                    fixedfeeconfirmid)  # 点击确认按钮
            if optiontext == 'Percentage Fee':
                self.baseframe.findbyresourceId_and_input(
                    percentagefeeinputid, percentagefeeinputtext)  # 输入百分比金额费用
                self.baseframe.findbyresourceId_and_click(
                    percentagefeeconfirmid)  # 点击确认按钮

            resulttext = self.baseframe.findbyresourceId_and_return_text(
                tipooptionsid)  # 查看小费选项显示内容
            self.assertEqual(pretext, resulttext)
            zhusaoenablestatus = self.baseframe.findbyresourceId_and_return_enabledstatus(
                beisaoid)  # 查看被扫可用状态
            self.assertTrue(zhusaoenablestatus)
            beisaoenablestatus = self.baseframe.findbyresourceId_and_return_enabledstatus(
                zhusaoid)  # 查看主扫可用状态
            if optiontext == 'No Tips':
                self.assertTrue(beisaoenablestatus)
            else:
                self.assertFalse(beisaoenablestatus)

        self.baseframe.findbyresourceId_and_input(moneyinputid,
                                                  moneyinputtext)  #输入金额
        toastmessage = self.baseframe.findbyresourceId_and_click(
            beisaoid, outpretoastmessage)  #不输入金额,点击被扫,查看toast提示
        if toastmessage != None:
            self.assertEqual(outpretoastmessage, toastmessage)
        else:
            self.baseframe.delaytime(5)
            self.baseframe.findbytext("Scan to pay me")
            gett = GetTimeStr()  #实例化

            totalamount = self.baseframe.findbyresourceId_and_return_text(
                'com.ahdi.qrindo.merchant:id/tv_fee_total')
            totalamountstr = gett.getsplitstr(totalamount)
            print("totalamountstr:", totalamountstr)

            payamount = self.baseframe.findbyresourceId_and_return_text(
                'com.ahdi.qrindo.merchant:id/tv_Amount')
            payamountstr = gett.getsplitstr(payamount)
            print("payamountstr:", payamountstr)

            tipsamount = self.baseframe.findbyresourceId_and_return_text(
                'com.ahdi.qrindo.merchant:id/tv_tips_fee')
            tipsamountstr = gett.getsplitstr(tipsamount)
            print("tipsamountstr:", tipsamountstr)

            totalamountint = int(totalamountstr)
            pretotalamountint = int(payamountstr) + int(tipsamountstr)
            print("totalamountint:", totalamountint)
            print("pretotalamountint:", pretotalamountint)

            self.assertEqual(pretotalamountint, totalamountint)
            self.baseframe.findbyresourceId_and_click(
                "com.ahdi.qrindo.merchant:id/btn_back")

    @unittest.skip('test_011')  # 跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_011(self):
        """
        无小费时,主扫和被扫都可用,不输入金额,Toast提示
        """
        outtipooptionsid = None
        outoptiontext = None
        outpretext = None
        outbeisaoid = None
        outzhusaoid = None
        outfixedfeeinputid = None
        outfixedfeeinputtext = None
        outfixedfeeconfirmid = None
        outpercentagefeeinputid = None
        outpercentagefeeinputtext = None
        outpercentagefeeconfirmid = None
        outmoneyinputid = None
        outmoneyinputtext = None
        outpretoastmessage = 'The amount cannot be empty'

        self.define_tips(outpretoastmessage=outpretoastmessage)
        print(
            "小费选项为‘No Tips’时,主扫和被扫都可用.不输入金额,点击被扫,Toast提示‘The amount cannot be empty’.---测试通过"
        )

    @unittest.skip('test_012')  # 跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_012(self):
        """
        小费类型为Consumer Input,主扫不可用,被扫可用,不输入金额,Toast提示
        """
        outtipooptionsid = None
        outoptiontext = 'Consumer Input'
        outpretext = 'Consumer Input'
        outbeisaoid = None
        outzhusaoid = None
        outfixedfeeinputid = None
        outfixedfeeinputtext = None
        outfixedfeeconfirmid = None
        outpercentagefeeinputid = None
        outpercentagefeeinputtext = None
        outpercentagefeeconfirmid = None
        outmoneyinputid = None
        outmoneyinputtext = None
        outpretoastmessage = 'The amount cannot be empty'

        self.define_tips(outoptiontext=outoptiontext,
                         outpretext=outpretext,
                         outpretoastmessage=outpretoastmessage)
        print(
            "小费选项为‘Consumer Input’时,主扫不可用,被扫可用.不输入金额,点击被扫,Toast提示‘The amount cannot be empty’.---测试通过"
        )

    @unittest.skip('test_013')  # 跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_013(self):
        """
        小费类型为Fixed Fee,主扫不可用,被扫可用,不输入金额,Toast提示
        """
        outtipooptionsid = None
        outoptiontext = 'Fixed Fee'
        outfixedfeeinputid = None
        outfixedfeeinputtext = '10000'
        outfixedfeeconfirmid = None
        outpercentagefeeinputid = None
        outpercentagefeeinputtext = None
        outpercentagefeeconfirmid = None
        outpretext = 'Rp.%s' % outfixedfeeinputtext
        outbeisaoid = None
        outzhusaoid = None
        outmoneyinputid = None
        outmoneyinputtext = None
        outpretoastmessage = 'The amount cannot be empty'

        self.define_tips(outoptiontext=outoptiontext,
                         outfixedfeeinputtext=outfixedfeeinputtext,
                         outpretext=outpretext,
                         outpretoastmessage=outpretoastmessage)
        print(
            "小费选项为‘Fixed Fee’时,主扫不可用,被扫可用.不输入金额,点击被扫,Toast提示‘The amount cannot be empty’.---测试通过"
        )

    @unittest.skip('test_014')  # 跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_014(self):
        """
        小费类型为Percentage Fee,主扫不可用,被扫可用,不输入金额,Toast提示
        """
        outtipooptionsid = None
        outoptiontext = 'Percentage Fee'
        outfixedfeeinputid = None
        outfixedfeeinputtext = None
        outfixedfeeconfirmid = None
        outpercentagefeeinputid = None
        outpercentagefeeinputtext = '10'
        outpercentagefeeconfirmid = None
        outpretext = '%s%%' % outpercentagefeeinputtext
        outbeisaoid = None
        outzhusaoid = None
        outmoneyinputid = None
        outmoneyinputtext = None
        outpretoastmessage = 'The amount cannot be empty'

        self.define_tips(outoptiontext=outoptiontext,
                         outpercentagefeeinputtext=outpercentagefeeinputtext,
                         outpretext=outpretext,
                         outpretoastmessage=outpretoastmessage)
        print(
            "小费选项为‘Percentage Fee’时,主扫不可用,被扫可用.不输入金额,点击被扫,Toast提示‘The amount cannot be empty’.---测试通过"
        )

    @unittest.skip('test_015')  # 跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_015(self):
        """
        小费类型为Cancel,主扫和被扫状态不变,不输入金额,Toast提示
        """
        outtipooptionsid = None
        outoptiontext = 'com.ahdi.qrindo.merchant:id/btn_back'
        outfixedfeeinputid = None
        outfixedfeeinputtext = None
        outfixedfeeconfirmid = None
        outpercentagefeeinputid = None
        outpercentagefeeinputtext = None
        outpercentagefeeconfirmid = None
        outpretext = None
        outbeisaoid = None
        outzhusaoid = None
        outmoneyinputid = None
        outmoneyinputtext = None
        outpretoastmessage = 'The amount cannot be empty'

        self.define_tips(outoptiontext=outoptiontext,
                         outpretoastmessage=outpretoastmessage)
        print(
            "小费选项为‘Cancel’时,主扫与被扫保持原有状态不变.不输入金额,点击被扫,Toast提示‘The amount cannot be empty’.---测试通过"
        )

    @unittest.skip('test_021')  # 跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_021(self):
        """
        无小费时,主扫和被扫都可用,输入金额,跳转到二维码页面
        """
        outtipooptionsid = None
        outoptiontext = None
        outpretext = None
        outbeisaoid = None
        outzhusaoid = None
        outfixedfeeinputid = None
        outfixedfeeinputtext = None
        outfixedfeeconfirmid = None
        outpercentagefeeinputid = None
        outpercentagefeeinputtext = None
        outpercentagefeeconfirmid = None
        outmoneyinputid = None
        outmoneyinputtext = '1001000'
        outpretoastmessage = None

        self.define_tips(outmoneyinputtext=outmoneyinputtext)
        print("小费选项为‘No Tips’时,主扫和被扫都可用.输入金额,点击被扫,跳转到二维码页面.---测试通过")

    @unittest.skip('test_022')  # 跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_022(self):
        """
        小费类型为Consumer Input,主扫不可用,被扫可用,输入金额,跳转到二维码页面
        """
        outtipooptionsid = None
        outoptiontext = 'Consumer Input'
        outpretext = 'Consumer Input'
        outbeisaoid = None
        outzhusaoid = None
        outfixedfeeinputid = None
        outfixedfeeinputtext = None
        outfixedfeeconfirmid = None
        outpercentagefeeinputid = None
        outpercentagefeeinputtext = None
        outpercentagefeeconfirmid = None
        outmoneyinputid = None
        outmoneyinputtext = '1000'
        outpretoastmessage = None

        self.define_tips(outoptiontext=outoptiontext,
                         outpretext=outpretext,
                         outmoneyinputtext=outmoneyinputtext)
        print("小费选项为‘Consumer Input’时,主扫不可用,被扫可用.输入金额,点击被扫,跳转到二维码页面.---测试通过")

    @unittest.skip('test_023')  # 跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_023(self):
        """
        小费类型为Fixed Fee,主扫不可用,被扫可用,输入金额,跳转到二维码页面
        """
        outtipooptionsid = None
        outoptiontext = 'Fixed Fee'
        outfixedfeeinputid = None
        outfixedfeeinputtext = '100'
        outfixedfeeconfirmid = None
        outpercentagefeeinputid = None
        outpercentagefeeinputtext = None
        outpercentagefeeconfirmid = None
        outpretext = 'Rp.%s' % outfixedfeeinputtext
        outbeisaoid = None
        outzhusaoid = None
        outmoneyinputid = None
        outmoneyinputtext = '1000'
        outpretoastmessage = None

        self.define_tips(outoptiontext=outoptiontext,
                         outfixedfeeinputtext=outfixedfeeinputtext,
                         outpretext=outpretext,
                         outmoneyinputtext=outmoneyinputtext)
        print("小费选项为‘Fixed Fee’时,主扫不可用,被扫可用.输入金额,点击被扫,跳转到二维码页面.---测试通过")

    @unittest.skip('test_024')  # 跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_024(self):
        """
        小费类型为Percentage Fee,主扫不可用,被扫可用,输入金额,跳转到二维码页面
        """
        outtipooptionsid = None
        outoptiontext = 'Percentage Fee'
        outfixedfeeinputid = None
        outfixedfeeinputtext = None
        outfixedfeeconfirmid = None
        outpercentagefeeinputid = None
        outpercentagefeeinputtext = '10'
        outpercentagefeeconfirmid = None
        outpretext = '%s%%' % outpercentagefeeinputtext
        outbeisaoid = None
        outzhusaoid = None
        outmoneyinputid = None
        outmoneyinputtext = '1000'
        outpretoastmessage = None

        self.define_tips(outoptiontext=outoptiontext,
                         outpercentagefeeinputtext=outpercentagefeeinputtext,
                         outpretext=outpretext,
                         outmoneyinputtext=outmoneyinputtext)
        print("小费选项为‘Percentage Fee’时,主扫不可用,被扫可用.输入金额,点击被扫,跳转到二维码页面.---测试通过")

    @unittest.skip('test_025')  # 跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_025(self):
        """
        小费类型为Cancel,主扫和被扫状态不变,输入金额,跳转到二维码页面
        """
        outtipooptionsid = None
        outoptiontext = 'com.ahdi.qrindo.merchant:id/btn_back'
        outfixedfeeinputid = None
        outfixedfeeinputtext = None
        outfixedfeeconfirmid = None
        outpercentagefeeinputid = None
        outpercentagefeeinputtext = None
        outpercentagefeeconfirmid = None
        outpretext = None
        outbeisaoid = None
        outzhusaoid = None
        outmoneyinputid = None
        outmoneyinputtext = '1000'
        outpretoastmessage = None

        self.define_tips(outoptiontext=outoptiontext,
                         outmoneyinputtext=outmoneyinputtext)
        print("小费选项为‘Cancel’时,主扫与被扫保持原有状态不变.输入金额,点击被扫,跳转到二维码页面.---测试通过")