Пример #1
0
 def setUp(self):  #每条用例执行测试之前都要执行此方法
     self.forgetpasswordpage = ForgetPasswordPage()  # 实例化
     self.activeweb = ActiveWeb()  #实例化
     url = "https://bjw.halodigit.com:9090/nereus/manager/retrive"  #管理后台
     # url = "https://bjw.halodigit.com:9090/nereus/agent/index#/login"
     self.activeweb.getUrl(url)  #启动web
     self.activeweb.delayTime(10)
Пример #2
0
class LoginPageAgentFun:
    def __init__(self):
        self.activeweb = ActiveWeb()  #实例化
        self.loginpage = LoginPage()  #实例化

    def checkResult(self, result, preresult):
        """
        实际结果与预期结果比较
        """
        if result == preresult:
            self.activeweb.printgreenword()
            print("测试通过")
            self.activeweb.printnormalword()
        else:
            self.activeweb.printredword()
            print("测试失败,失败描述:实际结果为%s,与预期结果%s不一致" % (result, preresult))
            self.activeweb.printnormalword()

    def checkTextEle(self, checkele, preresult):
        """
        页面text文本内容检查
        """
        result = self.activeweb.findElementByXpathAndReturnText(checkele)
        self.checkResult(result, preresult)

    def checkValueEle(self, checkele, checkvalue, preresult):
        """
        页面输入框默认内容检查
        """
        result = self.activeweb.findElementByXpathAndReturnValue(
            checkele, checkvalue)
        self.checkResult(result, preresult)
Пример #3
0
    def setUp(self):  #每条用例执行测试之前都要执行此方法
        self.activeweb = ActiveWeb()  #实例化
        self.loginpage = LoginPage()  #实例化

        url = "https://bjw.halodigit.com:9090/nereus/agent/index#/login"  #商户后台
        # url = "https://m-mbmpay.ahdipay.com/nereus/agent/index"   #现网
        self.activeweb.getUrl(url)  #打开网址
Пример #4
0
 def setUp(self):   #每条用例执行测试之前都要执行此方法
     self.loginpage = LoginPage()  # 实例化
     self.activeweb = ActiveWeb()   #实例化
     url = "https://bjw.halodigit.com:9090/nereus/manager/index"   #管理后台
     # url = "https://bjw.halodigit.com:9090/nereus/agent/index#/login"
     self.activeweb.getUrl(url)   #启动web
     self.activeweb.delayTime(10)
 def setUp(self):  # 每条用例执行测试之前都要执行此方法
     self.jsonfile = '../dataconfig/cookieagent.json'
     self.operationjson = OperationJson(file_path=self.jsonfile)  #实例化
     self.cookie = self.operationjson.get_all_data()
     print("self.cookie:%s" % self.cookie)
     self.activeweb = ActiveWeb()  # 实例化
     self.loginurl = "https://bjw.halodigit.com:9090/nereus/agent/index"
Пример #6
0
 def __init__(self):
     self.activeweb = ActiveWeb()  # 实例化
     self.loginurl = "https://bjw.halodigit.com:9090/nereus/manager/index#/login"
     self.loginaccountxpath = "/html/body/div[1]/div[2]/form/div/div[1]/input"
     self.loginaccount = "*****@*****.**"
     self.loginppasswordxpath = "/html/body/div[1]/div[2]/form/div/div[2]/input"
     self.loginpassword = "******"
     self.loginbuttonxpath = "/html/body/div[1]/div[2]/form/div/a[1]/span"
     self.cookie = self.getcookie()
Пример #7
0
    def __init__(self,
                 outjsonfile=None,
                 outloginurl=None,
                 outloginaccountxpath=None,
                 outloginaccounttext=None,
                 outloginppasswordxpath=None,
                 outloginpasswordtext=None,
                 outloginbuttonxpath=None):

        if outjsonfile == None:
            self.jsonfile = '../dataconfig/cookie.json'
        else:
            self.jsonfile = outjsonfile

        if outloginurl == None:
            self.loginurl = "https://bjw.halodigit.com:9090/nereus/manager/index#/login"
        else:
            self.loginurl = outloginurl

        if outloginaccountxpath == None:
            self.loginaccountxpath = "/html/body/div[1]/div[2]/form/div/div[1]/input"
        else:
            self.loginaccountxpath = outloginaccountxpath

        if outloginaccounttext == None:
            self.loginaccount = "*****@*****.**"
        else:
            self.loginaccount = outloginaccounttext

        if outloginppasswordxpath == None:
            self.loginppasswordxpath = "/html/body/div[1]/div[2]/form/div/div[2]/input"
        else:
            self.loginppasswordxpath = outloginppasswordxpath

        if outloginpasswordtext == None:
            self.loginpassword = "******"
        else:
            self.loginpassword = outloginpasswordtext

        if outloginbuttonxpath == None:
            self.loginbuttonxpath = "/html/body/div[1]/div[2]/form/div/a[1]/span"
        else:
            self.loginbuttonxpath = outloginbuttonxpath

        self.operationjson = OperationJson(file_path=self.jsonfile)  #实例化
        self.activeweb = ActiveWeb()  # 实例化
Пример #8
0
    def setUp(self):  #每条用例执行测试之前都要执行此方法
        self.activeweb = ActiveWeb()  #实例化
        self.loginpage = LoginPage()  #实例化
        self.addmerchantpage = AddMerchantPage()  # 实例化
        self.addmerchantdonepage = AddMerchantDonePage()  #实例化
        self.addmerchantpagecompany = AddMerchantPageCompany()  #实例化

        url = "https://bjw.halodigit.com:9090/nereus/agent/index"  #代理商后台
        # url = "https://m-mbmpay.ahdipay.com/nereus/agent/index"   #现网
        self.activeweb.getUrl(url)  #打开网址
        self.activeweb.findElementByXpathAndInput(self.loginpage.account,
                                                  "6281122336666")
        self.activeweb.findElementByXpathAndInput(self.loginpage.password,
                                                  "abc123456")
        # self.activeweb.findElementByXpathAndInput(self.loginpage.account,"6281285610481")    #现网
        # self.activeweb.findElementByXpathAndInput(self.loginpage.password, "abc123456")   #现网
        self.activeweb.findElementByXpathAndClick(self.loginpage.loginbutton)
        self.activeweb.delayTime(3)
        self.activeweb.findElementByXpathAndClick(
            "/html/body/div[3]/div[1]/div/ul/li/ul/li/a[2]")  #点击"Add merchant"
        self.activeweb.delayTime(3)
Пример #9
0
    def getcookie(self):
        # 登录
        self.activeweb = ActiveWeb()  # 实例化
        self.loginurl = "https://bjw.halodigit.com:9090/nereus/manager/index#/login"
        self.loginaccountxpath = "/html/body/div[1]/div[2]/form/div/div[1]/input"
        self.loginaccount = "*****@*****.**"
        self.loginppasswordxpath = "/html/body/div[1]/div[2]/form/div/div[2]/input"
        self.loginpassword = "******"
        self.loginbuttonxpath = "/html/body/div[1]/div[2]/form/div/a[1]/span"

        self.activeweb.getUrl(self.loginurl)  # 打开网址
        self.activeweb.findElementByXpathAndInput(self.loginaccountxpath,
                                                  self.loginaccount)
        self.activeweb.findElementByXpathAndInput(self.loginppasswordxpath,
                                                  self.loginpassword)
        self.activeweb.findElementByXpathAndClick(self.loginbuttonxpath)
        self.activeweb.delayTime(3)
        # 获取cookie
        cookie = self.activeweb.getCookies()
        self.activeweb.closeBrowse()
        return cookie
