def test_zhuce_tiaozhuan(self): """跳转用户注册 :return: """ mylogger = Logger(logger='跳转用户注册').getlog() rp = test_Register_Page(self.driver) rp.open() mylogger.info("打开浏览器") n = rp.yonghuzhuce() print(n) mylogger.info("点击用户注册") try: self.assertEqual( n, 'http://elangshen.com/toUserRegisterOne?channel=hcb_web', msg='跳转用户注册失败') except: Get_Screenshot(self.driver, '跳转用户注册失败') raise
def text_panduanzh(self): """测试账号输入框是否存在内容 :return: """ mylogger = Logger(logger='测试账号输入框是否存在内容').getlog() mylogger.info("登录'*****@*****.**','a123456'") test_Register_Page(self.driver).login('*****@*****.**', 'a123456') mylogger.info("进入积分充值") zhifu_tests(self.driver).jinruf() mylogger.info("查看账号内是否有值") try: self.assertEqual(zhifu_tests(self.driver).zhanghao_huoquf(), '有', msg='账号框里无内容') except: Get_Screenshot(self.driver, '账号框里无内容') mylogger.info("用例执行失败已截图") raise
def test_zhanhaocuowu_tishi(self): """错误账号登录 :return: """ mylogger = Logger(logger='错误账号登录').getlog() rp = test_Register_Page(self.driver) rp.open() mylogger.info("打开浏览器") rp.input_username('*****@*****.**') mylogger.info("输入账号") sleep(1) rp.input_password("a123456") mylogger.info("输入密码") sleep(2) jieguo = rp.click_login_bth() mylogger.info("点击登录") try: self.assertEqual(rp.click_shangcuan_bth(), '帐号不存在', msg='不提示账号不存在') except: Get_Screenshot(self.driver, '不提示账号不存在') raise
def test_normal_login(self): """正常登录 :return: """ mylogger = Logger(logger='正常登录').getlog() rp = test_Register_Page(self.driver) rp.open() #打开 mylogger.info("打开浏览器") rp.input_username('*****@*****.**') mylogger.info("输入账号") sleep(1) rp.input_password("a123456") mylogger.info("输入密码") sleep(2) rp.click_login_bth() mylogger.info("点击登录") try: self.assertEqual(rp.tishi(), '登录成功', msg='登录失败') except: Get_Screenshot(self.driver, '登录失败') raise
def test_zhanghaohuixian(self, name, zhanghao, mima, name1, name2, name3, yuqi, cuowu, shuju, shurkuang, zhanghaoleix): """%s :return: """ % name mylogger = Logger(logger=name).getlog() mylogger.info(name1) test_Register_Page(self.driver).login(zhanghao, mima) mylogger.info(name2) yijianss_tests(self.driver).user_jinglai() mylogger.info(name3) try: self.assertEqual(yijianss_tests(self.driver).panduanweizhi( shuju, shurkuang, '获取', zhanghaoleix), zhanghao, msg=cuowu) mylogger.info('回显成功') except: mylogger.info(cuowu) Get_Screenshot(self.driver, cuowu) mylogger.info("用例执行失败已截图") raise
def txst_baocun(self): """测试不修改内容点保存 :return: """ mylogger = Logger(logger='测试不修改内容点保存').getlog() mylogger.info("登录'*****@*****.**','a123456'") test_Register_Page(self.driver).login('*****@*****.**', 'a123456') mylogger.info("点修改用户信息") user_tests(self.driver).user_jinglai() mylogger.info("点保存") # print(user_tests(self.driver).nicheng_shuru_neirong(2)) user_tests(self.driver).baocun() sleep(2) try: self.assertEqual(user_tests(self.driver).tishi(), '个人资料修改成功', msg='不提示修改成功') except: Get_Screenshot(self.driver, '不提示修改成功') mylogger.info("用例执行失败已截图") raise
def test_xingbie(self, name, zhanghao, mimai, xingbie, names1, names2, names3, names4, names5, wenti): """%s :return: """ % name mylogger = Logger(logger=name).getlog() mylogger.info(names1) test_Register_Page(self.driver).login(zhanghao, mimai) mylogger.info(names2) user_tests(self.driver).user_jinglai() mylogger.info(names3) user_tests(self.driver).xuanze_xb(xingbie) # print(user_tests(self.driver).nicheng_shuru_neirong(int(caoz)), xingbie) mylogger.info(names4) user_tests(self.driver).baocun() try: mylogger.info(names5) self.assertEqual(user_tests(self.driver).tishi(), '个人资料修改成功', msg=wenti) mylogger.info('保存交互正常') print(user_tests(self.driver).nicheng_shuru_neirong(2), xingbie) try: self.assertEqual(user_tests( self.driver).nicheng_shuru_neirong(2), xingbie, msg='数据没有回显成功') mylogger.info('保存数据正常') except: wenti = '数据保存失败' raise except: mylogger.info(wenti) Get_Screenshot(self.driver, wenti) mylogger.info("用例执行失败已截图") raise
def test_zhanghaoweikong_tishi(self): """空账号登录 :return: """ mylogger = Logger(logger='空账号登录').getlog() rp = test_Register_Page(self.driver) rp.open() mylogger.info("打开浏览器") rp.input_username('') mylogger.info("输入账号") sleep(1) rp.input_password("a123456123123") mylogger.info("输入密码") sleep(2) rp.click_login_bth() mylogger.info("点击登录") try: self.assertEqual(rp.click_shangcuan_bth(), '账号不能为空', msg='不提示账号不能为空') except: Get_Screenshot(self.driver, '不提示账号不能为空') raise
def test_mimaweikong_tishi(self): """密码空登录 :return: """ mylogger = Logger(logger='密码空登录').getlog() rp = test_Register_Page(self.driver) rp.open() mylogger.info("打开浏览器") rp.input_username('*****@*****.**') mylogger.info("输入账号") sleep(1) rp.input_password('') mylogger.info("输入密码") sleep(2) rp.click_login_bth() mylogger.info("点击登录") try: self.assertEqual(rp.click_shangcuan_bth(), '密码不能为空', msg='不提示密码不能为空') except: Get_Screenshot(self.driver, '不提示密码不能为空') raise
def test_tuichu(self): """测试意见反馈页退出按钮 :return: """ mylogger = Logger(logger='测试不修改内容点保存').getlog() mylogger.info("登录'*****@*****.**','a123456'") test_Register_Page(self.driver).login('*****@*****.**', 'a123456') mylogger.info("点修改用户信息") yijianss_tests(self.driver).user_jinglai() mylogger.info("点退出按钮") # print(user_tests(self.driver).nicheng_shuru_neirong(2)) yijianss_tests(self.driver).dian_fanhui() sleep(2) try: self.assertEqual(yijianss_tests(self.driver).tuichuyanzheng(), '智能核查', msg='用户信息修改页不能退出首页') mylogger.info("退出成功") except: Get_Screenshot(self.driver, '用户信息修改页不能退出首页') mylogger.info("用例执行失败已截图") raise