def test_longin(self, login_data):

        Login().do_login(self.driver, login_data)
        if Service.is_element_exist(self.driver, By.LINK_TEXT, '注销'):
            result = 'successful'
        elif '用户名不能为空' in Service.element_text(self.driver, By.ID, 'userNameMsg'):
            result = 'user_invalid'
        elif '密码不能为空' in Service.element_text(self.driver, By.ID, 'pwMsg'):
            result = 'password_invalid'
        elif '用户名或密码错误' in Service.element_text(self.driver, By.ID, 'pwMsg'):
            result = 'login-fail'
        else:
            result = 'login-fai_withNoMessage'
        # 出现错误将截图
        if result != login_data["expect"]:
            Service.get_error_png(self.driver)
        self.assertEqual(result, login_data["expect"])
Beispiel #2
0
    def test_longin(self, uname, upass, verifycode, expect, tes_id):

        login_data = {
            "userName": uname,
            "userPass": upass,

        }
        Login().do_login(self.driver, login_data)
        if Service.is_element_exist(self.driver, By.LINK_TEXT, '注销'):
            result = 'successful'
        elif '用户名不能为空' in Service.element_text(self.driver, By.ID, 'userNameMsg'):
            result = 'user_invalid'
        elif '密码不能为空' in Service.element_text(self.driver, By.ID, 'pwMsg'):
            result = 'password_invalid'
        elif '用户名或密码错误' in Service.element_text(self.driver, By.ID, 'pwMsg'):
            result = 'login-fail'
        else:
            result = 'login-fai_withNoMessage'
        # 出现错误将截图
        if result != expect:
            Service.get_error_png(self.driver)
        self.assertEqual(result, expect)