Пример #10
0
class Test(unittest.TestCase):  #创建测试类
    @classmethod  #类方法,只执行一次,但必须要加注解@classmethod,且名字固定为setUpClass
    def setUpClass(cls):
        pass

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

    def setUp(self):  #每条用例执行测试之前都要执行此方法
        self.activeweb = ActiveWeb()  #实例化
        self.loginpage = LoginPage()  #实例化

        url = "https://bjw.halodigit.com:9090/nereus/agent/index#/login"  #商户后台
        # url = "https://m-mbmpay.ahdipay.com/nereus/agent/index"   #现网
        self.activeweb.getUrl(url)  #打开网址
        # self.activeweb.findElementByXpathAndInput(self.loginpage.account,"6281122336666")
        # self.activeweb.findElementByXpathAndInput(self.loginpage.password, "abc123456")
        # # self.activeweb.findElementByXpathAndInput(self.loginpage.account,"6281285610481")    #现网
        # # self.activeweb.findElementByXpathAndInput(self.loginpage.password, "abc123456")   #现网
        # self.activeweb.findElementByXpathAndClick(self.loginpage.loginbutton)
        # self.activeweb.delayTime(3)

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

    @unittest.skip('test_01')  #跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_01(self):  #登录页登录title检查
        """
        登录页登录title检查
        """
        logintitle = self.activeweb.findElementByXpathAndReturnText(
            0, self.loginpage.logintitle)
        print('实际结果:', logintitle)
        prelogintitle = "LOGIN"
        self.assertEqual(logintitle, prelogintitle)

    @unittest.skip('test_02')  # 跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_02(self):  #登录页账号输入框默认文字检查
        """
        登录页账号输入框默认文字检查
        """
        account = self.activeweb.findElementByXpathAndReturnValue(
            self.loginpage.account, "placeholder")
        print('实际结果:', account)
        preaccount = "QR Account number"
        self.assertEqual(account, preaccount)

    @unittest.skip('test_03')  # 跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_03(self):  #登录页密码输入框默认文字检查
        """
        登录页密码输入框默认文字检查
        """
        password = self.activeweb.findElementByXpathAndReturnValue(
            self.loginpage.password, "placeholder")
        print('实际结果:', password)
        prepassword = "******"
        self.assertEqual(password, prepassword)

    @unittest.skip('test_04')  # 跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_04(self):  #登录页登录账号输入为空时的文字提示
        """
        登录页登录账号输入为空时的文字提示
        """
        self.activeweb.findElementByXpathAndClick(self.loginpage.account)
        self.activeweb.delayTime(3)
        self.activeweb.findElementByXpathAndClick(self.loginpage.password)
        self.activeweb.delayTime(3)
        self.activeweb.findElementByXpathAndClick(self.loginpage.account)
        self.activeweb.delayTime(3)
        accounttip = self.activeweb.findElementByXpathAndReturnText(
            0, self.loginpage.accounttip)
        print('实际结果:', accounttip)
        preaccounttip = "This option cannot be empty"
        self.assertEqual(accounttip, preaccounttip)

    @unittest.skip('test_05')  # 跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_05(self):  #登录页登录密码输入为空时的文字提示
        """
        登录页登录密码输入为空时的文字提示
        """
        self.activeweb.findElementByXpathAndClick(self.loginpage.account)
        self.activeweb.delayTime(3)
        self.activeweb.findElementByXpathAndClick(self.loginpage.password)
        self.activeweb.delayTime(3)
        self.activeweb.findElementByXpathAndClick(self.loginpage.account)
        self.activeweb.delayTime(3)
        passwordtip = self.activeweb.findElementByXpathAndReturnText(
            0, self.loginpage.passwordtip)
        print('实际结果:', passwordtip)
        prepasswordtip = "This option cannot be empty"
        self.assertEqual(passwordtip, prepasswordtip)

    @unittest.skip('test_07')
    def test_07(self):  #登录页,账号长度小于10位提示
        """
        登录页,账号长度小于10位提示
        """
        self.activeweb.findElementByXpathAndInput(self.loginpage.account,
                                                  "123456789")
        self.activeweb.findElementByXpathAndClick(self.loginpage.password)
        self.activeweb.delayTime(3)
        passwordtip = self.activeweb.findElementByXpathAndReturnText(
            0, self.loginpage.accounttip)
        print('实际结果:', passwordtip)
        prepasswordtip = "The length cannot be less than10"
        self.assertEqual(passwordtip, prepasswordtip)

    @unittest.skip('test_07')
    def test_08(self):  #登录页,账号长度大于15位提示
        """
        登录页,账号长度大于15位提示
        """
        self.activeweb.findElementByXpathAndInput(self.loginpage.account,
                                                  "1234567890123456")
        self.activeweb.findElementByXpathAndClick(self.loginpage.password)
        self.activeweb.delayTime(3)
        passwordtip = self.activeweb.findElementByXpathAndReturnText(
            0, self.loginpage.accounttip)
        print('实际结果:', passwordtip)
        prepasswordtip = "The length cannot be more than15"
        self.assertEqual(passwordtip, prepasswordtip)

    @unittest.skip('test_09')
    def test_09(self):  #登录页,密码长度小于6位提示
        """
        登录页,密码长度小于6位提示
        :return:
        """
        self.activeweb.findElementByXpathAndInput(self.loginpage.password,
                                                  "12345")
        self.activeweb.findElementByXpathAndClick(self.loginpage.account)
        self.activeweb.delayTime(3)
        passwordtip = self.activeweb.findElementByXpathAndReturnText(
            0, self.loginpage.accounttip)
        print('实际结果:', passwordtip)
        prepasswordtip = "The length cannot be less than6"
        self.assertEqual(passwordtip, prepasswordtip)

    @unittest.skip('test_10')
    def test_10(self):  #登录页,密码长度大于24位提示
        """
        登录页,密码长度大于16位提示
        """
        self.activeweb.findElementByXpathAndInput(self.loginpage.password,
                                                  "1234567890123456789012345")
        self.activeweb.findElementByXpathAndClick(self.loginpage.account)
        self.activeweb.delayTime(3)
        passwordtip = self.activeweb.findElementByXpathAndReturnText(
            0, self.loginpage.accounttip)
        print('实际结果:', passwordtip)
        prepasswordtip = "The length cannot be more than24"
        self.assertEqual(passwordtip, prepasswordtip)

    @unittest.skip('test_11')
    def test_11(self):  #登录页,账号与密码错误时,点击登录,账号密码错误提示
        """
        登录页,账号与密码错误时,点击登录,账号密码错误提示
        """
        self.activeweb.findElementByXpathAndInput(self.loginpage.account,
                                                  "12345678901")
        self.activeweb.findElementByXpathAndInput(self.loginpage.password,
                                                  "123456")
        self.activeweb.findElementByXpathAndClick(self.loginpage.loginbutton)
        self.activeweb.delayTime(5)
        logintip = self.activeweb.findElementByXpathAndReturnText(
            0, self.loginpage.logintip)
        print('实际结果:', logintip)
        prelogintip = "Incorrect account or password"
        self.assertEqual(logintip, prelogintip)

    @unittest.skip('test_12')
    def test_12(self):  #登录页,账号与密码错误时,点击登录,出现验证码提示
        """
        登录页,账号与密码错误时,点击登录,出现验证码提示
        """
        self.activeweb.findElementByXpathAndInput(self.loginpage.account,
                                                  "12345678901")
        self.activeweb.findElementByXpathAndInput(self.loginpage.password,
                                                  "123456")
        self.activeweb.findElementByXpathAndClick(self.loginpage.loginbutton)
        self.activeweb.delayTime(5)
        logintip = self.activeweb.findElementByXpathAndReturnValue(
            self.loginpage.vercode, "placeholder")
        print('实际结果:', logintip)
        prelogintip = "Verification code"
        self.assertEqual(logintip, prelogintip)

    @unittest.skip('test_13')
    def test_13(self):  #登录页,账号与密码错误时,点击登录,验证码输入内容为空时提示
        """
        登录页,账号与密码错误时,点击登录,验证码输入内容为空时提示
        """
        self.activeweb.findElementByXpathAndInput(self.loginpage.account,
                                                  "12345678901")
        self.activeweb.findElementByXpathAndInput(self.loginpage.password,
                                                  "123456")
        self.activeweb.findElementByXpathAndClick(self.loginpage.loginbutton)
        self.activeweb.delayTime(5)
        self.activeweb.findElementByXpathAndClick(self.loginpage.vercode)
        self.activeweb.findElementByXpathAndClick(self.loginpage.account)
        vercodetip = self.activeweb.findElementByXpathAndReturnText(
            0, self.loginpage.accounttip)
        print('实际结果:', vercodetip)
        prevercodetip = "This option cannot be empty"
        self.assertEqual(vercodetip, prevercodetip)

    @unittest.skip('test_14')
    def test_14(self):  #登录页,账号与密码输入,输入错误的验证码,点击登录,验证码输入错误提示
        """
        登录页,账号与密码输入,输入错误的验证码,点击登录,验证码输入错误提示
        """
        self.activeweb.findElementByXpathAndInput(self.loginpage.account,
                                                  "12345678901")
        self.activeweb.findElementByXpathAndInput(self.loginpage.password,
                                                  "123456")
        self.activeweb.findElementByXpathAndClick(self.loginpage.loginbutton)
        self.activeweb.delayTime(5)
        self.activeweb.findElementByXpathAndInput(self.loginpage.password,
                                                  "123456")
        self.activeweb.findElementByXpathAndInput(self.loginpage.vercode,
                                                  "1234")
        self.activeweb.findElementByXpathAndClick(self.loginpage.loginbutton)
        self.activeweb.delayTime(5)
        vercodetip = self.activeweb.findElementByXpathAndReturnText(
            0, self.loginpage.logintip)
        print('实际结果:', vercodetip)
        prevercodetip = "Incorrect validation code"
        self.assertEqual(vercodetip, prevercodetip)

    # @unittest.skip('test_15')
    def test_15(self):  #点击验证码判断验证码是否更新
        """
        点击验证码判断验证码是否更新
        """
        self.activeweb.findElementByXpathAndInput(self.loginpage.account,
                                                  "12345678901")
        self.activeweb.findElementByXpathAndInput(self.loginpage.password,
                                                  "123456")
        self.activeweb.findElementByXpathAndClick(self.loginpage.loginbutton)
        self.activeweb.delayTime(5)
        codetext = self.activeweb.getcodetext(self.loginpage.code)
        print("验证码1:", codetext)
        self.activeweb.findElementByXpathAndClick(self.loginpage.code)
        self.activeweb.delayTime(3)
        codetext2 = self.activeweb.getcodetext(self.loginpage.code)
        print("验证码2:", codetext2)
        self.assertNotEqual(codetext, codetext2)

    @unittest.skip('test_16')
    def test_16(self):  #非代理商的正确的钱包账号登录提示
        """
        点击验证码判断验证码是否更新
        """
        self.activeweb.findElementByXpathAndInput(self.loginpage.account,
                                                  "6281122337788")
        self.activeweb.findElementByXpathAndInput(self.loginpage.password,
                                                  "a123456")
        self.activeweb.findElementByXpathAndClick(self.loginpage.loginbutton)
        self.activeweb.delayTime(5)
        logintip = self.activeweb.findElementByXpathAndReturnText(
            0, self.loginpage.logintip)
        prelogintip = "You are not AHDI agent"
        self.assertEqual(logintip, prelogintip)
Пример #11
0
 def __init__(self):
     self.activeweb = ActiveWeb()  #实例化
     self.loginpage = LoginPage()  #实例化
Пример #12
0
 def setUp(self):  #每条用例执行测试之前都要执行此方法
     self.qrcodelistpage = QrcodeListPage()  # 实例化
     #登录
     self.activeweb = ActiveWeb()  #实例化
     url = "https://bjw.halodigit.com:9090/nereus/manager/index#/biz/mer/mer/qrcode/mer/qrcode/list"  #管理后台二维码列表页
     self.activeweb.writerCookies(cookie, loginurl, url)  #启动web
class TestChangePasswordPage(unittest.TestCase):  #创建测试类
    # def __init__(self):
    #     self.changepasswordpage = LoginPage()  #实例化

    loginmanager = LoginManager()  #实例化
    global cookie
    global loginurl
    cookie = loginmanager.cookie
    loginurl = loginmanager.loginurl

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

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

    def setUp(self):  #每条用例执行测试之前都要执行此方法
        self.changepasswordpage = ChangePasswordPage()  # 实例化
        #登录
        self.activeweb = ActiveWeb()  #实例化
        url = "https://bjw.halodigit.com:9090/nereus/manager/index#/account/changePwd"  #管理后台修改密码页面
        self.activeweb.writerCookies(cookie, loginurl, url)  #启动web

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

    @unittest.skip('test_01')  #跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_01(self):  #修改密码页title检查
        """
        修改密码页title检查
        """
        changepasswordtitle = self.activeweb.findElementByXpathAndReturnText(
            0, self.changepasswordpage.changepaswordtitle)
        print('实际结果:', changepasswordtitle)
        prechangepasswordtitle = "Change password"
        self.assertEqual(changepasswordtitle, prechangepasswordtitle)

    @unittest.skip('test_02')  # 跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_02(self):  #修改密码页原密码输入框默认文字显示检查
        """
        修改密码页原密码输入框默认文字显示检查
        """
        currentpassword = self.activeweb.findElementByXpathAndReturnValue(
            self.changepasswordpage.currentpasswordinput, "placeholder")
        print('实际结果:', currentpassword)
        precurrentpassword = "******"
        self.assertEqual(currentpassword, precurrentpassword)

    @unittest.skip('test_03')  # 跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_03(self):  #修改密码页新密码输入框默认文字显示检查
        """
        修改密码页新密码输入框默认文字显示检查
        """
        newpassword = self.activeweb.findElementByXpathAndReturnValue(
            self.changepasswordpage.newpasswordinput, "placeholder")
        print('实际结果:', newpassword)
        prenewpassword = "******"
        self.assertEqual(newpassword, prenewpassword)

    @unittest.skip('test_04')  # 跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_04(self):  #修改密码页确认密码输入框默认文字显示检查
        """
        修改密码页确认密码输入框默认文字显示检查
        """
        confirmpassword = self.activeweb.findElementByXpathAndReturnValue(
            self.changepasswordpage.confirmpasswordinput, "placeholder")
        print('实际结果:', confirmpassword)
        preconfirmpassword = "******"
        self.assertEqual(confirmpassword, preconfirmpassword)

    @unittest.skip('test_05')  # 跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_05(self):  #修改密码页原密码输入为空时的文字提示
        """
        修改密码页原密码输入为空时的文字提示
        """
        self.activeweb.findElementByXpathAndClick(
            self.changepasswordpage.currentpasswordinput)
        self.activeweb.delayTime(3)
        self.activeweb.findElementByXpathAndClick(
            self.changepasswordpage.newpasswordinput)
        self.activeweb.delayTime(3)
        self.activeweb.findElementByXpathAndClick(
            self.changepasswordpage.currentpasswordinput)
        self.activeweb.delayTime(3)
        accounttip = self.activeweb.findElementByXpathAndReturnText(
            0, self.changepasswordpage.currentpasswordtip)
        print('实际结果:', accounttip)
        preaccounttip = "This option cannot be empty"
        self.assertEqual(accounttip, preaccounttip)

    @unittest.skip('test_06')  # 跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_06(self):  #修改密码页新密码输入为空时的文字提示
        """
        修改密码页原密码输入为空时的文字提示
        """
        self.activeweb.findElementByXpathAndClick(
            self.changepasswordpage.currentpasswordinput)
        self.activeweb.delayTime(3)
        self.activeweb.findElementByXpathAndClick(
            self.changepasswordpage.newpasswordinput)
        self.activeweb.delayTime(3)
        self.activeweb.findElementByXpathAndClick(
            self.changepasswordpage.currentpasswordinput)
        self.activeweb.delayTime(3)
        accounttip = self.activeweb.findElementByXpathAndReturnText(
            0, self.changepasswordpage.newpasswordtip)
        print('实际结果:', accounttip)
        preaccounttip = "This option cannot be empty"
        self.assertEqual(accounttip, preaccounttip)

    @unittest.skip('test_07')  # 跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_07(self):  #修改密码页确认密码输入为空时的文字提示
        """
        修改密码页确认密码输入为空时的文字提示
        """
        self.activeweb.findElementByXpathAndClick(
            self.changepasswordpage.confirmpasswordinput)
        self.activeweb.delayTime(3)
        self.activeweb.findElementByXpathAndClick(
            self.changepasswordpage.newpasswordinput)
        self.activeweb.delayTime(3)
        accounttip = self.activeweb.findElementByXpathAndReturnText(
            0, self.changepasswordpage.confirmpasswordtip)
        print('实际结果:', accounttip)
        preaccounttip = "This option cannot be empty"
        self.assertEqual(accounttip, preaccounttip)

    @unittest.skip('test_08')
    def test_08(self):  #修改密码页原密码输入少于6位提示
        """
        修改密码页原密码输入少于6位提示
        """
        self.activeweb.findElementByXpathAndInput(
            self.changepasswordpage.currentpasswordinput, "12345")
        self.activeweb.findElementByXpathAndClick(
            self.changepasswordpage.newpasswordinput)
        self.activeweb.delayTime(5)
        currentpasswordtip = self.activeweb.findElementByXpathAndReturnText(
            0, self.changepasswordpage.currentpasswordtip)
        print('实际结果:', currentpasswordtip)
        precurrentpasswordtip = "The length cannot be less than6"
        self.assertEqual(currentpasswordtip, precurrentpasswordtip)

    @unittest.skip('test_09')
    def test_09(self):  #修改密码页原密码输入大于16位提示
        """
        修改密码页原密码输入大于16位提示
        """
        self.activeweb.findElementByXpathAndInput(
            self.changepasswordpage.currentpasswordinput, "12345678901234567")
        self.activeweb.findElementByXpathAndClick(
            self.changepasswordpage.newpasswordinput)
        self.activeweb.delayTime(5)
        currentpasswordtip = self.activeweb.findElementByXpathAndReturnText(
            0, self.changepasswordpage.currentpasswordtip)
        print('实际结果:', currentpasswordtip)
        precurrentpasswordtip = "The length cannot be more than16"
        self.assertEqual(currentpasswordtip, precurrentpasswordtip)

    @unittest.skip('test_10')
    def test_10(self):  #修改密码页新密码输入少于6位提示
        """
        修改密码页新密码输入少于6位提示
        """
        self.activeweb.findElementByXpathAndInput(
            self.changepasswordpage.newpasswordinput, "12345")
        self.activeweb.findElementByXpathAndClick(
            self.changepasswordpage.confirmpasswordinput)
        self.activeweb.delayTime(5)
        newpasswordtip = self.activeweb.findElementByXpathAndReturnText(
            0, self.changepasswordpage.newpasswordtip)
        print('实际结果:', newpasswordtip)
        prenewpasswordtip = "The length cannot be less than6"
        self.assertEqual(newpasswordtip, prenewpasswordtip)

    @unittest.skip('test_11')
    def test_11(self):  #修改密码页新密码输入大于16位提示
        """
        修改密码页新密码输入大于16位提示
        """
        self.activeweb.findElementByXpathAndInput(
            self.changepasswordpage.newpasswordinput, "12345678901234567")
        self.activeweb.findElementByXpathAndClick(
            self.changepasswordpage.confirmpasswordinput)
        self.activeweb.delayTime(5)
        newpasswordtip = self.activeweb.findElementByXpathAndReturnText(
            0, self.changepasswordpage.newpasswordtip)
        print('实际结果:', newpasswordtip)
        prenewpasswordtip = "The length cannot be more than16"
        self.assertEqual(newpasswordtip, prenewpasswordtip)

    @unittest.skip('test_12')
    def test_12(self):  #修改密码页确认密码输入框提示
        """
        修改密码页确认密码输入框提示
        """
        self.activeweb.findElementByXpathAndInput(
            self.changepasswordpage.confirmpasswordinput, "1")
        self.activeweb.findElementByXpathAndClick(
            self.changepasswordpage.newpasswordinput)
        self.activeweb.delayTime(5)
        confirmpasswordtip = self.activeweb.findElementByXpathAndReturnText(
            0, self.changepasswordpage.confirmpasswordtip)
        print('实际结果:', confirmpasswordtip)
        preconfirmpasswordtip = "New password entered inconsistently"
        self.assertEqual(confirmpasswordtip, preconfirmpasswordtip)

    @unittest.skip('test_13')
    def test_13(self):  #修改密码成功
        """
        修改密码页修改密码成功
        """
        self.activeweb.findElementByXpathAndInput(
            self.changepasswordpage.currentpasswordinput, "123456")
        self.activeweb.findElementByXpathAndInput(
            self.changepasswordpage.newpasswordinput, "123456")
        self.activeweb.findElementByXpathAndInput(
            self.changepasswordpage.confirmpasswordinput, "123456")
        self.activeweb.findElementByXpathAndClick(
            self.changepasswordpage.submintbutton)
        self.activeweb.delayTime(5)
        currentpassword = self.activeweb.findElementByXpathAndReturnValue(
            self.changepasswordpage.currentpasswordinput, "placeholder")
        newpassword = self.activeweb.findElementByXpathAndReturnValue(
            self.changepasswordpage.newpasswordinput, "placeholder")
        confirmpassword = self.activeweb.findElementByXpathAndReturnValue(
            self.changepasswordpage.confirmpasswordinput, "placeholder")
        print('实际结果:', currentpassword)
        pre = "Please key in..."
        self.assertEqual(currentpassword, pre)
        self.assertEqual(newpassword, pre)
        self.assertEqual(confirmpassword, pre)
