def testcase34(self): """ 测试新增一个账号且可登录系统 :return: """ self.login.csp_login() self.login.wait(2) self.system = SyStem_Management_Page(self.driver) self.system.add_user() #新增一个账号 self.login.csplogin(newname=self.system.add_value[0], newpws=self.system.add_value[9]) self.login.wait(2) screenshoot.screen_shoot(self.driver, r'\system', '-01新建账号登录成功') value2 = self.login.get_url() try: self.assertEqual(self.login.url, value2) except Exception: writedata.update_data( 2, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") test_system_log.csp_log.exception( f'Assertion Failed,case is not passed------{self.login.url}!={value2} ' ) raise else: test_system_log.csp_log.info( f'Assertion Success,case is passed------{self.login.url}={value2}' ) writedata.update_data( 2, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行通过")
def testcase02(self): """ 退出登录重置密码再次登录 :return: """ self.updatepws = UpdatepwsPage(self.driver) self.updatepws.wait(5) self.updatepws.login_out() self.updatepws.update_pws(pws=self.updatepws.updatedate[6]) updatepws_log.csp_log.info(f'最新的密码为{self.updatepws.updatedate[6]}') self.updatepws.new_login(latest_pws=self.updatepws.updatedate[6]) value = self.updatepws.get_url() self.updatepws.wait(2) value2 = self.updatepws.url screenshoot.screen_shoot(self.driver, r'\update_password', '第二次密码更新') try: self.assertEqual(value, value2) except Exception: updatepws_log.csp_log.exception( f'Assertion Failed,case is not pass---------“{value}” is not equal to “{value2}”' ) raise else: updatepws_log.csp_log.info( f'Assertion Successed,case is pass-----------“{value}” is equal to “{value2}”' )
def testcase01(self): """ 测试变更密码成功 :return: """ self.login.open() #打开网站 self.login.wait(2) self.updatepws = UpdatepwsPage(self.driver) self.updatepws.update_pws(pws=self.updatepws.updatedate[3][2]) updatepws_log.csp_log.info(f'最新的密码为{self.updatepws.updatedate[3][2]}') self.updatepws.new_login(latest_pws=self.updatepws.updatedate[3][2]) value = self.updatepws.get_url() self.updatepws.wait(2) value2 = self.updatepws.url screenshoot.screen_shoot(self.driver, r'\update_password', '第一次密码更新') try: self.assertEqual(value, value2) except Exception: updatepws_log.csp_log.exception( f'Assertion Failed,case is not pass---------“{value}” is not equal to “{value2}”' ) raise else: updatepws_log.csp_log.info( f'Assertion Successed,case is pass-----------“{value}” is equal to “{value2}”' )
def testcase15(self): """ 测试变更chatbot归属csp与客户 :return: """ self.chatbot = ChatbotPage(self.driver) value2 = self.chatbot.assert_chatbotname( chatbot_name=self.chatbot.other) if self.chatbot.assert_find(findname=self.chatbot.other, assert_text=value2): self.chatbot.into_lookover() # 点击查看按钮进入查看页面 self.chatbot.update_csp() #变更归属csp self.chatbot.intocheck(way=False) # 进入chatbot审核内置表单无需身份验证 self.chatbot.find_check(check_chatbotname=self.chatbot.other, check_type='信息变更') # 查询出待审核的chatbot数据 value3 = self.chatbot.getpagecode() if value2 in value3: self.chatbot.check_chatbot() # 审核通过chatbot self.chatbot.find_update_chatbot() #查询变更后的chatbot code = self.chatbot.getpagecode() screenshoot.screen_shoot(self.driver, '\chatbot', '变更chatbot归属csp与客户') try: self.assertIn(value2, code) except Exception: test_cspchatbot_log.csp_log.exception( f'Assertion Failed,case is not pass---------{value2} is NOT in page ' ) writedata.update_data( 5, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") raise else: test_cspchatbot_log.csp_log.info( f'Assertion Successed,case is pass---------{value2} is in page ' ) writedata.update_data( 5, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") else: text = False try: self.assertTrue(text) except Exception: test_cspchatbot_log.csp_log.exception( 'chatbot归属csp与客户变更失败') writedata.update_data( 5, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") raise else: text = False try: self.assertTrue(text) except Exception: test_cspchatbot_log.csp_log.exception('查询的chatbot不存在') writedata.update_data( 5, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") raise
def testcase38(self): """ 测试重新启用账号 :return: """ self.system = SyStem_Management_Page(self.driver) value = self.system.assert_text(text=self.system.add_value[10]) self.system.wait(40) self.system.F5() self.login.other_login() self.system.intouser() self.system.find_user(username=self.system.add_value[10], realname=self.system.add_value[13], userstatus='禁用') # 查询账号 code = self.system.getpagecode() if value in code: self.system.start_user() self.login.csplogin(newname=self.system.add_value[10], newpws=self.system.add_value[14]) self.system.wait(3) value2 = self.login.get_url() self.system.wait(4) screenshoot.screen_shoot(self.driver, r'\system', '-05重新启用账号登录成功') self.system.wait(1) self.system.intouser() self.system.find_user(username=self.system.add_value[10], realname=self.system.add_value[13]) # 查询账号 self.system.refresh() try: self.assertEqual(self.login.url, value2) except Exception: writedata.update_data( 6, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") test_system_log.csp_log.exception( f'Assertion Failed,case is not passed------{self.login.url}!={value2} ' ) raise else: test_system_log.csp_log.info( f'Assertion Success,case is passed------{self.login.url}={value2}' ) writedata.update_data( 6, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行通过") else: text = False try: self.assertTrue(text) except Exception: test_system_log.csp_log.exception( f'未查询待启用的账号数据----{self.system.add_value[10]}--------请重新调试案例' ) writedata.update_data( 6, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") raise
def testcase09(self): """ 测试变更客户归属csp :return: """ self.custmoer = CustmoerPage(self.driver) value4 = self.custmoer.assert_text(text=self.custmoer.update_user[3]) if self.custmoer.assert_find(findname=self.custmoer.update_user[3], asserttext=self.custmoer.update_user[3]): self.custmoer.update_csp() self.custmoer.finding_check(way_number=False, checkname=self.custmoer.update_user[3], check_way='信息变更') # 无需身份验证查询待审核的数据 self.custmoer.click_check() # 变更审核通过 self.custmoer.find_name(customername=self.custmoer.update_user[3], belog_csp=self.custmoer.update_user[4], customer_type=self.custmoer.update_user[5]) screenshoot.screen_shoot(self.driver, r'\customer', '客户归属csp变更') value3 = self.custmoer.getpagecode() try: self.assertIn(value4, value3) except Exception: writedata.update_data( 5, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") test_cspcustmoer_log.csp_log.exception( f'断言失败,案例不通过---客户信息变更失败') raise else: test_cspcustmoer_log.csp_log.info( f'断言成功,案例--案例通过---客户归属csp由“{self.custmoer.check[4]}”变更为{self.custmoer.update_user[5]}' ) writedata.update_data( 5, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行通过") else: text = False try: self.assertTrue(text) except Exception: test_cspcustmoer_log.csp_log.exception( f'未查询到待审核的数据----{self.custmoer.update_user[3]}--------请重新调试案例' ) writedata.update_data( 5, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") raise
def testcase16(self): """ 测试变更cahtbot配置 :return: """ self.chatbot = ChatbotPage(self.driver) value = self.chatbot.assert_chatbotname( chatbot_name=self.chatbot.update_value[0]) if self.chatbot.assert_find(findname=self.chatbot.update_value[0], assert_text=value): self.chatbot.into_lookover() #点击查看按钮进入查看页面 self.chatbot.update_speed() #变更chatbot速率 self.chatbot.find_chatbot( chatbotname=self.chatbot.update_value[0]) #管理节点查询出chatbot数据 self.chatbot.into_lookover() # 点击查看按钮进入查看页面 value4 = self.chatbot.getpagecode() screenshoot.screen_shoot(self.driver, '\chatbot', '变更chatbot速率配置') value3 = self.chatbot.assert_chatbot_rate() self.chatbot.wait(2) try: self.assertIn(value3, value4) except Exception: test_cspchatbot_log.csp_log.exception( f'Assertion Failed,case is not pass---------{value3} is not in page ' ) writedata.update_data( 5, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") raise else: test_cspchatbot_log.csp_log.info( f'Assertion Successed,case is pass---------{value3} is in page ' ) writedata.update_data( 5, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行通过") else: text = False try: self.assertTrue(text) except Exception: test_cspchatbot_log.csp_log.exception('查询的chatbot不存在') writedata.update_data( 5, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") raise
def testcase12(self): """ 测试新建一个chatbot且审核通过 :return: """ self.login.csp_login() self.login.wait(0.5) self.chatbot = ChatbotPage(self.driver) value = self.chatbot.assert_chatbotname() self.chatbot.add_chatbot() #新增一个chatbot self.chatbot.intocheck(way=True) #进入chatbot审核内置表单 self.chatbot.find_check() #查询出待审核的chatbot数据 value2 = self.chatbot.getpagecode() if value in value2: self.chatbot.check_chatbot() #开始审核chatbot且审核通过 self.chatbot.find_chatbot() #管理节点再次查询出查询chatbot screenshoot.screen_shoot(self.driver, r'\chatbot', '新增chatbot且审核通过') value3 = self.chatbot.getpagecode() try: self.assertIn(value, value3) except Exception: test_cspchatbot_log.csp_log.exception( f'Assertion Failed,case is not pass---------{value} is not in page ' ) writedata.update_data( 2, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") raise else: test_cspchatbot_log.csp_log.info( f'Assertion Successed,case is pass---------{value} is in page ' ) writedata.update_data( 2, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行通过") else: text = False try: self.assertTrue(text) except Exception: test_cspchatbot_log.csp_log.exception( f'查询数据{self.chatbot.update_value[0]}失败') writedata.update_data( 2, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") raise
def testcase20(self): """ 测试新建csp且审核不通过 :return: """ self.login.csp_login() self.login.wait(0.5) self.csp = CspPage(self.driver) newname = self.csp.random_number() value = self.csp.get_assert_text(text=newname) self.csp.new_csp(name=newname) # 新增一个csp self.csp.intocheck(way=True) # 进入csp审核节点 self.csp.find_check_csp(cspname=newname) # 查询待审核的csp数据 code = self.csp.getpagecode() if value in code: self.csp.starting_check(result='20') # 审核不通过 self.csp.intocheck(way=False) self.csp.find_check_csp(cspname=newname, way='10', check_result='审核不通过') # 查询已经审核通过的数据 code2 = self.csp.getpagecode() screenshoot.screen_shoot(self.driver, r'\csp', '-01csp审核不通过创建失败') try: self.assertIn(value, code2) except Exception: csp_testlog.csp_log.exception( f'Assertion Failed,case is not pass---------新建csp{self.csp.add_value[0]}失败--{value} is not in page' ) writedata.update_data( 3, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") raise else: csp_testlog.csp_log.info( f'Assertion Successed,case is passed---------新建csp{self.csp.add_value[0]}成功--{value} in page' ) writedata.update_data( 3, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行通过") else: screenshoot.screen_shoot(self.driver, r'\csp', '-01新建csp失败') csp_testlog.csp_log.exception(f'查询的待审核数据{newname}---不存在') writedata.update_data( 3, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") text = False self.assertTrue(text)
def testcase36(self): """ 测试变更密码再次登录可成功 :return: """ self.system = SyStem_Management_Page(self.driver) value = self.system.assert_text(text=self.system.add_value[10]) pws = self.system.add_value[14] self.system.intouser() # 进入内置表单 self.system.find_user(username=self.system.add_value[10], realname=self.system.add_value[13]) # 查询账号 code = self.system.getpagecode() if value in code: self.system.update_user(way=False, updatepws=pws) #更新密码 self.login.csplogin(newname=self.system.add_value[10], newpws=pws) self.login.wait(2) screenshoot.screen_shoot(self.driver, r'\system', '-02变更账号密码登录成功') value2 = self.login.get_url() try: self.assertEqual(self.login.url, value2) except Exception: writedata.update_data( 4, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") test_system_log.csp_log.exception( f'Assertion Failed,case is not passed------{self.login.url}!={value2} ' ) raise else: test_system_log.csp_log.info( f'Assertion Success,case is passed------{self.login.url}={value2}' ) writedata.update_data( 4, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行通过") else: text = False try: self.assertTrue(text) except Exception: test_system_log.csp_log.exception( f'未查询待变更的账号数据----{self.system.add_value[0]}--------请重新调试案例' ) writedata.update_data( 4, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") raise
def testcase37(self): """ 测试停用账号 :return: """ self.system = SyStem_Management_Page(self.driver) value = self.system.assert_text(text=self.system.add_value[10]) self.system.intouser() self.system.find_user(username=self.system.add_value[10], realname=self.system.add_value[13]) # 查询账号 code = self.system.getpagecode() if value in code: self.system.stop_user() #停用账号 self.login.csplogin(newname=self.system.add_value[10], newpws=self.system.add_value[14]) self.login.wait(2) screenshoot.screen_shoot(self.driver, r'\system', '-03账户已被冻结登录失败') value2 = self.login.get_url() try: self.assertNotEqual(self.login.url, value2) except Exception: writedata.update_data( 5, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") test_system_log.csp_log.exception( f'Assertion Failed,case is not passed------{self.login.url}={value2} ' ) raise else: test_system_log.csp_log.info( f'Assertion Success,case is passed------{self.login.url}!={value2}' ) writedata.update_data( 5, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行通过") else: text = False try: self.assertTrue(text) except Exception: test_system_log.csp_log.exception( f'未查询待停用的账号数据----{self.system.add_value[10]}--------请重新调试案例' ) writedata.update_data( 5, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") raise
def testcase17(self): """ 测试注销chatbot :return: """ self.chatbot = ChatbotPage(self.driver) value2 = self.chatbot.assert_chatbotname( chatbot_name=self.chatbot.add_value[15]) if self.chatbot.assert_find(findname=self.chatbot.add_value[15], assert_text=value2): self.chatbot.into_lookover() #点击查看按钮进入查看页面 self.chatbot.delete_chatbot() #注销chatbot self.chatbot.find_chatbot( chatbotname=self.chatbot.add_value[15]) # 管理节点查询出chatbot数据 self.chatbot.wait(2) value3 = self.chatbot.getpagecode() screenshoot.screen_shoot(self.driver, '\chatbot', '注销chatbot') try: self.assertNotIn(value2, value3) except Exception: test_cspchatbot_log.csp_log.exception( f'Assertion Failed,case is not pass---------{value2} is in page ' ) writedata.update_data( 6, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") raise else: test_cspchatbot_log.csp_log.info( f'Assertion Successed,case is pass---------{value2} is not in page ' ) writedata.update_data( 6, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行通过") else: text = False try: self.assertTrue(text) except Exception: test_cspchatbot_log.csp_log.exception( f'查询数据{self.chatbot.update_value[0]}失败') writedata.update_data( 6, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") raise
def testcase13(self): """ 测试新增一个chatbot且审核不通过 :return: """ self.chatbot = ChatbotPage(self.driver) checkname = self.chatbot.random_number() value = self.chatbot.assert_chatbotname(chatbot_name=checkname) self.chatbot.add_chatbot(name=checkname) #新增一个chatbot self.chatbot.intocheck(way=False) #进入chatbot审核内置表单无需身份验证 self.chatbot.find_check(check_chatbotname=checkname) #查询出待审核的数据 value2 = self.chatbot.getpagecode() if value in value2: self.chatbot.check_chatbot(result='2') #审核不通过chatbot self.chatbot.find_chatbot(chatbotname=checkname) #管理节点查询出chatbot数据 value3 = self.chatbot.getpagecode() screenshoot.screen_shoot(self.driver, '\chatbot', '新增chatbot审核不通过') self.chatbot.wait(2) try: self.assertNotIn(value, value3) except Exception: test_cspchatbot_log.csp_log.exception( f'Assertion Failed,case is not pass---------{value} is in page ' ) writedata.update_data( 3, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") raise else: test_cspchatbot_log.csp_log.info( f'Assertion Successed,case is pass---------{value} is not in page ' ) writedata.update_data( 3, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行通过") else: text = False try: self.assertTrue(text) except Exception: test_cspchatbot_log.csp_log.exception(f'查询数据{checkname}失败') writedata.update_data( 3, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") raise
def testcase32(self): """ 测试文件导入创建csp且审核通过 :return: """ self.login.csp_login() self.login.wait(0.5) self.csp = CspPage(self.driver) newcsp = self.csp.random_number() value = self.csp.get_assert_text(text=newcsp) self.csp.other_add(add_name=newcsp) self.csp.intocheck(way=True) # 进入审核内置表单 self.csp.find_check_csp(cspname=newcsp) # 查询出待审核的数据 code = self.csp.getpagecode() if value in code: self.csp.starting_check() # 审核通过 self.csp.intocheck(way=False) self.csp.find_check_csp(cspname=newcsp, way='10') # 查询已经审核通过的数据 screenshoot.screen_shoot(self.driver, r'\csp', '-11文件导入新建csp成功') code2 = self.csp.getpagecode() try: self.assertIn(value, code2) except Exception: csp_testlog.csp_log.exception( f'Assertion Failed,case is not pass-----导入文件新建csp失败--{value} is not in page' ) writedata.update_data( 13, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") raise else: csp_testlog.csp_log.info( f'Assertion Successed,case is pass-------导入文件新建csp成功--{value} in page ' ) writedata.update_data( 13, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行通过") else: screenshoot.screen_shoot(self.driver, '\csp', '-11待审核的csp查询不到') csp_testlog.csp_log.exception(f'查询的数据--{newcsp}不存在') writedata.update_data( 13, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") text = False self.assertTrue(text)
def testcase07(self): """ 测试新增客户审核不通过 :return: """ self.custmoer = CustmoerPage(self.driver) new_name = self.custmoer.random_number() value = self.custmoer.assert_text(text=new_name) self.custmoer.add_customer(name=new_name, number='18360766327') # 新建客户 self.custmoer.finding_check(way_number=False, checkname=new_name) #无需身份验证查询待审核的数据 value2 = self.custmoer.getpagecode() if value in value2: self.custmoer.click_check(result='1') #客户信息新建审核不通过 self.custmoer.find_name(customername=new_name) #查询数据 screenshoot.screen_shoot(self.driver, r'\customer', '新增客户审核不通过') value3 = self.custmoer.getpagecode() try: self.assertNotIn(value, value3) except Exception: writedata.update_data( 3, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") test_cspcustmoer_log.csp_log.exception( f'断言失败,案例--testcase02不通过-----{value} 在当前页面') raise else: test_cspcustmoer_log.csp_log.info( f'断言成功,案例--testcase02通过------{value} 不在当前页面---审核通过') writedata.update_data( 3, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行通过") else: text = False try: self.assertTrue(text) except Exception: test_cspcustmoer_log.csp_log.exception( f'未查询到待审核的数据----{self.custmoer.add_value[0]}--------请重新调试案例' ) writedata.update_data( 3, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") raise
def testcase06(self): """ 测试新增客户且审核通过 :return: """ self.login.csp_login() self.login.wait(0.5) self.custmoer = CustmoerPage(self.driver) value = self.custmoer.assert_text(self.custmoer.add_value[0]) self.custmoer.add_customer() # 新建客户 self.custmoer.finding_check(way_number=True) # 需身份验证查询待审核的数据 value2 = self.custmoer.getpagecode() if value in value2: self.custmoer.click_check() # 客户信息新建审核通过 self.custmoer.find_name() # 查询数据 screenshoot.screen_shoot(self.driver, r'\customer', '新增客户审核通过') value3 = self.custmoer.getpagecode() try: self.assertIn(value, value3) except Exception: test_cspcustmoer_log.csp_log.exception( f'断言失败,案例--testcase02不通过-----{value} 不在当前页面') writedata.update_data( 2, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") raise else: test_cspcustmoer_log.csp_log.info( f'断言成功,案例--testcase02通过------{value} 在当前页面') writedata.update_data( 2, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行通过") else: text = False try: self.assertTrue(text) except Exception: test_cspcustmoer_log.csp_log.exception( f'未查询到待审核的数据----{self.custmoer.add_value[0]}--------请重新调试案例' ) writedata.update_data( 2, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") raise
def testcase29(self): """ 测试下架csp :return: """ self.csp = CspPage(self.driver) value = self.csp.get_assert_text() value2 = '上架状态:已下架' self.csp.find_csp_data() # 查询出数据 code = self.csp.getpagecode() if value in code: self.csp.look_csp_data() # 进入查看页面 self.csp.grounding_off() #操作下架 self.csp.wait(1) self.csp.look_gronding(status=False) #查询已经下架的csp self.csp.look_csp_data() value1 = self.csp.getpagecode() screenshoot.screen_shoot(self.driver, r'\csp', '-10csp下架成功') try: self.assertIn(value2, value1) except Exception: csp_testlog.csp_log.exception( f'Assertion Failed,case is not pass---------{value2} not in page --{self.csp.add_value[0]} 已经上架 ' ) writedata.update_data( 11, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") raise else: csp_testlog.csp_log.info( f'Assertion Successed,case is pass---------{value2} in page --{self.csp.add_value[0]} 未上架 ' ) writedata.update_data( 11, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行通过") else: screenshoot.screen_shoot(self.driver, '\csp', '-10未查询到待下架的csp') csp_testlog.csp_log.exception(f'查询的数据--{self.csp.add_value[0]}不存在') text = False self.assertTrue(text) writedata.update_data( 11, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过")
def testcase03(self): """ 测试图形验证码为空 :return: """ self.login.user() self.login.loginbutton() screenshoot.screen_shoot(self.driver, r'\login', 'csp_photo_null') value = '图形验证码不能为空。' value2 = self.login.getpagecode() try: self.assertIn(value, value2) except Exception: test_csplogin_log.csp_log.exception( f'Assertion Failed,case is not pass---------“{value}” is not in page ' ) raise else: test_csplogin_log.csp_log.info( f'Assertion Successed,case is pass---------“{value}” is in page ' )
def testcase24(self): """ 测试变更csp token且审核通过 :return: """ self.csp = CspPage(self.driver) value = self.csp.get_assert_text(text=self.csp.updatecsp) if self.csp.assert_find(findname=self.csp.updatecsp, assert_text=value): self.csp.look_csp_data() # 进入查看页面 self.csp.update_csp('3') # 更新token self.csp.intocheck(way=True) # 进入审核内置表单无需身份验证 self.csp.find_check_csp(cspname=self.csp.updatecsp, check_way='信息变更') # 查询出待审核的数据 code2 = self.csp.getpagecode() if value in code2: self.csp.starting_check() # 审核通过 self.csp.wait(2) self.csp.intocheck(way=False) #进入审核内置表单 self.csp.click_element(self.csp.check[1][11], self.csp.check[2][11]) # 点击已审核 #self.csp.find_check_csp(cspname=self.csp.updatecsp,way='10') #查询已审核的数据 self.csp.look_checked_csp() #点击查看已经审核的数据 value2 = self.csp.look_update('1') # 查看csptoken变更前后内容 self.csp.wait(2) screenshoot.screen_shoot(self.driver, r'\csp', '-05变更csp--token成功') try: self.assertTrue(value2) except Exception: csp_testlog.csp_log.exception( f'Assertion Failed,case is not pass---------csp token变更失败--判断条件为{value2} ' ) writedata.update_data( 8, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") raise else: csp_testlog.csp_log.info( f'Assertion Successed,case is pass---------csp token变更成功--判断条件为{value2}' ) writedata.update_data( 8, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行通过") else: screenshoot.screen_shoot(self.driver, r'\csp', '-05待审核数据不存在') csp_testlog.csp_log.exception( f'查询的数据--{self.csp.add_value[0]}不存在') writedata.update_data( 8, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") text = False self.assertTrue(text) else: screenshoot.screen_shoot(self.driver, r'\csp', '-05查询的csp不存在') csp_testlog.csp_log.exception(f'查询的数据--{self.csp.add_value[0]}不存在') writedata.update_data( 8, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") text = False self.assertTrue(text)
def testcase05(self): """ 测试登录成功 :return: """ self.login.csp_login() self.login.wait(2) screenshoot.screen_shoot(self.driver, r'\login', 'csp_login') value = self.login.url value2 = self.login.get_url() try: self.assertEqual(value, value2) except Exception: test_csplogin_log.csp_log.exception( f'Assertion Failed,case is not pass---------“{value}” is not equal to “{value2}”' ) raise else: test_csplogin_log.csp_log.info( f'Assertion Successed,case is pass-----------“{value}” is equal to “{value2}”' )
def testcase21(self): """ 测试新建csp且审核通过 :return: """ self.csp = CspPage(self.driver) value = self.csp.get_assert_text() self.csp.new_csp() #新增一个csp self.csp.intocheck(way=False) #进入csp审核节点 self.csp.find_check_csp() #查询待审核的csp数据 code = self.csp.getpagecode() if value in code: self.csp.wait(1) self.csp.starting_check() #审核通过 self.csp.intocheck(way=False) self.csp.find_check_csp(way='10') #查询已经审核通过的数据 screenshoot.screen_shoot(self.driver, r'\csp', '-02csp审核通过新增成功') code2 = self.csp.getpagecode() try: self.assertIn(value, code2) except Exception: csp_testlog.csp_log.exception( f'Assertion Failed,case is not pass---------新建csp{self.csp.add_value[0]}失败--{value} is not in page' ) writedata.update_data( 2, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") raise else: csp_testlog.csp_log.info( f'Assertion Successed,case is passed---------新建csp{self.csp.add_value[0]}成功--{value} in page' ) writedata.update_data( 2, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行通过") else: screenshoot.screen_shoot(self.driver, r'\csp', '-02待审核数据不存在') writedata.update_data( 2, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") text = False self.assertTrue(text)
def testcase01(self): """ 测试账号为空 :return: """ self.login.open() self.login.user(email='') self.login.loginbutton() screenshoot.screen_shoot(self.driver, r'\login', 'csp_username_null') value = '账号不能为空。' value2 = self.login.getpagecode() try: self.assertIn(value, value2) except Exception: test_csplogin_log.csp_log.exception( f'Assertion Failed,case is not pass---------{value} is not in page' f'error_message{traceback.print_tb(sys.exc_info()[2])}') print('案例不通过') else: test_csplogin_log.csp_log.info( f'Assertion Successed,case is pass---------{value} is in page ' )
def testcase33(self): """ 测试数据复原 :return: """ self.csp = CspPage(self.driver) value = self.csp.get_assert_text(text=self.csp.updatecsp) if self.csp.assert_find(findname=self.csp.updatecsp, assert_text=value, findtype=self.csp.update_value[1]): self.csp.look_csp_data() # 进入查看页面 self.csp.refresh() self.csp.F5() self.csp.intocheck(way=False) # 进入审核内置表单 self.csp.find_check_csp(cspname=self.csp.updatecsp, check_csp_type=self.csp.update_value[1], check_way='信息变更') # 查询出待审核的数据 code2 = self.csp.getpagecode() if value in code2: self.csp.starting_check() # 审核通过 self.csp.find_csp_data(name=self.csp.updatecsp, csp_type=self.csp.add_value[2]) # 查询出数据 code3 = self.csp.getpagecode() screenshoot.screen_shoot(self.driver, r'\csp', '-14变更csp与客户类型成功') try: self.assertIn(value, code3) except Exception: csp_testlog.csp_log.exception( f'Assertion Failed,case is not pass---------csp类型变更审核失败--{value} not in page ' ) writedata.update_data( 7, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") raise else: csp_testlog.csp_log.info( f'Assertion Successed,case is pass---------csp类型变更审核通过成功--{value} in page ' ) writedata.update_data( 7, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行通过") else: screenshoot.screen_shoot(self.driver, r'\csp', '-14查询的待审核csp不存在') csp_testlog.csp_log.exception( f'查询的数据--{self.csp.updatecsp}不存在') writedata.update_data( 7, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") text = False self.assertTrue(text) else: screenshoot.screen_shoot(self.driver, r'\csp', '-14查询的csp不存在') csp_testlog.csp_log.exception(f'查询的数据--{self.csp.updatecsp}不存在') writedata.update_data( 7, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") text = False self.assertTrue(text)
def testcase10(self): """ 测试删除客户 :return: """ self.custmoer = CustmoerPage(self.driver) value = self.custmoer.assert_text(text=self.custmoer.add_value[24]) if self.custmoer.assert_find(findname=self.custmoer.add_value[24], asserttext=value): self.custmoer.delete_user() #进入查看客户信息页面操作注销该客户 self.custmoer.find_name( customername=self.custmoer.add_value[24]) #查询已经审核通过的客户数据 screenshoot.screen_shoot(self.driver, r'\customer', '删除客户') self.custmoer.wait(0.5) value3 = self.custmoer.getpagecode() try: self.assertNotIn(value, value3) except Exception: writedata.update_data( 5, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") test_cspcustmoer_log.csp_log.exception(f'断言失败,案例不通过---删除失败') raise else: test_cspcustmoer_log.csp_log.info(f'断言成功,案例--案例通过---删除成功') writedata.update_data( 5, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行通过") else: text = False try: self.assertTrue(text) except Exception: test_cspcustmoer_log.csp_log.exception( f'未查询到待删除的数据----{self.custmoer.add_value[0]}--------请重新调试案例' f'原因可能是案例一失败') writedata.update_data( 5, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") raise
def testcase22(self): """ 测试变更csp客户类型且审核不通过 :return: """ self.csp = CspPage(self.driver) value = self.csp.get_assert_text(text=self.csp.updatecsp) if self.csp.assert_find(findname=self.csp.updatecsp, assert_text=value): csp_testlog.csp_log.info(f'查询到带变更的数据{self.csp.updatecsp}') self.csp.look_csp_data() # 点击查看按钮 self.csp.update_csp('1') # 点击编辑按钮更新客户类型(变更为代理商) self.csp.intocheck(way=False) # 进入审核内置表单 self.csp.find_check_csp(cspname=self.csp.updatecsp, check_way='信息变更') # 查询出待审核的数据 code2 = self.csp.getpagecode() if value in code2: csp_testlog.csp_log.info(f'查询到待变更的数据{self.csp.updatecsp}') value2 = self.csp.get_assert_look_text( element_text=self.csp.update_value[0]) self.csp.starting_check(result='10') # 审核不通过 self.csp.find_csp_data(name=self.csp.updatecsp) # 查询出数据 self.csp.look_csp_data() # 进入查看csp信息页面 screenshoot.screen_shoot(self.driver, r'\csp', '-03客户类型变更失败') code3 = self.csp.getpagecode() try: self.assertNotIn(value2, code3) except Exception: csp_testlog.csp_log.exception( f'Assertion Failed,case is not pass---------csp客户类型变更审核失败--{value2} in page ' ) writedata.update_data( 4, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") raise else: csp_testlog.csp_log.info( f'Assertion Successed,case is pass-----csp客户类型变更审核不通过成功--{value2} is not in page' ) writedata.update_data( 4, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行通过") else: screenshoot.screen_shoot(self.driver, '\csp', '-03修改客户类型失败') csp_testlog.csp_log.exception( f'未查询到待审核的数据---{self.csp.updatecsp}') writedata.update_data( 4, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") text = False self.assertTrue(text) else: screenshoot.screen_shoot(self.driver, r'\csp', '-03查询的csp不存在') csp_testlog.csp_log.exception(f'未查询到带变更的数据---{self.csp.updatecsp}') writedata.update_data( 4, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") text = False self.assertTrue(text)
def testcase18(self): """ 复原chatbot配置 :return: """ self.chatbot = ChatbotPage(self.driver) value2 = self.chatbot.assert_chatbotname( chatbot_name=self.chatbot.other) value3 = self.chatbot.assert_chatbot_rate(chatbot_rate='50') if self.chatbot.assert_find(findname=self.chatbot.other, assert_text=value2): self.chatbot.into_lookover() # 点击查看按钮进入查看页面 self.chatbot.update_speed(speed='50') # 变更chatbot速率 self.chatbot.find_chatbot( chatbotname=self.chatbot.other) # 查询chatbot self.chatbot.into_lookover() value4 = self.chatbot.getpagecode() screenshoot.screen_shoot(self.driver, '\chatbot', '变更chatbot速率配置') try: self.assertIn(value3, value4) except Exception: test_cspchatbot_log.csp_log.exception( f'Assertion Failed,case is not pass---------{value3} is not in page ' ) raise else: test_cspchatbot_log.csp_log.info( f'Assertion Successed,case is pass---------{value3} is in page ' ) else: text = False try: self.assertTrue(text) except Exception: test_cspchatbot_log.csp_log.exception('查询的chatbot不存在') raise
def testcase26(self): """ 测试更新csp类型且审核不通过 :return: """ self.csp = CspPage(self.driver) value = self.csp.get_assert_text(text=self.csp.updatecsp) if self.csp.assert_find(findname=self.csp.updatecsp, assert_text=value): self.csp.look_csp_data() # 进入查看页面 self.csp.update_csp('2') # 更新csp类型 self.csp.F5() self.csp.intocheck(way=False) # 进入审核内置表单 self.csp.find_check_csp(cspname=self.csp.updatecsp, check_way='信息变更') # 查询出待审核的数据 code2 = self.csp.getpagecode() if value in code2: self.csp.starting_check(result='10') # 审核不通过 self.csp.find_csp_data( name=self.csp.updatecsp, csp_type=self.csp.update_value[1]) # 查询出数据 code2 = self.csp.getpagecode() screenshoot.screen_shoot(self.driver, r'\csp', '-06变更csp类型失败') try: self.assertNotIn(value, code2) except Exception: csp_testlog.csp_log.exception( f'Assertion Failed,case is not pass---------csp类型变更审核失败--{value} in page ' ) writedata.update_data( 6, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") raise else: csp_testlog.csp_log.info( f'Assertion Successed,case is pass---------csp类型变更审核不通过成功--{value} is not in page ' ) writedata.update_data( 6, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行通过") else: screenshoot.screen_shoot(self.driver, r'\csp', '-06待变更数据不存在') csp_testlog.csp_log.exception( f'查询的数据--{self.csp.add_value[0]}不存在') text = False self.assertTrue(text) writedata.update_data( 6, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") else: screenshoot.screen_shoot(self.driver, r'\csp', '-06查询的csp不存在') csp_testlog.csp_log.exception(f'查询的数据--{self.csp.add_value[0]}不存在') text = False self.assertTrue(text) writedata.update_data( 6, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过")
def testcase28(self): """ 测试上架csp且审核通过 :return: """ self.csp = CspPage(self.driver) value = self.csp.get_assert_text() self.csp.find_csp_data() #查询出数据 code = self.csp.getpagecode() if value in code: self.csp.look_csp_data() #进入查看页面 self.csp.grounding_on() #操作上架 self.csp.grouding_check_form(grounding_way=False) #进入上架审核内置表单 self.csp.find_grounding_data() #查询出待审核的上架申请 code2 = self.csp.getpagecode() if value in code2: self.csp.check_grounding() #审核通过 self.csp.look_gronding(status=True) #查询已经上架的csp screenshoot.screen_shoot(self.driver, r'\csp', '-09csp上架成功') value = self.csp.get_assert_text() #获取文本 self.csp.wait(2) value2 = self.csp.getpagecode() try: self.assertIn(value, value2) except Exception: csp_testlog.csp_log.exception( f'Assertion Failed,case is not pass---------{self.csp.add_value[0]} 上架失败,{value} is not in page' ) writedata.update_data( 10, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") raise else: csp_testlog.csp_log.info( f'Assertion Successed,case is pass---------{self.csp.add_value[0]} 上架成功 {value} in page ' ) writedata.update_data( 10, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行通过") else: screenshoot.screen_shoot(self.driver, r'\csp', '-09未查询到待审核的上架申请') csp_testlog.csp_log.exception( f'查询的数据--{self.csp.add_value[0]}不存在') text = False self.assertTrue(text) writedata.update_data( 10, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") else: screenshoot.screen_shoot(self.driver, r'\csp', '-09未查询到待上架的csp') csp_testlog.csp_log.exception(f'查询的数据--{self.csp.add_value[0]}不存在') text = False self.assertTrue(text) writedata.update_data( 10, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过")
def testcase23(self): """ 测试更新csp客户类型且审核通过 :return: """ self.csp = CspPage(self.driver) value = self.csp.get_assert_text(text=self.csp.updatecsp) if self.csp.assert_find(findname=self.csp.updatecsp, assert_text=value): self.csp.look_csp_data() # 点击查看按钮 self.csp.update_csp('1') # 点击编辑按钮更新客户类型 self.csp.intocheck(way=False) # 进入审核内置表单 self.csp.find_check_csp(cspname=self.csp.updatecsp, check_way='信息变更') # 查询出待审核的数据 code2 = self.csp.getpagecode() if value in code2: value2 = self.csp.get_assert_look_text( element_text=self.csp.update_value[0]) self.csp.starting_check() # 审核通过 self.csp.find_csp_data(name=self.csp.updatecsp) # 查询出数据 self.csp.look_csp_data() # 进入查看csp信息页面 screenshoot.screen_shoot(self.driver, '\csp', '-04变更客户类型成功') code3 = self.csp.getpagecode() try: self.assertIn(value2, code3) except Exception: csp_testlog.csp_log.exception( f'Assertion Failed,case is not pass---------csp客户类型变更审核失败--{value2} not in page ' ) writedata.update_data( 5, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") raise else: csp_testlog.csp_log.info( f'测试案例通过------csp{self.csp.updatecsp}的客户类型变更为{self.csp.update_value[0]}' ) writedata.update_data( 5, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行通过") else: screenshoot.screen_shoot(self.driver, r'\csp', '-04待审核数据不存在') csp_testlog.csp_log.exception( f'未查询到待审核的数据---{self.csp.add_value[0]}') writedata.update_data( 5, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") text = False self.assertTrue(text) else: screenshoot.screen_shoot(self.driver, r'\csp', '-04查询的csp不存在') csp_testlog.csp_log.exception( f'未查询到待变更的数据---{self.csp.add_value[0]}') writedata.update_data( 5, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") text = False self.assertTrue(text)
def testcase14(self): """ 测试变更chatbot多个信息审核不通过 :return: """ self.chatbot = ChatbotPage(self.driver) value2 = self.chatbot.assert_chatbotname( chatbot_name=self.chatbot.other) if self.chatbot.assert_find(findname=self.chatbot.other, assert_text=value2): self.chatbot.into_lookover() #点击查看按钮进入查看页面 self.chatbot.update_name() #变更chatbot信息 self.chatbot.intocheck(way=False) #进入chatbot审核内置表单无需身份验证 self.chatbot.find_check(check_chatbotname=self.chatbot.other, check_type='信息变更') #查询出待审核的chatbot数据 value3 = self.chatbot.getpagecode() if value2 in value3: self.chatbot.check_chatbot( result='10', check_way=self.chatbot.checkdata[2][15]) #审核不通过chatbot self.chatbot.find_chatbot(chatbotname=self.chatbot. update_value[0]) #查询出变更后的chatbot数据 self.chatbot.wait(2) value5 = self.chatbot.getpagecode() screenshoot.screen_shoot(self.driver, '\chatbot', '变更chatbot名称') value4 = self.chatbot.assert_chatbotname( chatbot_name=self.chatbot.update_value[0]) try: self.assertNotIn(value4, value5) except Exception: test_cspchatbot_log.csp_log.exception( f'Assertion Failed,case is not pass---------{value4} is in page ' ) writedata.update_data( 4, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") raise else: test_cspchatbot_log.csp_log.info( f'Assertion Successed,case is pass---------{value4} is NOT in page ' ) writedata.update_data( 4, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") else: text = False try: self.assertTrue(text) except Exception: test_cspchatbot_log.csp_log.exception('chatbot名称变更失败') writedata.update_data( 4, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") raise else: text = False try: self.assertTrue(text) except Exception: test_cspchatbot_log.csp_log.exception('查询的chatbot不存在') writedata.update_data( 4, 9, f"{time.strftime('%Y-%m-%d %H:%M:%S')}案例执行不通过") raise