Пример #14
0
class TestForgetPasswordPage(unittest.TestCase):  #创建测试类
    # def __init__(self):
    #     self.forgetpasswordpage = LoginPage()  #实例化

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

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

    def setUp(self):  #每条用例执行测试之前都要执行此方法
        self.forgetpasswordpage = ForgetPasswordPage()  # 实例化
        self.activeweb = ActiveWeb()  #实例化
        url = "https://bjw.halodigit.com:9090/nereus/manager/retrive"  #管理后台
        # url = "https://bjw.halodigit.com:9090/nereus/agent/index#/login"
        self.activeweb.getUrl(url)  #启动web
        self.activeweb.delayTime(10)

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

    @unittest.skip('test_01')  #跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_01(self):  #找回密码页找回密码框title检查
        """
        找回密码页找回密码框title检查
        """
        forgetpasswordtitle = self.activeweb.findElementByXpathAndReturnText(
            0, self.forgetpasswordpage.forgetpasswordtitle)
        print('实际结果:', forgetpasswordtitle)
        preforgetpasswordtitle = "Forget password"
        self.assertEqual(forgetpasswordtitle, preforgetpasswordtitle)

    @unittest.skip('test_02')  # 跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_02(self):  #找回密码页账号输入框默认文字检查
        """
        找回密码页账号输入框默认文字检查
        """
        account = self.activeweb.findElementByXpathAndReturnValue(
            self.forgetpasswordpage.account, "placeholder")
        print('实际结果:', account)
        preaccount = "Your Email address"
        self.assertEqual(account, preaccount)

    @unittest.skip('test_03')  # 跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_03(self):  #找回密码页账号输入为空时的文字提示
        """
        找回密码页账号输入为空时的文字提示
        """
        self.activeweb.findElementByXpathAndClick(
            self.forgetpasswordpage.account)
        self.activeweb.delayTime(3)
        self.activeweb.findElementByXpathAndClick(
            self.forgetpasswordpage.vercode)
        self.activeweb.delayTime(3)
        self.activeweb.findElementByXpathAndClick(
            self.forgetpasswordpage.account)
        self.activeweb.delayTime(3)
        accounttip = self.activeweb.findElementByXpathAndReturnText(
            0, self.forgetpasswordpage.accounttip)
        print('实际结果:', accounttip)
        preaccounttip = "This option cannot be empty"
        self.assertEqual(accounttip, preaccounttip)

    @unittest.skip('test_04')
    def test_04(self):  #找回密码页,验证码默认文字提示
        """
        找回密码页,验证码默认文字提示
        """
        vercodedisplay = self.activeweb.findElementByXpathAndReturnValue(
            self.forgetpasswordpage.vercode, "placeholder")
        print('实际结果:', vercodedisplay)
        prevercodedisplay = "Verification code"
        self.assertEqual(vercodedisplay, prevercodedisplay)

    @unittest.skip('test_05')
    def test_05(self):  #找回密码页,验证码输入内容为空时提示
        """
        找回密码页,验证码输入内容为空时提示
        """
        self.activeweb.findElementByXpathAndClick(
            self.forgetpasswordpage.vercode)
        self.activeweb.findElementByXpathAndClick(
            self.forgetpasswordpage.account)
        vercodetip = self.activeweb.findElementByXpathAndReturnText(
            0, self.forgetpasswordpage.accounttip)
        print('实际结果:', vercodetip)
        prevercodetip = "Please enter verification code"
        self.assertEqual(vercodetip, prevercodetip)

    @unittest.skip('test_06')
    def test_06(self):  #找回密码页,账号格式不是邮箱类型,不是类似1@1格式,123456,@,1@,@1,
        """
        找回密码页,账号格式不是邮箱类型,不是类似1@1格式,123456,@,1@,@1,
        """
        self.activeweb.findElementByXpathAndInput(
            self.forgetpasswordpage.account, "1")
        self.activeweb.findElementByXpathAndClick(
            self.forgetpasswordpage.vercode)
        self.activeweb.delayTime(3)
        accounttip = self.activeweb.findElementByXpathAndReturnText(
            0, self.forgetpasswordpage.accounttip)
        print('实际结果:', accounttip)
        preaccounttip = "Please enter the correct email address"
        self.assertEqual(accounttip, preaccounttip)

    @unittest.skip('test_07')
    def test_07(self):  #找回密码页,验证码输入长度小于4提示
        """
        找回密码页,验证码输入长度小于4提示
        """
        self.activeweb.findElementByXpathAndInput(
            self.forgetpasswordpage.vercode, "123")
        self.activeweb.findElementByXpathAndClick(
            self.forgetpasswordpage.account)
        self.activeweb.delayTime(5)
        codetip = self.activeweb.findElementByXpathAndReturnText(
            0, self.forgetpasswordpage.accounttip)
        print('实际结果:', codetip)
        precodetip = "The length cannot be less than4"
        self.assertEqual(codetip, precodetip)

    @unittest.skip('test_08')
    def test_08(self):  #找回密码页,验证码输入长度大于4提示
        """
        找回密码页,验证码输入长度大于4提示
        """
        self.activeweb.findElementByXpathAndInput(
            self.forgetpasswordpage.vercode, "12345")
        self.activeweb.findElementByXpathAndClick(
            self.forgetpasswordpage.account)
        self.activeweb.delayTime(5)
        codetip = self.activeweb.findElementByXpathAndReturnText(
            0, self.forgetpasswordpage.accounttip)
        print('实际结果:', codetip)
        precodetip = "The length cannot be more than4"
        self.assertEqual(codetip, precodetip)

    @unittest.skip('test_09')
    def test_09(self):  #找回密码页,验证码输入错误提示
        """
        找回密码页,验证码输入错误提示
        """
        self.activeweb.findElementByXpathAndInput(
            self.forgetpasswordpage.account, "1@1")
        self.activeweb.findElementByXpathAndInput(
            self.forgetpasswordpage.vercode, "1234")
        self.activeweb.findElementByXpathAndClick(
            self.forgetpasswordpage.resetpasswordbutton)
        self.activeweb.delayTime(5)
        resetpasswordbuttontip = self.activeweb.findElementByXpathAndReturnText(
            0, self.forgetpasswordpage.resetpasswordbuttontip)
        print('实际结果:', resetpasswordbuttontip)
        preresetpasswordbuttontip = "Incorrect validation code"
        self.assertEqual(resetpasswordbuttontip, preresetpasswordbuttontip)

    # @unittest.skip('test_10')
    def test_10(self):  #点击验证码判断验证码是否更新
        """
        点击验证码判断验证码是否更新
        """
        self.activeweb.delayTime(3)
        codetext = self.activeweb.getcodetext(self.forgetpasswordpage.code)

        print("验证码1:", codetext)
        self.activeweb.findElementByXpathAndClick(self.forgetpasswordpage.code)
        self.activeweb.delayTime(3)
        codetext2 = self.activeweb.getcodetext(self.forgetpasswordpage.code)
        print("验证码2:", codetext2)
        self.assertNotEqual(codetext, codetext2)

    @unittest.skip('test_11')
    def test_11(self):  #点击返回登录跳转到返回登录页
        """
        点击返回登录查看是否跳转到登录页
        """
        self.activeweb.findElementByXpathAndClick(
            self.forgetpasswordpage.backtologin)
        self.activeweb.delayTime(5)
        url = self.activeweb.driver.current_url
        print("当前页面实际url:", url)
        preurl = "https://bjw.halodigit.com:9090/nereus/manager/index#/login"
        self.assertEqual(url, preurl)
Пример #15
0
    def __init__(self,
                 writebrandname=None,
                 writeremail=None,
                 writercontactnumber=None,
                 writermerchanttype=None,
                 writercategory=None,
                 writercriteria=None,
                 writersiup=None,
                 writerprovince=None,
                 writercity=None,
                 writerdistrict=None,
                 writervillage=None,
                 writerpostcode=None,
                 writeraddress=None,
                 writercompany=None,
                 writernpwptaxid=None,
                 writerofficialwebsite=None,
                 writerphotosiup=None,
                 writerphotonpwpcompany=None,
                 writerphototdp=None,
                 writername=None,
                 writertypeid=None,
                 writeridentitynumber=None,
                 writernpwp=None,
                 writeraddresstwo=None,
                 writernationality=None,
                 writerposition=None,
                 writerphone=None,
                 writeremailtwo=None,
                 writerphotofullfacebust=None,
                 writerlocationphoto=None,
                 writerphotoofthecashiersdesk=None,
                 writerotherphoto=None,
                 writerbank=None,
                 writeraccountname=None,
                 writeraccountnumber=None,
                 writerqrindoamount=None):
        self.activeweb = ActiveWeb()  #实例化
        self.loginpage = LoginPage()  #实例化
        self.addmerchantpage = AddMerchantPage()  # 实例化
        self.addmerchantdonepage = AddMerchantDonePage()  #实例化
        self.addmerchantpagecompany = AddMerchantPageCompany()  #实例化

        #登录
        self.url = "https://bjw.halodigit.com:9090/nereus/agent/index"  #代理商后台
        self.account = "6281122336666"
        self.password = "******"
        # self.url = "https://m-mbmpay.ahdipay.com/nereus/agent/index"  # 代理商后台
        # self.account = "6281285610481"   #现网
        # self.password = "******"   #现网

        self.addmer = "/html/body/div[3]/div[1]/div/ul/li/ul/li/a[2]"

        #输入内容:
        if writebrandname == None:
            self.writebrandname = ""
        else:
            self.writebrandname = writebrandname

        if writeremail == None:
            self.writeremail = ""
        else:
            self.writeremail = writeremail

        if writercontactnumber == None:
            self.writercontactnumber = ""
        else:
            self.writercontactnumber = writercontactnumber

        if writermerchanttype == None:
            self.writermerchanttype = ""
        else:
            self.writermerchanttype = writermerchanttype

        if writercategory == None:
            self.writercategory = ""
        else:
            self.writercategory = writercategory

        if writercriteria == None:
            self.writercriteria = ""
        else:
            self.writercriteria = writercriteria

        if writersiup == None:
            self.writersiup = ""
        else:
            self.writersiup = writersiup

        if writerprovince == None:
            self.writerprovince = ""
        else:
            self.writerprovince = writerprovince

        if writercity == None:
            self.writercity = ""
        else:
            self.writercity = writercity

        if writerdistrict == None:
            self.writerdistrict = ""
        else:
            self.writerdistrict = writerdistrict

        if writervillage == None:
            self.writervillage = ""
        else:
            self.writervillage = writervillage

        if writerpostcode == None:
            self.writerpostcode = ""
        else:
            self.writerpostcode = writerpostcode

        if writeraddress == None:
            self.writeraddress = ""
        else:
            self.writeraddress = writeraddress

        if writercompany == None:
            self.writercompany = ""
        else:
            self.writercompany = writercompany

        if writernpwptaxid == None:
            self.writernpwptaxid = ""
        else:
            self.writernpwptaxid = writernpwptaxid

        if writerofficialwebsite == None:
            self.writerofficialwebsite = ""
        else:
            self.writerofficialwebsite = writerofficialwebsite

        if writerphotosiup == None:
            self.writerphotosiup = ""
        else:
            self.writerphotosiup = writerphotosiup

        if writerphotonpwpcompany == None:
            self.writerphotonpwpcompany = ""
        else:
            self.writerphotonpwpcompany = writerphotonpwpcompany

        if writerphototdp == None:
            self.writerphototdp = ""
        else:
            self.writerphototdp = writerphototdp

        if writername == None:
            self.writername = ""
        else:
            self.writername = writername

        if writertypeid == None:
            self.writertypeid = ""
        else:
            self.writertypeid = writertypeid

        if writeridentitynumber == None:
            self.writeridentitynumber = ""
        else:
            self.writeridentitynumber = writeridentitynumber

        if writernpwp == None:
            self.writernpwp = ""
        else:
            self.writernpwp = writernpwp

        if writeraddresstwo == None:
            self.writeraddresstwo = ""
        else:
            self.writeraddresstwo = writeraddresstwo

        if writernationality == None:
            self.writernationality = ""
        else:
            self.writernationality = writernationality

        if writerposition == None:
            self.writerposition = ""
        else:
            self.writerposition = writerposition

        if writerphone == None:
            self.writerphone = ""
        else:
            self.writerphone = writerphone

        if writeremailtwo == None:
            self.writeremailtwo = ""
        else:
            self.writeremailtwo = writeremailtwo

        if writerphotofullfacebust == None:
            self.writerphotofullfacebust = ""
        else:
            self.writerphotofullfacebust = writerphotofullfacebust

        if writerlocationphoto == None:
            self.writerlocationphoto = ""
        else:
            self.writerlocationphoto = writerlocationphoto

        if writerphotoofthecashiersdesk == None:
            self.writerphotoofthecashiersdesk = ""
        else:
            self.writerphotoofthecashiersdesk = writerphotoofthecashiersdesk

        if writerotherphoto == None:
            self.writerotherphoto = ""
        else:
            self.writerotherphoto = writerotherphoto

        if writerbank == None:
            self.writerbank = ""
        else:
            self.writerbank = writerbank

        if writeraccountname == None:
            self.writeraccountname = ""
        else:
            self.writeraccountname = writeraccountname

        if writeraccountnumber == None:
            self.writeraccountnumber = ""
        else:
            self.writeraccountnumber = writeraccountnumber

        if writerqrindoamount == None:
            self.writerqrindoamount = ""
        else:
            self.writerqrindoamount = writerqrindoamount
class TestSearch(unittest.TestCase):  # 创建测试类
    @classmethod  # 类方法,只执行一次,但必须要加注解@classmethod,且名字固定为setUpClass
    def setUpClass(cls):
        pass

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

    def setUp(self):  # 每条用例执行测试之前都要执行此方法
        self.jsonfile = '../dataconfig/cookieagent.json'
        self.operationjson = OperationJson(file_path=self.jsonfile)  #实例化
        self.cookie = self.operationjson.get_all_data()
        print("self.cookie:%s" % self.cookie)
        self.activeweb = ActiveWeb()  # 实例化
        self.loginurl = "https://bjw.halodigit.com:9090/nereus/agent/index"
        #pass

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

    #定义搜索查找函数
    def definesearch(self, num, is_cookie, url, selectxpath, selectoptiontext,
                     selectinputxpath, selectinputtext, searchbuttonxpath,
                     searchtableresultxpath, colnum, checktext):

        if is_cookie:
            self.activeweb.writerCookies(self.cookie, self.loginurl, url)
        else:
            self.activeweb.getUrl(url)

        self.activeweb.findElementByXpathAndReturnOptions(
            selectxpath, str(selectoptiontext))
        self.activeweb.findElementByXpathAndInput(selectinputxpath,
                                                  str(selectinputtext))
        self.activeweb.findElementByXpathAndClick(searchbuttonxpath)
        self.activeweb.delayTime(5)
        tabledic = self.activeweb.findElementByXpathAndReturnTableNum(
            num, searchtableresultxpath)
        for value in tabledic.values():
            if str(checktext).lower() in value[int(colnum)].lower():
                self.assertTrue(True)
            else:
                self.assertTrue(False)

    @staticmethod  #根据不同的参数生成测试用例
    def getTestFunc(num, is_cookie, url, selectxpath, selectoptiontext,
                    selectinputxpath, selectinputtext, searchbuttonxpath,
                    searchtableresultxpath, colnum, checktext):
        def func(self):
            self.definesearch(num, is_cookie, url, selectxpath,
                              selectoptiontext, selectinputxpath,
                              selectinputtext, searchbuttonxpath,
                              searchtableresultxpath, colnum, checktext)

        return func
 def setUp(self):  #每条用例执行测试之前都要执行此方法
     self.changepasswordpage = ChangePasswordPage()  # 实例化
     #登录
     self.activeweb = ActiveWeb()  #实例化
     url = "https://bjw.halodigit.com:9090/nereus/manager/index#/account/changePwd"  #管理后台修改密码页面
     self.activeweb.writerCookies(cookie, loginurl, url)  #启动web
Пример #18
0
 def __init__(self):
     self.activeweb = ActiveWeb()
Пример #19
0
class WebFunction:
    def __init__(self):
        self.activeweb = ActiveWeb()

    def assertresult(self, testresult, preresult):
        message = [1, 2]
        if testresult == preresult:
            self.activeweb.printgreenword()
            passmessage = "测试通过-描述【预期结果为:%s,实际结果为:%s,两者一致。】" % (preresult,
                                                                testresult)
            print(passmessage)
            self.activeweb.printnormalword()
            message[0] = 'pass'
            message[1] = passmessage
        else:
            self.activeweb.printredword()
            failmessage = "测试失败-失败描述【预期结果为:%s,而实际结果为:%s,两者不一致。】" % (preresult,
                                                                    testresult)
            print(failmessage)
            self.activeweb.printnormalword()
            message[0] = 'fail'
            message[1] = failmessage
        return message

    def assertText(self, num, testxpath, preresult):
        testresult = self.activeweb.findElementByXpathAndReturnText(
            num, testxpath)
        assertresult = self.assertresult(testresult, preresult)
        return assertresult

    def assertSelectSearch(self, num, selectxpath, selectoptiontext,
                           selectinputxpath, selectinputtext,
                           searchbuttonxpath, searchtableresultxpath, colnum,
                           checktext):
        message = [1, 2]
        flag = False
        self.activeweb.findElementByXpathAndReturnOptions(
            selectxpath, str(selectoptiontext))
        self.activeweb.findElementByXpathAndInput(selectinputxpath,
                                                  str(selectinputtext))
        self.activeweb.findElementByXpathAndClick(searchbuttonxpath)
        self.activeweb.delayTime(5)
        tabledic = self.activeweb.findElementByXpathAndReturnTableNum(
            num, searchtableresultxpath)
        for value in tabledic.values():
            if str(checktext).lower() in value[int(colnum)].lower():
                flag = True
        if flag:
            self.activeweb.printgreenword()
            passmessage = "测试通过-描述【预期搜索结果中包含:%s,实际搜索结果为:%s,符合预期。】" % (
                str(checktext), tabledic)
            print(passmessage)
            self.activeweb.printnormalword()
            message[0] = 'pass'
            message[1] = passmessage
        else:
            self.activeweb.printredword()
            failmessage = "测试失败-失败描述【预期搜索结果中包含:%s,实际搜索结果为:%s,不符合预期。】" % (
                str(checktext), tabledic)
            print(failmessage)
            self.activeweb.printnormalword()
            message[0] = 'fail'
            message[1] = failmessage
        return message

    def assertInputValue(self, testxpath, testvaluename, preresult):
        testresult = self.activeweb.findElementByXpathAndReturnValue(
            testxpath, testvaluename)
        self.assertresult(testresult, preresult)
Пример #20
0
class TestSearch(unittest.TestCase):  # 创建测试类
    @classmethod  # 类方法,只执行一次,但必须要加注解@classmethod,且名字固定为setUpClass
    def setUpClass(cls):
        pass

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

    def setUp(self):  # 每条用例执行测试之前都要执行此方法
        self.cookie = self.getcookie()
        self.activeweb = ActiveWeb()  # 实例化
        self.loginurl = "https://bjw.halodigit.com:9090/nereus/manager/index#/login"
        # self.loginaccountxpath = "/html/body/div[1]/div[2]/form/div/div[1]/input"
        # self.loginaccount = "*****@*****.**"
        # self.loginppasswordxpath = "/html/body/div[1]/div[2]/form/div/div[2]/input"
        # self.loginpassword = "******"
        # self.loginbuttonxpath = "/html/body/div[1]/div[2]/form/div/a[1]/span"

        #pass

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

        # pass

    #获取cookie
    def getcookie(self):
        # 登录
        self.activeweb = ActiveWeb()  # 实例化
        self.loginurl = "https://bjw.halodigit.com:9090/nereus/manager/index#/login"
        self.loginaccountxpath = "/html/body/div[1]/div[2]/form/div/div[1]/input"
        self.loginaccount = "*****@*****.**"
        self.loginppasswordxpath = "/html/body/div[1]/div[2]/form/div/div[2]/input"
        self.loginpassword = "******"
        self.loginbuttonxpath = "/html/body/div[1]/div[2]/form/div/a[1]/span"

        self.activeweb.getUrl(self.loginurl)  # 打开网址
        self.activeweb.findElementByXpathAndInput(self.loginaccountxpath,
                                                  self.loginaccount)
        self.activeweb.findElementByXpathAndInput(self.loginppasswordxpath,
                                                  self.loginpassword)
        self.activeweb.findElementByXpathAndClick(self.loginbuttonxpath)
        self.activeweb.delayTime(3)
        # 获取cookie
        cookie = self.activeweb.getCookies()
        self.activeweb.closeBrowse()
        return cookie

    #定义搜索查找函数
    def definesearch(self, num, is_cookie, url, selectxpath, selectoptiontext,
                     selectinputxpath, selectinputtext, searchbuttonxpath,
                     searchtableresultxpath, colnum, checktext):

        if is_cookie:
            self.activeweb.writerCookies(self.cookie, self.loginurl, url)
        else:
            self.activeweb.getUrl(url)

        self.activeweb.findElementByXpathAndReturnOptions(
            selectxpath, str(selectoptiontext))
        if selectinputxpath == None:
            print("不执行输入文本内容")
        else:
            self.activeweb.findElementByXpathAndInput(selectinputxpath,
                                                      str(selectinputtext))
        self.activeweb.findElementByXpathAndClick(searchbuttonxpath)
        self.activeweb.delayTime(5)
        tabledic = self.activeweb.findElementByXpathAndReturnTableNum(
            num, searchtableresultxpath)
        for value in tabledic.values():
            if str(checktext).lower() in value[int(colnum)].lower():
                self.assertTrue(True)
            else:
                self.assertTrue(False)

    @staticmethod  #根据不同的参数生成测试用例
    def getTestFunc(num, is_cookie, url, selectxpath, selectoptiontext,
                    selectinputxpath, selectinputtext, searchbuttonxpath,
                    searchtableresultxpath, colnum, checktext):
        def func(self):
            self.definesearch(num, is_cookie, url, selectxpath,
                              selectoptiontext, selectinputxpath,
                              selectinputtext, searchbuttonxpath,
                              searchtableresultxpath, colnum, checktext)

        return func
Пример #21
0
class TestQrcodeListPage(unittest.TestCase):  #创建测试类
    # def __init__(self):
    #     self.qrcodelistpage = LoginPage()  #实例化

    loginmanager = LoginManager()  #实例化
    global cookie
    global loginurl
    cookie = loginmanager.cookie
    loginurl = loginmanager.loginurl

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

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

    def setUp(self):  #每条用例执行测试之前都要执行此方法
        self.qrcodelistpage = QrcodeListPage()  # 实例化
        #登录
        self.activeweb = ActiveWeb()  #实例化
        url = "https://bjw.halodigit.com:9090/nereus/manager/index#/biz/mer/mer/qrcode/mer/qrcode/list"  #管理后台二维码列表页
        self.activeweb.writerCookies(cookie, loginurl, url)  #启动web

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

    @unittest.skip('test_01')  #跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_01(self):  #二维码列表页title检查
        """
        二维码列表页title检查
        """
        qrcodetitle = self.activeweb.findElementByXpathAndReturnText(
            0, self.qrcodelistpage.qrcodetitle)
        print('实际结果:', qrcodetitle)
        preqrcodetitle = "QRcode"
        self.assertEqual(qrcodetitle, preqrcodetitle)

    # @unittest.skip('test_02')  # 跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_02(self):  #二维码列表页keyword选项内容,使用Merchant name搜索到匹配内容
        """
        二维码列表页keyword选项内容,使用Merchant name搜索到匹配内容
        """
        globals(
        )['keywordselect'] = self.activeweb.findElementByXpathAndReturnAllOptions(
            self.qrcodelistpage.keywordselect)
        # print("keywordselect选项内容:",keywordselect)
        inputtext = 'test'
        colnum = 0
        checktext = inputtext
        keywordsel = self.activeweb.findElementByXpathAndReturnOptions(
            self.qrcodelistpage.keywordselect, keywordselect[0])
        keywordinput = self.activeweb.findElementByXpathAndInput(
            self.qrcodelistpage.keywordinput, inputtext)
        self.activeweb.findElementByXpathAndClick(
            self.qrcodelistpage.searchbutton)
        self.activeweb.delayTime(5)

        tabledic = self.activeweb.findElementByXpathAndReturnTable(
            self.qrcodelistpage.tbody)
        print('输入的内容:', inputtext, ';', '搜索到的实际结果:', tabledic)
        for value in tabledic.values():
            self.assertIn(checktext.lower(), value[colnum].lower())

    # @unittest.skip('test_03')  # 跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_03(self):  #二维码列表页keyword选项内容,使用Merchant name未搜索到匹配内容
        """
        二维码列表页keyword选项内容为Merchant name
        """
        inputtext = 'te st'
        colnum = 0
        checktext = 'Corresponding data not queried!'
        keywordsel = self.activeweb.findElementByXpathAndReturnOptions(
            self.qrcodelistpage.keywordselect, keywordselect[0])
        keywordinput = self.activeweb.findElementByXpathAndInput(
            self.qrcodelistpage.keywordinput, 'inputtext')
        self.activeweb.findElementByXpathAndClick(
            self.qrcodelistpage.searchbutton)
        self.activeweb.delayTime(5)
        tabledic = self.activeweb.findElementByXpathAndReturnTable(
            self.qrcodelistpage.tbody)
        print('输入的内容:', inputtext, ';', '搜索到的实际结果:', tabledic)
        for value in tabledic.values():
            self.assertIn(checktext.lower(), value[colnum].lower())

    @unittest.skip('test_04')  # 跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_04(self):  #修改密码页确认密码输入框默认文字显示检查
        """
        修改密码页确认密码输入框默认文字显示检查
        """
        confirmpassword = self.activeweb.findElementByXpathAndReturnValue(
            self.qrcodelistpage.confirmpasswordinput, "placeholder")
        print('实际结果:', confirmpassword)
        preconfirmpassword = "******"
        self.assertEqual(confirmpassword, preconfirmpassword)

    @unittest.skip('test_05')  # 跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_05(self):  #修改密码页原密码输入为空时的文字提示
        """
        修改密码页原密码输入为空时的文字提示
        """
        self.activeweb.findElementByXpathAndClick(
            self.qrcodelistpage.currentpasswordinput)
        self.activeweb.delayTime(3)
        self.activeweb.findElementByXpathAndClick(
            self.qrcodelistpage.newpasswordinput)
        self.activeweb.delayTime(3)
        self.activeweb.findElementByXpathAndClick(
            self.qrcodelistpage.currentpasswordinput)
        self.activeweb.delayTime(3)
        accounttip = self.activeweb.findElementByXpathAndReturnText(
            0, self.qrcodelistpage.currentpasswordtip)
        print('实际结果:', accounttip)
        preaccounttip = "This option cannot be empty"
        self.assertEqual(accounttip, preaccounttip)

    @unittest.skip('test_06')  # 跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_06(self):  #修改密码页新密码输入为空时的文字提示
        """
        修改密码页原密码输入为空时的文字提示
        """
        self.activeweb.findElementByXpathAndClick(
            self.qrcodelistpage.currentpasswordinput)
        self.activeweb.delayTime(3)
        self.activeweb.findElementByXpathAndClick(
            self.qrcodelistpage.newpasswordinput)
        self.activeweb.delayTime(3)
        self.activeweb.findElementByXpathAndClick(
            self.qrcodelistpage.currentpasswordinput)
        self.activeweb.delayTime(3)
        accounttip = self.activeweb.findElementByXpathAndReturnText(
            0, self.qrcodelistpage.newpasswordtip)
        print('实际结果:', accounttip)
        preaccounttip = "This option cannot be empty"
        self.assertEqual(accounttip, preaccounttip)

    @unittest.skip('test_07')  # 跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_07(self):  #修改密码页确认密码输入为空时的文字提示
        """
        修改密码页确认密码输入为空时的文字提示
        """
        self.activeweb.findElementByXpathAndClick(
            self.qrcodelistpage.confirmpasswordinput)
        self.activeweb.delayTime(3)
        self.activeweb.findElementByXpathAndClick(
            self.qrcodelistpage.newpasswordinput)
        self.activeweb.delayTime(3)
        accounttip = self.activeweb.findElementByXpathAndReturnText(
            0, self.qrcodelistpage.confirmpasswordtip)
        print('实际结果:', accounttip)
        preaccounttip = "This option cannot be empty"
        self.assertEqual(accounttip, preaccounttip)

    @unittest.skip('test_08')
    def test_08(self):  #修改密码页原密码输入少于6位提示
        """
        修改密码页原密码输入少于6位提示
        """
        self.activeweb.findElementByXpathAndInput(
            self.qrcodelistpage.currentpasswordinput, "12345")
        self.activeweb.findElementByXpathAndClick(
            self.qrcodelistpage.newpasswordinput)
        self.activeweb.delayTime(5)
        currentpasswordtip = self.activeweb.findElementByXpathAndReturnText(
            0, self.qrcodelistpage.currentpasswordtip)
        print('实际结果:', currentpasswordtip)
        precurrentpasswordtip = "The length cannot be less than6"
        self.assertEqual(currentpasswordtip, precurrentpasswordtip)

    @unittest.skip('test_09')
    def test_09(self):  #修改密码页原密码输入大于16位提示
        """
        修改密码页原密码输入大于16位提示
        """
        self.activeweb.findElementByXpathAndInput(
            self.qrcodelistpage.currentpasswordinput, "12345678901234567")
        self.activeweb.findElementByXpathAndClick(
            self.qrcodelistpage.newpasswordinput)
        self.activeweb.delayTime(5)
        currentpasswordtip = self.activeweb.findElementByXpathAndReturnText(
            0, self.qrcodelistpage.currentpasswordtip)
        print('实际结果:', currentpasswordtip)
        precurrentpasswordtip = "The length cannot be more than16"
        self.assertEqual(currentpasswordtip, precurrentpasswordtip)

    @unittest.skip('test_10')
    def test_10(self):  #修改密码页新密码输入少于6位提示
        """
        修改密码页新密码输入少于6位提示
        """
        self.activeweb.findElementByXpathAndInput(
            self.qrcodelistpage.newpasswordinput, "12345")
        self.activeweb.findElementByXpathAndClick(
            self.qrcodelistpage.confirmpasswordinput)
        self.activeweb.delayTime(5)
        newpasswordtip = self.activeweb.findElementByXpathAndReturnText(
            0, self.qrcodelistpage.newpasswordtip)
        print('实际结果:', newpasswordtip)
        prenewpasswordtip = "The length cannot be less than6"
        self.assertEqual(newpasswordtip, prenewpasswordtip)

    @unittest.skip('test_11')
    def test_11(self):  #修改密码页新密码输入大于16位提示
        """
        修改密码页新密码输入大于16位提示
        """
        self.activeweb.findElementByXpathAndInput(
            self.qrcodelistpage.newpasswordinput, "12345678901234567")
        self.activeweb.findElementByXpathAndClick(
            self.qrcodelistpage.confirmpasswordinput)
        self.activeweb.delayTime(5)
        newpasswordtip = self.activeweb.findElementByXpathAndReturnText(
            0, self.qrcodelistpage.newpasswordtip)
        print('实际结果:', newpasswordtip)
        prenewpasswordtip = "The length cannot be more than16"
        self.assertEqual(newpasswordtip, prenewpasswordtip)

    @unittest.skip('test_12')
    def test_12(self):  #修改密码页确认密码输入框提示
        """
        修改密码页确认密码输入框提示
        """
        self.activeweb.findElementByXpathAndInput(
            self.qrcodelistpage.confirmpasswordinput, "1")
        self.activeweb.findElementByXpathAndClick(
            self.qrcodelistpage.newpasswordinput)
        self.activeweb.delayTime(5)
        confirmpasswordtip = self.activeweb.findElementByXpathAndReturnText(
            0, self.qrcodelistpage.confirmpasswordtip)
        print('实际结果:', confirmpasswordtip)
        preconfirmpasswordtip = "New password entered inconsistently"
        self.assertEqual(confirmpasswordtip, preconfirmpasswordtip)

    @unittest.skip('test_13')
    def test_13(self):  #修改密码成功
        """
        修改密码页修改密码成功
        """
        self.activeweb.findElementByXpathAndInput(
            self.qrcodelistpage.currentpasswordinput, "123456")
        self.activeweb.findElementByXpathAndInput(
            self.qrcodelistpage.newpasswordinput, "123456")
        self.activeweb.findElementByXpathAndInput(
            self.qrcodelistpage.confirmpasswordinput, "123456")
        self.activeweb.findElementByXpathAndClick(
            self.qrcodelistpage.submintbutton)
        self.activeweb.delayTime(5)
        currentpassword = self.activeweb.findElementByXpathAndReturnValue(
            self.qrcodelistpage.currentpasswordinput, "placeholder")
        newpassword = self.activeweb.findElementByXpathAndReturnValue(
            self.qrcodelistpage.newpasswordinput, "placeholder")
        confirmpassword = self.activeweb.findElementByXpathAndReturnValue(
            self.qrcodelistpage.confirmpasswordinput, "placeholder")
        print('实际结果:', currentpassword)
        pre = "Please key in..."
        self.assertEqual(currentpassword, pre)
        self.assertEqual(newpassword, pre)
        self.assertEqual(confirmpassword, pre)
Пример #22
0
class AddMerchantFun:  #创建测试类
    def __init__(self,
                 writebrandname=None,
                 writeremail=None,
                 writercontactnumber=None,
                 writermerchanttype=None,
                 writercategory=None,
                 writercriteria=None,
                 writersiup=None,
                 writerprovince=None,
                 writercity=None,
                 writerdistrict=None,
                 writervillage=None,
                 writerpostcode=None,
                 writeraddress=None,
                 writercompany=None,
                 writernpwptaxid=None,
                 writerofficialwebsite=None,
                 writerphotosiup=None,
                 writerphotonpwpcompany=None,
                 writerphototdp=None,
                 writername=None,
                 writertypeid=None,
                 writeridentitynumber=None,
                 writernpwp=None,
                 writeraddresstwo=None,
                 writernationality=None,
                 writerposition=None,
                 writerphone=None,
                 writeremailtwo=None,
                 writerphotofullfacebust=None,
                 writerlocationphoto=None,
                 writerphotoofthecashiersdesk=None,
                 writerotherphoto=None,
                 writerbank=None,
                 writeraccountname=None,
                 writeraccountnumber=None,
                 writerqrindoamount=None):
        self.activeweb = ActiveWeb()  #实例化
        self.loginpage = LoginPage()  #实例化
        self.addmerchantpage = AddMerchantPage()  # 实例化
        self.addmerchantdonepage = AddMerchantDonePage()  #实例化
        self.addmerchantpagecompany = AddMerchantPageCompany()  #实例化

        #登录
        self.url = "https://bjw.halodigit.com:9090/nereus/agent/index"  #代理商后台
        self.account = "6281122336666"
        self.password = "******"
        # self.url = "https://m-mbmpay.ahdipay.com/nereus/agent/index"  # 代理商后台
        # self.account = "6281285610481"   #现网
        # self.password = "******"   #现网

        self.addmer = "/html/body/div[3]/div[1]/div/ul/li/ul/li/a[2]"

        #输入内容:
        if writebrandname == None:
            self.writebrandname = ""
        else:
            self.writebrandname = writebrandname

        if writeremail == None:
            self.writeremail = ""
        else:
            self.writeremail = writeremail

        if writercontactnumber == None:
            self.writercontactnumber = ""
        else:
            self.writercontactnumber = writercontactnumber

        if writermerchanttype == None:
            self.writermerchanttype = ""
        else:
            self.writermerchanttype = writermerchanttype

        if writercategory == None:
            self.writercategory = ""
        else:
            self.writercategory = writercategory

        if writercriteria == None:
            self.writercriteria = ""
        else:
            self.writercriteria = writercriteria

        if writersiup == None:
            self.writersiup = ""
        else:
            self.writersiup = writersiup

        if writerprovince == None:
            self.writerprovince = ""
        else:
            self.writerprovince = writerprovince

        if writercity == None:
            self.writercity = ""
        else:
            self.writercity = writercity

        if writerdistrict == None:
            self.writerdistrict = ""
        else:
            self.writerdistrict = writerdistrict

        if writervillage == None:
            self.writervillage = ""
        else:
            self.writervillage = writervillage

        if writerpostcode == None:
            self.writerpostcode = ""
        else:
            self.writerpostcode = writerpostcode

        if writeraddress == None:
            self.writeraddress = ""
        else:
            self.writeraddress = writeraddress

        if writercompany == None:
            self.writercompany = ""
        else:
            self.writercompany = writercompany

        if writernpwptaxid == None:
            self.writernpwptaxid = ""
        else:
            self.writernpwptaxid = writernpwptaxid

        if writerofficialwebsite == None:
            self.writerofficialwebsite = ""
        else:
            self.writerofficialwebsite = writerofficialwebsite

        if writerphotosiup == None:
            self.writerphotosiup = ""
        else:
            self.writerphotosiup = writerphotosiup

        if writerphotonpwpcompany == None:
            self.writerphotonpwpcompany = ""
        else:
            self.writerphotonpwpcompany = writerphotonpwpcompany

        if writerphototdp == None:
            self.writerphototdp = ""
        else:
            self.writerphototdp = writerphototdp

        if writername == None:
            self.writername = ""
        else:
            self.writername = writername

        if writertypeid == None:
            self.writertypeid = ""
        else:
            self.writertypeid = writertypeid

        if writeridentitynumber == None:
            self.writeridentitynumber = ""
        else:
            self.writeridentitynumber = writeridentitynumber

        if writernpwp == None:
            self.writernpwp = ""
        else:
            self.writernpwp = writernpwp

        if writeraddresstwo == None:
            self.writeraddresstwo = ""
        else:
            self.writeraddresstwo = writeraddresstwo

        if writernationality == None:
            self.writernationality = ""
        else:
            self.writernationality = writernationality

        if writerposition == None:
            self.writerposition = ""
        else:
            self.writerposition = writerposition

        if writerphone == None:
            self.writerphone = ""
        else:
            self.writerphone = writerphone

        if writeremailtwo == None:
            self.writeremailtwo = ""
        else:
            self.writeremailtwo = writeremailtwo

        if writerphotofullfacebust == None:
            self.writerphotofullfacebust = ""
        else:
            self.writerphotofullfacebust = writerphotofullfacebust

        if writerlocationphoto == None:
            self.writerlocationphoto = ""
        else:
            self.writerlocationphoto = writerlocationphoto

        if writerphotoofthecashiersdesk == None:
            self.writerphotoofthecashiersdesk = ""
        else:
            self.writerphotoofthecashiersdesk = writerphotoofthecashiersdesk

        if writerotherphoto == None:
            self.writerotherphoto = ""
        else:
            self.writerotherphoto = writerotherphoto

        if writerbank == None:
            self.writerbank = ""
        else:
            self.writerbank = writerbank

        if writeraccountname == None:
            self.writeraccountname = ""
        else:
            self.writeraccountname = writeraccountname

        if writeraccountnumber == None:
            self.writeraccountnumber = ""
        else:
            self.writeraccountnumber = writeraccountnumber

        if writerqrindoamount == None:
            self.writerqrindoamount = ""
        else:
            self.writerqrindoamount = writerqrindoamount

    def closeweb(self):
        """
        关闭浏览器
        """
        self.activeweb.closeBrowse()

    def loginweb(self):
        """
        登录
        """
        self.activeweb.getUrl(self.url)  #打开网址
        self.activeweb.findElementByXpathAndInput(self.loginpage.account,
                                                  self.account)
        self.activeweb.findElementByXpathAndInput(self.loginpage.password,
                                                  self.password)
        self.activeweb.findElementByXpathAndClick(self.loginpage.loginbutton)
        self.activeweb.delayTime(3)

    def clickAddMerchant(self):
        """
        点击“Add merchant”
        """
        self.activeweb.findElementByXpathAndClick(
            self.addmer)  #点击"Add merchant"
        self.activeweb.delayTime(3)

    def addIndividuMerchant(self):
        """
        添加个人商户
        """
        global flaggere

        self.activeweb.findElementByXpathAndReturnOptions(
            self.addmerchantpage.merchanttypeselect, self.writermerchanttype)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.brandnameinput, self.writebrandname)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.emailinput, self.writeremail)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.contactnumberinput, self.writercontactnumber)
        self.activeweb.findElementByXpathAndReturnOptions(
            self.addmerchantpage.categoryselect, self.writercategory)
        self.activeweb.findElementByXpathAndReturnOptions(
            self.addmerchantpage.criteriaselect, self.writercriteria)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.siupinput, self.writersiup)
        self.activeweb.findElementByXpathAndReturnOptions(
            self.addmerchantpage.provinceselect, self.writerprovince)
        self.activeweb.findElementByXpathAndReturnOptions(
            self.addmerchantpage.cityselect, self.writercity)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.districtinput, self.writerdistrict)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.villageinput, self.writervillage)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.postcodeinput, self.writerpostcode)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.addressinput, self.writeraddress)
        self.activeweb.findElementByXpathAndAndFile(
            self.addmerchantpage.photosiupimage, self.writerphotosiup)
        self.activeweb.findElementByXpathAndAndFile(
            self.addmerchantpage.photonpwpcompanyimage,
            self.writerphotonpwpcompany)
        self.activeweb.findElementByXpathAndAndFile(
            self.addmerchantpage.phototdpimage, self.writerphototdp)

        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.nameinput, self.writername)
        self.activeweb.findElementByXpathAndReturnOptions(
            self.addmerchantpage.typeidselect, self.writertypeid)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.identitynumberinput,
            self.writeridentitynumber)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.npwpinput, self.writernpwp)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.addresstwoinput, self.writeraddresstwo)
        self.activeweb.findElementByXpathAndReturnOptions(
            self.addmerchantpage.nationalityselect, self.writernationality)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.phoneinput, self.writerphone)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.emailtwoinput, self.writeremailtwo)
        self.activeweb.findElementByXpathAndAndFile(
            self.addmerchantpage.photofullfacebustimage,
            self.writerphotofullfacebust)

        self.activeweb.findElementByXpathAndAndFile(
            self.addmerchantpage.locationphotoimage, self.writerlocationphoto)
        self.activeweb.findElementByXpathAndAndFile(
            self.addmerchantpage.photoofthecashiersdeskimage,
            self.writerphotoofthecashiersdesk)
        self.activeweb.findElementByXpathAndAndFile(
            self.addmerchantpage.otherphotoimage, self.writerotherphoto)

        self.activeweb.findElementByXpathAndReturnOptions(
            self.addmerchantpage.bankselect, self.writerbank)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.accountnameinput, self.writeraccountname)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.accountnumberinput, self.writeraccountnumber)

        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.qrindoamountinput, self.writerqrindoamount)
        self.activeweb.findElementByXpathAndClick(
            self.addmerchantpage.checkbutton)
        self.activeweb.delayTime(3)

        self.activeweb.findElementByXpathAndClick(
            self.addmerchantpage.submitbutton)
        self.activeweb.delayTime(3)

        if self.activeweb.findElementByXpathAndReturnText(
                self.addmerchantdonepage.merchantnamecontent
        ) == self.writebrandname:
            flaggere = True
            self.activeweb.printgreenword()
            print("添加个人商户%s成功" % self.writebrandname)
            self.activeweb.printnormalword()
        else:
            flaggere = False
            self.activeweb.printredword()
            print("添加个人商户%s失败" % self.writebrandname)
            self.activeweb.printnormalword()
        self.activeweb.findElementByXpathAndClick(
            self.addmerchantdonepage.merchantlistbutton)
        return flaggere

    def addCompanyMerchant(self):
        """
        添加公司商户
        """
        global flagcom
        self.addmerchantpage = self.addmerchantpagecompany

        self.activeweb.findElementByXpathAndReturnOptions(
            self.addmerchantpage.merchanttypeselect, self.writermerchanttype)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.brandnameinput, self.writebrandname)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.emailinput, self.writeremail)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.contactnumberinput, self.writercontactnumber)
        self.activeweb.findElementByXpathAndReturnOptions(
            self.addmerchantpage.categoryselect, self.writercategory)
        self.activeweb.findElementByXpathAndReturnOptions(
            self.addmerchantpage.criteriaselect, self.writercriteria)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.siupinput, self.writersiup)
        self.activeweb.findElementByXpathAndReturnOptions(
            self.addmerchantpage.provinceselect, self.writerprovince)
        self.activeweb.findElementByXpathAndReturnOptions(
            self.addmerchantpage.cityselect, self.writercity)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.districtinput, self.writerdistrict)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.villageinput, self.writervillage)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.postcodeinput, self.writerpostcode)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.addressinput, self.writeraddress)

        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.companyinput, self.writercompany)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.officialwebsiteinput,
            self.writerofficialwebsite)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.npwptaxidinput, self.writernpwptaxid)

        self.activeweb.findElementByXpathAndAndFile(
            self.addmerchantpage.photosiupimage, self.writerphotosiup)
        self.activeweb.findElementByXpathAndAndFile(
            self.addmerchantpage.photonpwpcompanyimage,
            self.writerphotonpwpcompany)
        self.activeweb.findElementByXpathAndAndFile(
            self.addmerchantpage.phototdpimage, self.writerphototdp)

        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.nameinput, self.writername)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.positioninput, self.writerposition)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.phoneinput, self.writerphone)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.emailtwoinput, self.writeremailtwo)
        self.activeweb.findElementByXpathAndAndFile(
            self.addmerchantpage.photofullfacebustimage,
            self.writerphotofullfacebust)

        self.activeweb.findElementByXpathAndAndFile(
            self.addmerchantpage.locationphotoimage, self.writerlocationphoto)
        self.activeweb.findElementByXpathAndAndFile(
            self.addmerchantpage.photoofthecashiersdeskimage,
            self.writerphotoofthecashiersdesk)
        self.activeweb.findElementByXpathAndAndFile(
            self.addmerchantpage.otherphotoimage, self.writerotherphoto)

        self.activeweb.findElementByXpathAndReturnOptions(
            self.addmerchantpage.bankselect, self.writerbank)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.accountnameinput, self.writeraccountname)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.accountnumberinput, self.writeraccountnumber)

        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.qrindoamountinput, self.writerqrindoamount)
        self.activeweb.findElementByXpathAndClick(
            self.addmerchantpage.checkbutton)
        self.activeweb.delayTime(3)

        self.activeweb.findElementByXpathAndClick(
            self.addmerchantpage.submitbutton)
        self.activeweb.delayTime(3)

        if self.activeweb.findElementByXpathAndReturnText(
                self.addmerchantdonepage.merchantnamecontent
        ) == self.writebrandname:
            flagcom = True
            self.activeweb.printgreenword()
            print("添加公司商户%s成功" % self.writebrandname)
            self.activeweb.printnormalword()
        else:
            flagcom = False
            self.activeweb.printredword()
            print("添加公司商户%s失败" % self.writebrandname)
            self.activeweb.printnormalword()
        self.activeweb.findElementByXpathAndClick(
            self.addmerchantdonepage.merchantlistbutton)
        return flagcom

    def addMerchant(self):
        """
        添加商户
        """
        global flagadd
        if self.writermerchanttype == "Individu":
            self.loginweb()
            self.clickAddMerchant()
            flagadd = self.addIndividuMerchant()
        elif self.writermerchanttype == "Company":
            self.loginweb()
            self.clickAddMerchant()
            flagadd = self.addCompanyMerchant()
        else:
            print('商户类型不正确,商户类型只有:Individu和Company两种,你输入的商户类型为:%s' %
                  self.writermerchanttype)
            flagadd = False
        self.closeweb()
        return flagadd
Пример #23
0
class TestAddMerchantPage(unittest.TestCase):  #创建测试类
    @classmethod  #类方法,只执行一次,但必须要加注解@classmethod,且名字固定为setUpClass
    def setUpClass(cls):
        pass

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

    def setUp(self):  #每条用例执行测试之前都要执行此方法
        self.activeweb = ActiveWeb()  #实例化
        self.loginpage = LoginPage()  #实例化
        self.addmerchantpage = AddMerchantPage()  # 实例化
        self.addmerchantdonepage = AddMerchantDonePage()  #实例化
        self.addmerchantpagecompany = AddMerchantPageCompany()  #实例化

        url = "https://bjw.halodigit.com:9090/nereus/agent/index"  #代理商后台
        # url = "https://m-mbmpay.ahdipay.com/nereus/agent/index"   #现网
        self.activeweb.getUrl(url)  #打开网址
        self.activeweb.findElementByXpathAndInput(self.loginpage.account,
                                                  "6281122336666")
        self.activeweb.findElementByXpathAndInput(self.loginpage.password,
                                                  "abc123456")
        # self.activeweb.findElementByXpathAndInput(self.loginpage.account,"6281285610481")    #现网
        # self.activeweb.findElementByXpathAndInput(self.loginpage.password, "abc123456")   #现网
        self.activeweb.findElementByXpathAndClick(self.loginpage.loginbutton)
        self.activeweb.delayTime(3)
        self.activeweb.findElementByXpathAndClick(
            "/html/body/div[3]/div[1]/div/ul/li/ul/li/a[2]")  #点击"Add merchant"
        self.activeweb.delayTime(3)

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

    @unittest.skip('test_01')  #跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_01(self):  #添加个人商户
        """
        添加页面元素
        :return:
        """
        writebrandname = "123456"
        writeremail = "*****@*****.**"
        writercontactnumber = "abc123456"
        writermerchanttype = "Individu"
        writercategory = "TAXICABS & LIMOUSINES"
        writercriteria = "Medium"
        writersiup = "abc123456"
        writerprovince = "JAMBI"
        writercity = "Kab. Bungo"
        writerdistrict = "abc123456"
        writervillage = "abc123456"
        writerpostcode = "abc123456"
        writeraddress = "abc123456"
        writerphotosiup = "D:\\pic\\1.png"
        writerphotonpwpcompany = "D:\\pic\\1.png"
        writerphototdp = "D:\\pic\\1.png"

        writername = "abc123456"
        writertypeid = "KTP"
        writeridentitynumber = "abc123456"
        writernpwp = "abc123456"
        writeraddresstwo = "abc123456"
        writernationality = "Indonesian"
        writerphone = "abc123456"
        writeremailtwo = "*****@*****.**"
        writerphotofullfacebust = "D:\\pic\\1.png"

        writerlocationphoto = "D:\\pic\\1.png"
        writerphotoofthecashiersdesk = "D:\\pic\\1.png"
        writerotherphoto = "D:\\pic\\1.png"

        writerbank = "BCA"
        writeraccountname = "abc123456"
        writeraccountnumber = "abc123456"

        self.writerqrindoamount = "6281122336666"

        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.brandnameinput, writebrandname)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.emailinput, writeremail)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.contactnumberinput, writercontactnumber)
        self.activeweb.findElementByXpathAndReturnOptions(
            self.addmerchantpage.merchanttypeselect, writermerchanttype)
        self.activeweb.findElementByXpathAndReturnOptions(
            self.addmerchantpage.categoryselect, writercategory)
        self.activeweb.findElementByXpathAndReturnOptions(
            self.addmerchantpage.criteriaselect, writercriteria)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.siupinput, writersiup)
        self.activeweb.findElementByXpathAndReturnOptions(
            self.addmerchantpage.provinceselect, writerprovince)
        self.activeweb.findElementByXpathAndReturnOptions(
            self.addmerchantpage.cityselect, writercity)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.districtinput, writerdistrict)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.villageinput, writervillage)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.postcodeinput, writerpostcode)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.addressinput, writeraddress)
        self.activeweb.findElementByXpathAndAndFile(
            self.addmerchantpage.photosiupimage, writerphotosiup)
        self.activeweb.findElementByXpathAndAndFile(
            self.addmerchantpage.photonpwpcompanyimage, writerphotonpwpcompany)
        self.activeweb.findElementByXpathAndAndFile(
            self.addmerchantpage.phototdpimage, writerphototdp)

        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.nameinput, writername)
        self.activeweb.findElementByXpathAndReturnOptions(
            self.addmerchantpage.typeidselect, writertypeid)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.identitynumberinput, writeridentitynumber)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.npwpinput, writernpwp)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.addresstwoinput, writeraddresstwo)
        self.activeweb.findElementByXpathAndReturnOptions(
            self.addmerchantpage.nationalityselect, writernationality)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.phoneinput, writerphone)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.emailtwoinput, writeremailtwo)
        self.activeweb.findElementByXpathAndAndFile(
            self.addmerchantpage.photofullfacebustimage,
            writerphotofullfacebust)

        self.activeweb.findElementByXpathAndAndFile(
            self.addmerchantpage.locationphotoimage, writerlocationphoto)
        self.activeweb.findElementByXpathAndAndFile(
            self.addmerchantpage.photoofthecashiersdeskimage,
            writerphotoofthecashiersdesk)
        self.activeweb.findElementByXpathAndAndFile(
            self.addmerchantpage.otherphotoimage, writerotherphoto)

        self.activeweb.findElementByXpathAndReturnOptions(
            self.addmerchantpage.bankselect, writerbank)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.accountnameinput, writeraccountname)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.accountnumberinput, writeraccountnumber)

        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.qrindoamountinput, self.writerqrindoamount)
        self.activeweb.findElementByXpathAndClick(
            self.addmerchantpage.checkbutton)
        self.activeweb.delayTime(3)

        self.activeweb.findElementByXpathAndClick(
            self.addmerchantpage.submitbutton)
        self.activeweb.delayTime(3)
        self.activeweb.findElementByXpathAndClick(
            self.addmerchantdonepage.merchantlistbutton)

    # @unittest.skip('test_02')   #跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_02(self):  #添加公司商户
        """
        添加页面元素
        :return:
        """
        self.addmerchantpage = self.addmerchantpagecompany
        writebrandname = "123456"
        writeremail = "*****@*****.**"
        writercontactnumber = "abc123456"
        writermerchanttype = "Company"
        writercategory = "TAXICABS & LIMOUSINES"
        writercriteria = "Medium"
        writersiup = "abc123456"
        writerprovince = "JAMBI"
        writercity = "Kab. Bungo"
        writerdistrict = "abc123456"
        writervillage = "abc123456"
        writerpostcode = "abc123456"
        writeraddress = "abc123456"
        writercompany = "abc123456"
        writernpwptaxid = "abc123456"
        writerofficialwebsite = "abc123456"
        writerphotosiup = "D:\\pic\\1.png"
        writerphotonpwpcompany = "D:\\pic\\1.png"
        writerphototdp = "D:\\pic\\1.png"

        writername = "abc123456"
        writerposition = "abc123456"
        writerphone = "abc123456"
        writeremailtwo = "*****@*****.**"
        writerphotofullfacebust = "D:\\pic\\1.png"

        writerlocationphoto = "D:\\pic\\1.png"
        writerphotoofthecashiersdesk = "D:\\pic\\1.png"
        writerotherphoto = "D:\\pic\\1.png"

        writerbank = "BCA"
        writeraccountname = "abc123456"
        writeraccountnumber = "abc123456"

        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.brandnameinput, writebrandname)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.emailinput, writeremail)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.contactnumberinput, writercontactnumber)
        self.activeweb.findElementByXpathAndReturnOptions(
            self.addmerchantpage.merchanttypeselect, writermerchanttype)
        self.activeweb.findElementByXpathAndReturnOptions(
            self.addmerchantpage.categoryselect, writercategory)
        self.activeweb.findElementByXpathAndReturnOptions(
            self.addmerchantpage.criteriaselect, writercriteria)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.siupinput, writersiup)
        self.activeweb.findElementByXpathAndReturnOptions(
            self.addmerchantpage.provinceselect, writerprovince)
        self.activeweb.findElementByXpathAndReturnOptions(
            self.addmerchantpage.cityselect, writercity)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.districtinput, writerdistrict)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.villageinput, writervillage)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.postcodeinput, writerpostcode)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.addressinput, writeraddress)

        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.companyinput, writercompany)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.officialwebsiteinput, writerofficialwebsite)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.npwptaxidinput, writernpwptaxid)

        self.activeweb.findElementByXpathAndAndFile(
            self.addmerchantpage.photosiupimage, writerphotosiup)
        self.activeweb.findElementByXpathAndAndFile(
            self.addmerchantpage.photonpwpcompanyimage, writerphotonpwpcompany)
        self.activeweb.findElementByXpathAndAndFile(
            self.addmerchantpage.phototdpimage, writerphototdp)

        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.nameinput, writername)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.positioninput, writerposition)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.phoneinput, writerphone)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.emailtwoinput, writeremailtwo)
        self.activeweb.findElementByXpathAndAndFile(
            self.addmerchantpage.photofullfacebustimage,
            writerphotofullfacebust)

        self.activeweb.findElementByXpathAndAndFile(
            self.addmerchantpage.locationphotoimage, writerlocationphoto)
        self.activeweb.findElementByXpathAndAndFile(
            self.addmerchantpage.photoofthecashiersdeskimage,
            writerphotoofthecashiersdesk)
        self.activeweb.findElementByXpathAndAndFile(
            self.addmerchantpage.otherphotoimage, writerotherphoto)

        self.activeweb.findElementByXpathAndReturnOptions(
            self.addmerchantpage.bankselect, writerbank)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.accountnameinput, writeraccountname)
        self.activeweb.findElementByXpathAndInput(
            self.addmerchantpage.accountnumberinput, writeraccountnumber)

        self.activeweb.findElementByXpathAndClick(
            self.addmerchantpage.submitbutton)
        self.activeweb.delayTime(3)
        self.activeweb.findElementByXpathAndClick(
            self.addmerchantdonepage.merchantlistbutton)
Пример #24
0
 def setUp(self):  # 每条用例执行测试之前都要执行此方法
     self.cookie = self.getcookie()
     self.activeweb = ActiveWeb()  # 实例化
     self.loginurl = "https://bjw.halodigit.com:9090/nereus/manager/index#/login"
Пример #25
0
class GetCookie():
    def __init__(self,outjsonfile=None,outloginurl=None,outloginaccountxpath=None,
                 outloginaccounttext=None,outloginppasswordxpath=None,outloginpasswordtext=None,
                 outloginbuttonxpath=None):

        if outjsonfile==None:
            self.jsonfile = '../dataconfig/cookie.json'
        else:
            self.jsonfile = outjsonfile

        if outloginurl==None:
            self.loginurl ="https://bjw.halodigit.com:9090/nereus/manager/index#/login"
        else:
            self.loginurl = outloginurl

        if outloginaccountxpath==None:
            self.loginaccountxpath = "/html/body/div[1]/div[2]/form/div/div[1]/input"
        else:
            self.loginaccountxpath = outloginaccountxpath

        if outloginaccounttext==None:
            self.loginaccount = "*****@*****.**"
        else:
            self.loginaccount = outloginaccounttext

        if outloginppasswordxpath==None:
            self.loginppasswordxpath = "/html/body/div[1]/div[2]/form/div/div[2]/input"
        else:
            self.loginppasswordxpath = outloginppasswordxpath

        if outloginpasswordtext==None:
            self.loginpassword = "******"
        else:
            self.loginpassword = outloginpasswordtext

        if outloginbuttonxpath==None:
            self.loginbuttonxpath = "/html/body/div[1]/div[2]/form/div/a[1]/span"
        else:
            self.loginbuttonxpath = outloginbuttonxpath

        self.operationjson = OperationJson(file_path=self.jsonfile)   #实例化
        self.activeweb = ActiveWeb()  # 实例化


    def getCookie(self):
        # 登录
        self.activeweb.getUrl(self.loginurl)  # 打开网址
        self.activeweb.findElementByXpathAndInput(self.loginaccountxpath,self.loginaccount)
        self.activeweb.findElementByXpathAndInput(self.loginppasswordxpath,self.loginpassword)
        self.activeweb.findElementByXpathAndClick(self.loginbuttonxpath)
        self.activeweb.delayTime(3)
        # 获取cookie
        cookie = self.activeweb.getCookies()
        self.activeweb.closeBrowse()
        return cookie

    def writerCookieToJson(self):
        self.cookie = self.getCookie()
        self.operationjson.write_data(self.cookie)
        print("\ncookie信息‘%s’已经写入‘%s’文件里。\n" % (self.cookie,self.jsonfile))
Пример #26
0
class TestLoginPage(unittest.TestCase):   #创建测试类
    # def __init__(self):
    #     self.loginpage = LoginPage()  #实例化

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

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

    def setUp(self):   #每条用例执行测试之前都要执行此方法
        self.loginpage = LoginPage()  # 实例化
        self.activeweb = ActiveWeb()   #实例化
        url = "https://bjw.halodigit.com:9090/nereus/manager/index"   #管理后台
        # url = "https://bjw.halodigit.com:9090/nereus/agent/index#/login"
        self.activeweb.getUrl(url)   #启动web
        self.activeweb.delayTime(10)

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

    @unittest.skip('test_01')   #跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_01(self):   #登录页登录title检查
        """
        登录页登录title检查
        """
        logintitle = self.activeweb.findElementByXpathAndReturnText(0,self.loginpage.logintitle)
        print('实际结果:',logintitle)
        prelogintitle = "LOGIN"
        self.assertEqual(logintitle,prelogintitle)

    @unittest.skip('test_02')  # 跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_02(self):   #登录页账号输入框默认文字检查
        """
        登录页账号输入框默认文字检查
        """
        account = self.activeweb.findElementByXpathAndReturnValue(self.loginpage.account,"placeholder")
        print('实际结果:',account)
        preaccount = "Your Email address"
        self.assertEqual(account,preaccount)

    @unittest.skip('test_03')  # 跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_03(self):   #登录页密码输入框默认文字检查
        """
        登录页密码输入框默认文字检查
        """
        password = self.activeweb.findElementByXpathAndReturnValue(self.loginpage.password,"placeholder")
        print('实际结果:',password)
        prepassword = "******"
        self.assertEqual(password,prepassword)

    @unittest.skip('test_04')  # 跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_04(self):   #登录页登录账号输入为空时的文字提示
        """
        登录页登录账号输入为空时的文字提示
        """
        self.activeweb.findElementByXpathAndClick(self.loginpage.account)
        self.activeweb.delayTime(3)
        self.activeweb.findElementByXpathAndClick(self.loginpage.password)
        self.activeweb.delayTime(3)
        self.activeweb.findElementByXpathAndClick(self.loginpage.account)
        self.activeweb.delayTime(3)
        accounttip = self.activeweb.findElementByXpathAndReturnText(0,self.loginpage.accounttip)
        print('实际结果:',accounttip)
        preaccounttip = "This option cannot be empty"
        self.assertEqual(accounttip,preaccounttip)

    @unittest.skip('test_05')  # 跳过用例名字为‘test_01’的用例,跳过的用例的执行结果显示:是
    def test_05(self):   #登录页登录密码输入为空时的文字提示
        """
        登录页登录密码输入为空时的文字提示
        """
        self.activeweb.findElementByXpathAndClick(self.loginpage.account)
        self.activeweb.delayTime(3)
        self.activeweb.findElementByXpathAndClick(self.loginpage.password)
        self.activeweb.delayTime(3)
        self.activeweb.findElementByXpathAndClick(self.loginpage.account)
        self.activeweb.delayTime(3)
        passwordtip = self.activeweb.findElementByXpathAndReturnText(0,self.loginpage.passwordtip)
        print('实际结果:',passwordtip)
        prepasswordtip = "This option cannot be empty"
        self.assertEqual(passwordtip,prepasswordtip)

    @unittest.skip('test_06')
    def test_06(self):   #登录页,账号格式不是邮箱类型,不是类似1@1格式,123456,@,1@,@1,
        """
        登录页,账号格式不是邮箱类型,不是类似1@1格式,123456,@,1@,@1,
        """
        self.activeweb.findElementByXpathAndInput(self.loginpage.account,"123456")
        self.activeweb.findElementByXpathAndClick(self.loginpage.password)
        self.activeweb.delayTime(3)
        accounttip = self.activeweb.findElementByXpathAndReturnText(0,self.loginpage.accounttip)
        print('实际结果:',accounttip)
        preaccounttip = "Please enter the correct email address"
        self.assertEqual(accounttip,preaccounttip)

    @unittest.skip('test_07')
    def test_07(self):   #登录页,密码长度小于6位提示
        """
        登录页,密码长度小于6位提示
        """
        self.activeweb.findElementByXpathAndInput(self.loginpage.password,"12345")
        self.activeweb.findElementByXpathAndClick(self.loginpage.account)
        self.activeweb.delayTime(3)
        passwordtip = self.activeweb.findElementByXpathAndReturnText(0,self.loginpage.accounttip)
        print('实际结果:',passwordtip)
        prepasswordtip = "The length cannot be less than6"
        self.assertEqual(passwordtip,prepasswordtip)

    @unittest.skip('test_08')
    def test_08(self):   #登录页,密码长度大于16位提示
        """
        登录页,密码长度大于16位提示
        """
        self.activeweb.findElementByXpathAndInput(self.loginpage.password,"12345678901234567")
        self.activeweb.findElementByXpathAndClick(self.loginpage.account)
        self.activeweb.delayTime(3)
        passwordtip = self.activeweb.findElementByXpathAndReturnText(0,self.loginpage.accounttip)
        print('实际结果:',passwordtip)
        prepasswordtip = "The length cannot be more than16"
        self.assertEqual(passwordtip,prepasswordtip)

    @unittest.skip('test_09')
    def test_09(self):   #登录页,账号与密码错误时,点击登录,账号密码错误提示
        """
        登录页,账号与密码错误时,点击登录,账号密码错误提示
        """
        self.activeweb.findElementByXpathAndInput(self.loginpage.account,"1@1")
        self.activeweb.findElementByXpathAndInput(self.loginpage.password, "123456")
        self.activeweb.findElementByXpathAndClick(self.loginpage.loginbutton)
        self.activeweb.delayTime(5)
        logintip = self.activeweb.findElementByXpathAndReturnText(0,self.loginpage.logintip)
        print('实际结果:',logintip)
        prelogintip = "incorrect account or password"
        self.assertEqual(logintip,prelogintip)

    @unittest.skip('test_10')
    def test_10(self):   #登录页,账号与密码错误时,点击登录,出现验证码提示
        """
        登录页,账号与密码错误时,点击登录,出现验证码提示
        """
        self.activeweb.findElementByXpathAndInput(self.loginpage.account,"1@1")
        self.activeweb.findElementByXpathAndInput(self.loginpage.password, "123456")
        self.activeweb.findElementByXpathAndClick(self.loginpage.loginbutton)
        self.activeweb.delayTime(5)
        logintip = self.activeweb.findElementByXpathAndReturnValue(self.loginpage.vercode,"placeholder")
        print('实际结果:',logintip)
        prelogintip = "Verification code"
        self.assertEqual(logintip,prelogintip)

    @unittest.skip('test_11')
    def test_11(self):   #登录页,账号与密码错误时,点击登录,验证码输入内容为空时提示
        """
        登录页,账号与密码错误时,点击登录,验证码输入内容为空时提示
        """
        self.activeweb.findElementByXpathAndInput(self.loginpage.account,"1@1")
        self.activeweb.findElementByXpathAndInput(self.loginpage.password, "123456")
        self.activeweb.findElementByXpathAndClick(self.loginpage.loginbutton)
        self.activeweb.delayTime(5)
        self.activeweb.findElementByXpathAndClick(self.loginpage.vercode)
        self.activeweb.findElementByXpathAndClick(self.loginpage.account)
        vercodetip = self.activeweb.findElementByXpathAndReturnText(0,self.loginpage.accounttip)
        print('实际结果:',vercodetip)
        prevercodetip = "This option cannot be empty"
        self.assertEqual(vercodetip,prevercodetip)

    @unittest.skip('test_12')
    def test_12(self):   #登录页,账号与密码输入,输入错误的验证码,点击登录,验证码输入错误提示
        """
        登录页,账号与密码输入,输入错误的验证码,点击登录,验证码输入错误提示
        """
        self.activeweb.findElementByXpathAndInput(self.loginpage.account,"1@1")
        self.activeweb.findElementByXpathAndInput(self.loginpage.password, "123456")
        self.activeweb.findElementByXpathAndClick(self.loginpage.loginbutton)
        self.activeweb.delayTime(5)
        self.activeweb.findElementByXpathAndInput(self.loginpage.password, "123456")
        self.activeweb.findElementByXpathAndInput(self.loginpage.vercode, "1234")
        self.activeweb.findElementByXpathAndClick(self.loginpage.loginbutton)
        self.activeweb.delayTime(5)
        vercodetip = self.activeweb.findElementByXpathAndReturnText(0,self.loginpage.logintip)
        print('实际结果:',vercodetip)
        prevercodetip = "Incorrect validation code"
        self.assertEqual(vercodetip,prevercodetip)

    # @unittest.skip('test_13')
    def test_13(self):   #点击验证码判断验证码是否更新
        """
        点击验证码判断验证码是否更新
        """
        self.activeweb.findElementByXpathAndInput(self.loginpage.account,"1@1")
        self.activeweb.findElementByXpathAndInput(self.loginpage.password, "123456")
        self.activeweb.findElementByXpathAndClick(self.loginpage.loginbutton)
        self.activeweb.delayTime(5)
        codetext = self.activeweb.getcodetext(self.loginpage.code)
        print("验证码1:",codetext)
        self.activeweb.findElementByXpathAndClick(self.loginpage.code)
        self.activeweb.delayTime(3)
        codetext2 = self.activeweb.getcodetext(self.loginpage.code)
        print("验证码2:",codetext2)
        self.assertNotEqual(codetext,codetext2)

    @unittest.skip('test_14')
    def test_14(self):   #点击找回密码跳转到找回密码页
        """
        点击找回密码查看是否跳转到找回密码页
        """
        self.activeweb.findElementByXpathAndClick(self.loginpage.forgetpassword)
        self.activeweb.delayTime(5)
        url  = self.activeweb.driver.current_url
        print("当前页面实际url:",url)
        preurl = "https://bjw.halodigit.com:9090/nereus/manager/retrive"
        self.assertEqual(url,preurl)