Ejemplo n.º 1
0
 def test_chgMainOffer(self,dic):
     """商品主套餐变更"""
     logger.info("开始参数化......")
     accessNum = str(dic.get('ACCESS_NUM'))
     logger.info("测试号码:"+accessNum)
     offerId = str(dic.get('OFFER_ID'))
     logger.info("主套餐名称:" + offerId)
     subOfferList = dic.get('subOfferList')
     logger.info("可选子商品:" + subOfferList)
     logger.info('开始执行第{}个用例,测试数据:{}'.format(row,dic))
     ##开始执行测试
     test = OfferOperPage(self.driver)
     title = '个人商品订购测试记录'
     test.add_dochead(title)
     test.Open_SubOffer(accessNum, offerId)  # 直接进入商品订购界面
     time.sleep(20)
     ruleMsg = PageAssert(self.driver).assert_error()
     # ruleMsg = PageAssert(self.driver).check_BusiRule(file,row)
     logger.info('进入时校验:{}'.format(ruleMsg))
     ruleMsg = offerId + ' ' + ruleMsg
     if '校验失败' in ruleMsg:
         write_xlsBycolName_append(file,row=row,colName='RULE_CHECK',value=ruleMsg)
     self.assertNotIn('校验失败',ruleMsg)
     time.sleep(5)
     test.choose_subOffer(subOfferList)  # 可选商品列表
     Loc_submit = (By.ID,'CSSUBMIT_BUTTON')
     test.screen_step('点击订购')
     test.find_element_click(Loc_submit)
     time.sleep(10)
     logger.info("处理页面返回信息.....")
     submitMsg = PageAssert(self.driver).assert_submitAfter(file=file,row=row)
     logger.info('业务受理信息:{}'.format(submitMsg))
     test.screen_step('点击提交,受理信息:{}'.format(submitMsg))
     test.save_docreport(title)
     self.assertIn('业务受理成功',submitMsg)
Ejemplo n.º 2
0
 def test_acceptStopOrOpen(self, dic):
     """停开机业务受理"""
     logger.info("开始参数化......")
     print('开始执行用例,测试数据:{}'.format(dic))
     accessNum = str(dic.get('ACCESS_NUM'))
     busicode = str(dic.get('BUSI_CODE'))  #SQL读入
     #根据Busicode 获取对应的行号
     row = get_TestData('SubscriberStop'
                        )['FuncRow'] if busicode == '131' else get_TestData(
                            'SubscriberOpen')['FuncRow']
     ####测试用例步骤
     test = ChangeProdStatus(self.driver)
     title = '停开机业务受理测试'
     test.add_dochead(title)
     test.Open_PersonMenu(accessNum,
                          password='******',
                          cataMenuId='crm9200',
                          menuId='crm9247')  #登录并进入停开机业务受理菜单
     test.open_ChangeProdStatusFrame()
     test.screen_step('进入菜单,选择停开机业务类型')
     test.select_BusiType(busicode)  # 选择停开机业务受理类型 【暂时在代码里面写死,根据需要修改】
     checkMsg = PageAssert(self.driver).check_BusiRule(file=file, row=row)
     self.assertNotIn('校验失败', checkMsg)  #加个断点
     loc_submit = (By.ID, 'CSSUBMIT_BUTTON')
     RuleMsg = PageAssert(self.driver).check_BusiRule(file=file, row=row)
     self.assertNotIn('业务校验失败', RuleMsg)
     print('业务规则校验通过')
     test.find_element_click(loc_submit)
     submitMsg = PageAssert(self.driver).assert_submitAfter(file=file,
                                                            row=row)
     logger.info('业务受理信息:{}'.format(submitMsg))
     test.screen_step('点击提交,受理信息:{}'.format(submitMsg))
     test.save_docreport(title)
     self.assertIn('业务受理成功', submitMsg)
     self.driver.close()
 def test_acceptRestoreUser(self, dic):
     """复机"""
     logger.info("开始参数化......")
     accessNum = str(dic.get('ACCESS_NUM'))
     simId = str(dic.get('SIMID'))  #SIM卡号参数化
     logger.info('开始执行第{}个用例,测试数据:{}'.format(row, dic))
     ####测试用例步骤
     test = RestoreSubscriber(self.driver)
     title = '个人业务复机测试记录'
     test.add_dochead(title)
     test.Open_PersonMenu(accessNum, cataMenuId='crm9300',
                          menuId='crm9313')  #登录并进入普通付费关系变更菜单
     time.sleep(2)
     test.open_RestoreSubscriberFrame()  #进入iframe
     # RuleMsg = test.vaild_BusiRule() #验证号码办理规则
     RuleMsg = PageAssert(self.driver).check_BusiRule(file=file, row=row)
     self.assertNotIn('业务校验失败', RuleMsg)
     # logger.info('复机业务规则验证结果:{}'.format(RuleMsg))
     # if '验证失败' in RuleMsg:
     #     write_xlsBycolName_append(file=file,row=row,colName='RESULT_INFO',value=RuleMsg)
     #     test.driver.close()
     time.sleep(3)
     test.InputSimAndVaild(simId)
     test.screen_step('复机时输入SIM卡并校验')
     test.submit()  #提交
     time.sleep(20)  #复机提交后时间长,延长强制等待
     submitMsg = PageAssert(self.driver).assert_submitAfter(
         file=file, row=row, index=0)  #写入结果到xls
     logger.info('业务受理信息:{}'.format(submitMsg))
     test.screen_step('点击提交,受理信息:{}'.format(submitMsg))
     test.save_docreport(title)
     self.assertIn('业务受理成功', submitMsg)
     self.driver.close()
Ejemplo n.º 4
0
 def test_CancelTrade(self, dic):
     """业务返销"""
     logger.info("开始参数化......")
     accessNum = dic.get('ACCESS_NUM')
     busicode = dic.get('BUSI_ITEM_CODE')  #业务操作类型
     logger.info('开始执行第{}个用例,测试数据:{}'.format(row, dic))
     ####测试用例步骤
     test = CancelTrade(self.driver)
     title = '业务返销测试记录'
     test.add_dochead(title)
     Btn_commit = (By.ID, 'CSSUBMIT_BUTTON')  #提交按钮
     test.Open_PersonMenu(accessNum, cataMenuId='crm9200',
                          menuId='crm9456')  #登录并进入业务返销菜单
     time.sleep(5)
     test.open_CancelTradeFrame()  #进入iframe
     test.query_CancelTradeByAccessNum(accessNum, busicode)  #查询业务返销信息
     test.screen_step('选择要返销的业务类型')
     RuleMsg = PageAssert(test.driver).check_BusiRule(file, row)
     self.assertNotIn('业务校验失败', RuleMsg)
     time.sleep(3)
     test.find_element_click(Btn_commit)
     helpMsg = PageAssert(test.driver).assert_HelpPage()
     if '校验通过' not in helpMsg:
         logger.info('弹出帮助提示信息:{}'.format(helpMsg))
     submitMsg = PageAssert(self.driver).assert_submitAfter(file=file,
                                                            row=row,
                                                            index=0)
     logger.info('业务受理信息:{}'.format(submitMsg))
     print('业务受理信息:{}'.format(submitMsg))
     test.screen_step('点击提交,受理信息:{}'.format(submitMsg))
     test.save_docreport(title)
     self.driver.close()
Ejemplo n.º 5
0
 def test_acceptMultiOffer(self,dic):
     """亲情网业务办理"""
     logger.info("开始参数化......")
     # row = int(dic.get('No'))   #标识行号,后续写入xls使用
     AccessNum = str(dic.get('ACCESS_NUM')) #家庭主号
     logger.info("主号:{}".format(AccessNum))
     mutiAccessNumList = dic.get('MebNumList').replace(' ','').split(',') #家庭成员列表获取的是Str,转换成List
     logger.info("副号码:{}" .format(mutiAccessNumList))
     logger.info('开始执行第{}个用例,测试数据:{}'.format(row,dic))
     print('开始执行第{}个用例,测试数据:{}'.format(row,dic))
     test = FamilyNetPage(self.driver)
     title = '受理亲情网省内版测试记录'
     test.add_dochead(title)
     Btn_commit = (By.ID, 'CSSUBMIT_BUTTON') #提交按钮
     test.Open_PersonMenu(AccessNum,password='******',cataMenuId='crm9300',menuId='crmy165') #登录并进入菜单
     time.sleep(5)
     test.open_MultiOfferFrame() #进入iframe
     ruleMsg = PageAssert(self.driver).check_BusiRule(file=file,row=row)
     self.assertNotIn('校验失败',ruleMsg) # 校验通过才继续执行
     logger.info('开始设置主号家庭短号服务')
     test.screen_step('进入亲情网办理菜单')
     test.set_mainCard(AccessNum)
     logger.info('新增家庭成员并设置家庭短号服务')
     test.set_mutiCard(mutiAccessNumList)
     time.sleep(2)
     test.find_element_click(Btn_commit)
     time.sleep(15)
     submitMsg = PageAssert(self.driver).assert_submitAfter(file=file,row=row)
     logger.info('业务受理信息:{}'.format(submitMsg))
     test.screen_step('点击提交,受理信息:{}'.format(submitMsg))
     test.save_docreport(title)
     time.sleep(3)
     self.assertIn('业务受理成功',submitMsg)
Ejemplo n.º 6
0
 def tradeQry(self):
     '''点击认证检索'''
     btn_tradeQry = (By.ID,'TRADE_QUERY_USER')
     self.isElementDisplay(btn_tradeQry,'click')
     PageAssert(self.driver).pageLoading() #处理下页面加载
     Assert().assertIn('校验通过',PageAssert(self.driver).assert_WadePage(),msg='实名校验未通过')#先校验一下
     PageAssert(self.driver).dealDialogPage()  #关闭Dialog
Ejemplo n.º 7
0
 def AuthUserInfo(self,accessNum):
     '''用户鉴权'''
     text_SerialNum = (By.ID,'AUTH_SERIAL_NUMBER')
     self.element_sendkey_enter(text_SerialNum,accessNum)
     PageAssert(self.driver).pageLoading() #页面加载
     busiVerify = PageAssert(self.driver).assert_WadePage() #这里做个规则校验
     logger.info('业务校验检查结果:'.format(busiVerify))
     PageAssert(self.driver).pageLoading() #加载营销推荐界面
     PageAssert(self.driver).dealDialogPage() #关闭营销推荐
     flag = self.isAuthSuc()
     return {'msg':busiVerify,'IsAuthSuc':flag}
Ejemplo n.º 8
0
 def searchSaleActive(self,offerCode):
     '''
     通过OfferCode直接搜索营销活动
     :param offerCode: OfferType = 'K' 的营销活动包
     :return:
     '''
     text_searchContent = (By.ID,'searchContent')
     btn_search = (By.XPATH,"//*[contains(@onclick,'SaleActivePackageSelect.query')]")
     PageAssert(self.driver).pageLoading()
     self.sendkey(text_searchContent,offerCode)
     self.isElementDisplay(btn_search,'click')
     PageAssert(self.driver).pageLoading()
Ejemplo n.º 9
0
 def test_acceptShareActive(self,dic):
     """家庭畅享活动办理"""
     logger.info("开始参数化......")
     # row = int(dic.get('No'))   #标识行号,后续写入xls使用
     accessNum = str(dic.get('主号'))
     logger.info("主号:{}".format(accessNum))
     offerId = str(dic.get('活动ID'))
     logger.info("家庭活动编码:{}" .format(offerId))
     phoneNum = dic.get('副号')
     logger.info("副号码:{}" .format(phoneNum))
     Idencode = dic.get('副号密码')
     logger.info("副号密码:{}".format(Idencode))
     logger.info('开始执行第{}个用例,测试数据:{}'.format(row,dic))
     print('开始执行第{}个用例,测试数据:{}'.format(row,dic))
     test = ShareActive(self.driver)
     title = '家庭畅享活动受理测试记录'
     test.add_dochead(title)
     loc_commit = (By.CSS_SELECTOR, '#winInfoPop > div.c_popupBox > div > div > div > div.c_submit.e_center > button')
     test.Open_PersonMenu(accessNum=accessNum,password='******',cataMenuId='crm9200',menuId='crmy198') #进入菜单
     time.sleep(5)
     test.open_ShareActiveFrame() #进入iframe
     logger.info('进入家庭畅享活动菜单时验证主号')
     logger.info('暂时屏蔽主号校验')
     # test.vaild_BusiRule() #业务检查点(进入菜单时校验)
     test.screen_step('进入家庭畅享活动CRM,选择活动')
     test.choose_ActiveOffer(offerId) #选择共享活动
     test.set_ShareActiveInfo(phoneNum,Idencode)
     logger.info('副号校验....')
     # vaildMsg = test.vaild_BusiRule()
     vaildMsg = PageAssert(self.driver).check_BusiRule(file,row)
     print('副号校验结果:{}'.format(vaildMsg))
     logger.info('副号校验结果:{}'.format(vaildMsg))
     test.screen_step('验证副号')
     self.assertNotIn('校验失败',vaildMsg)
     # if '校验失败' in vaildMsg:
     #     # PageAssert(self.driver).write_vaildErrResult(file=file,row=row)
     #     write_xlsBycolName_append(file=file,row=row,colName='RESULT_INFO',value=vaildMsg)
     #     logger.info('写入副号校验结果到xls成功.....')
     #     time.sleep(2)
     #     test.quit_browse()
     time.sleep(2)
     test.find_element_click(loc_commit) #点击办理
     time.sleep(15)
     submitMsg = PageAssert(self.driver).assert_submitAfter(file=file,row=row)
     logger.info('业务受理信息:{}'.format(submitMsg))
     test.screen_step('点击提交,受理信息:{}'.format(submitMsg))
     test.save_docreport(title)
     time.sleep(3)
     self.assertIn('业务受理成功',submitMsg)
     test.driver.close()
Ejemplo n.º 10
0
 def searchMainPlan(self,productId):
     '''
     查询主套套餐
     :param productId: 主套餐编码
     :return:
     '''
     text_productSearch = (By.ID,'productSelectPRODUCT_SEARCH_TEXT')
     self.element_sendkey_enter(text_productSearch,productId) #输入产品编码按回车查询
     # time.sleep(2)
     PageAssert(self.driver).pageLoading()
     SubproductStr = "//button[contains(@productid,'%s') and contains(@ontap,'productSelect.selectProduct')]" %productId
     btn_Subproduct = (By.XPATH,SubproductStr)  #订购按钮
     self.isElementDisplay(btn_Subproduct,'click') #点击主套餐订购
     PageAssert(self.driver).pageLoading()
Ejemplo n.º 11
0
 def test_accept_chgPayRela(self,dic):
     """普通付费关系变更受理"""
     logger.info("开始参数化......")
     print('开始执行用例,测试数据:{}'.format(dic))
     accessNum = str(dic.get('ACCESS_NUM'))
     operCode = str(dic.get('OPER_CODE'))  #SQL读入
     row = get_TestData('ChgPayRelaSeprate')['FuncRow'] if operCode=='1' else get_TestData('ChgPayRelaMerge')['FuncRow']
     # if operCode == '1' :  #分账
     #    row = get_TestData('ChgPayRelaSeprate')['FuncRow']
     # elif operCode == '2':
     #    row = get_TestData('ChgPayRelaMerge')['FuncRow']
     # else:
     #    print('OperCode只能传入1或者2,当前传入:{}'.format(operCode))
     logger.info('开始执行用例,测试数据:{}'.format(dic))
     ####测试用例步骤
     test = ChangePayRelaNor(self.driver)
     title = '普通付费关系变更测试记录'
     loc_separater = (By.XPATH,'//*[@id="change_account_type_span"]/span[1]') #分账
     loc_remark = (By.ID,'remarks') #备注
     loc_commit = (By.ID, 'CSSUBMIT_BUTTON') #提交按钮
     test.add_dochead(title)
     test.Open_PersonMenu(accessNum,password='******',cataMenuId='crm9200',menuId='crm9257') #登录并进入普通付费关系变更菜单
     time.sleep(2)
     test.open_ChangePayRelaNorFrame() #进入iframe
     ruleMsg = PageAssert(self.driver).check_BusiRule(file=file,row=row)
     self.assertIn('业务规则校验通过',ruleMsg)
     time.sleep(3)
     #业务办理
     if operCode == '1':  # 分账
         logger.info('选择的是分账操作')
         test.find_element_click(loc_separater)
     elif operCode == '2':  # 合账
         logger.info('选择的是合帐操作')
         SerialNum = str(dic.get('SERIAL_NUM'))
         test.set_mergeSerialNum(SerialNum)
         vaildMsg = PageAssert(self.driver).assert_error()
         logger.info('付费号码校验结果:{}'.format(vaildMsg))
         self.assertIn('业务校验通过',vaildMsg)  #校验通过才继续执行
     else:
         print('OperCode只能传入1或者2,当前传入:{}'.format(operCode))
     test.sendkey(loc_remark,'AutoTest')
     time.sleep(2)
     test.find_element_click(loc_commit) #点击提交
     time.sleep(10)
     submitMsg = PageAssert(self.driver).assert_submitAfter(file=file,row=row,index=0) #写入结果到xls
     logger.info('业务受理信息:{}'.format(submitMsg))
     test.screen_step('点击提交,受理信息:{}'.format(submitMsg))
     test.save_docreport(title)
     self.assertIn('业务受理成功',submitMsg)
Ejemplo n.º 12
0
 def accept_addSaleActive(self,
                          accessNum,
                          offerCode,
                          scene='AddSaleActive'):
     '''
     个人业务-新增预存营销活动办理
     :param accessNum:服务号码
     :param OfferCode:营销活动编码
     :return:
     '''
     title = '%s办理营销活动%s_测试记录' % (accessNum, offerCode)
     self.add_dochead(title)
     self.openSaleActive()
     self.screen_step("进入营销活动受理(存送营销)菜单")
     authUser = DealUserCommon(self.driver).AuthUserInfo(
         accessNum)  #用户鉴权,包含了用户鉴权都结果和规则校验信息
     TR().updateRuleCheckInfo(sceneCode=scene, msg=authUser['msg'])
     Assert().assertTrue(authUser['IsAuthSuc'], msg='用户鉴权失败')  #做个鉴权认证
     SaleActivePart(self.driver).addSaleActive(offerCode)
     RuleCheckBefore(self.driver).checkRule(
         scene)  #规则校验,如果失败则终止,并将校验结果写入到数据库中
     ####校验码的问题######
     PageCommonPart(self.driver).submit()  #点击提交
     submitMsg = PageAssert(self.driver).assert_Submit()
     logger.info('业务受理信息:{}'.format(submitMsg))
     self.screen_step('点击提交,受理信息:{}'.format(submitMsg))
     self.save_docreport(title)
Ejemplo n.º 13
0
 def accept_CreateUser(self,
                       accessNum,
                       simId,
                       mainPlanId,
                       elementList,
                       scene=''):
     '''
     个人用户开户业务受理
     :param accessNum: 开户手机号码
     :param simId: 开户SIM卡号
     :param mainPlan: 主套餐
     :param elementList:
     :return:
     '''
     self.openCrtUserPage()  #打开开户菜单
     self.inputSerialNum(accessNum)  #输入手机号并校验
     self.inputSim(simId)  #输入SIM卡并校验
     RN(self.driver).openUserVerify(accessNum)  #开户时按手机号码做实名制校验(在线验证)
     self.addMainPlan(mainPlanId=mainPlanId,
                      elementList=elementList)  #主套餐选择
     PageCommon(self.driver).submit()
     RuleCheckBefore(self.driver).checkRule(scene)
     submitMsg = PageAssert(self.driver).assert_Submit()
     logger.info('业务受理信息:{}'.format(submitMsg))
     self.screen_step('点击提交,受理信息:{}'.format(submitMsg))
Ejemplo n.º 14
0
 def acceptAddElements(self, accessNum, elementList=[]):
     '''
     个人业务-新增服务
     :param accessNum:服务号码
     :param productId:主产品编码
     :param elementList:资费和服务列表
     字典数组,包含 OFFER_CODE 和 Offer_type 2个key
     eg :[{"OFFER_CODE":"120000008174","OFFER_TYPE":"S"},{"OFFER_CODE":"120010122813","OFFER_TYPE":"D"}]
     :return:
     '''
     title = '主产品变更测试记录%s' % accessNum
     self.add_dochead(title)
     self.openProductChange()
     self.screen_step("进入产品变更菜单")
     flag = DealUserCommon(self.driver).AuthUserInfo(accessNum)  #用户鉴权
     if not flag:
         logger.info('用户鉴权失败,终止测试')
         self.save_docreport(title)
         # self.driver.close()    #直接关闭浏览器
     #新增优惠按钮
     li_addElement = (By.ID, 'addElement')
     self.isElementDisplay(li_addElement, 'click')
     self.screen_step("选择资费或者服务订购")
     SelectElements(self.driver).addElements(elementList)
     PageCommonPart(self.driver).submit()  #点击提交
     submitMsg = PageAssert(self.driver).assert_Submit()
     logger.info('业务受理信息:{}'.format(submitMsg))
     self.screen_step('点击提交,受理信息:{}'.format(submitMsg))
     self.save_docreport(title)
Ejemplo n.º 15
0
 def acceptChgMainProduct(self, accessNum, productId, elementList=[]):
     '''
     个人业务-变更主产品
     :param accessNum:服务号码
     :param productId:主产品编码
     :param elementList:可选组元素列表
     :return:
     '''
     title = '主产品变更测试记录%s' % accessNum
     self.add_dochead(title)
     self.openProductChange()
     self.screen_step("进入产品变更菜单")
     flag = DealUserCommon(self.driver).AuthUserInfo(accessNum)  #用户鉴权
     if not flag:
         logger.info('用户鉴权失败,终止测试')
         self.save_docreport(title)
         # self.driver.close()    #直接关闭浏览器
     self.screen_step("点击变更按钮")
     Btn_changeProduct = (By.ID, 'changeButton')
     self.isElementDisplay(Btn_changeProduct, 'click')  #点击产品变更按钮
     time.sleep(2)
     self.screen_step("选择主套餐")
     MainPlanSelectPart(self.driver).MainProductSel(productId, elementList)
     RuleCheckBefore(self.driver).checkRule()  #规则校验
     time.sleep(3)
     self.sendEnter()
     PageCommonPart(self.driver).submit()  #点击提交
     submitMsg = PageAssert(self.driver).assert_Submit()
     logger.info('业务受理信息:{}'.format(submitMsg))
     self.screen_step('点击提交,受理信息:{}'.format(submitMsg))
     self.save_docreport(title)
Ejemplo n.º 16
0
 def test_acceptAddGrpPayRela(self,dic):
     '''新增集团高级付费关系'''
     logger.info("开始参数化......")
     print('用例执行测试数据:{}'.format(dic))
     groupId = dic.get('GROUP_ID')
     acctId = dic.get('ACCT_ID')
     payAcessNum = dic.get('SERIAL_NUM')   #集团成员号码
     '''选择操作类型, 根据operCode判断操作类型
             @operCode = 0 新增
             @operCode = 1 删除
             @operCode = 2 修改
     '''
     operCode = dic.get('OPERCODE')
     itemName = dic.get('ITEM_NAME')  #付费科目
     #开始执行用例
     test = GrouprelaAdv(self.driver)
     '''受理新增集团高级付费关系'''
     title = '新增集团高级付费关系测试记录'
     test.add_dochead(title)
     test.Open_GrprelaAdv(groupId)
     test.choose_grpAcct(acctId)  # 选择付费账户
     test.set_PayCustInfo(payAcessNum) #f 付费成员号码
     test.choose_operAction(operCode)
     test.set_Payitem(itemName)
     test.isElementDisplay((By.ID, 'submitButton'), 'click')  # 点击提交
     time.sleep(5)
     submitMsg = PageAssert(self.driver).assert_submitAfter(file=file,row=get_TestData('GrprelaAdvAdd')['FuncRow'],index=0) #写入结果到xls
     test.screen_step('点击提交,受理信息:{}'.format(submitMsg))
     test.save_docreport(title)
     self.assertIn('业务受理成功',submitMsg)
     self.driver.close()
Ejemplo n.º 17
0
 def acceptAddSaleActive(self, accessNum, OfferCode):
     '''
     个人业务-新增预存营销活动办理
     :param accessNum:服务号码
     :param OfferCode:营销活动编码
     :return:
     '''
     title = '%s办理营销活动%s_测试记录%s' % (accessNum, OfferCode)
     self.add_dochead(title)
     self.openSaleActive()
     self.screen_step("进入营销活动受理(存送营销)菜单")
     DealUserCommon(self.driver).AuthUserInfo(accessNum)  #用户鉴权
     # if not flag :
     #     logger.info('用户鉴权失败,终止测试')
     #     self.save_docreport(title)
     #     # self.driver.close()    #直接关闭浏览器
     SaleActivePart(self.driver).selActivePop()
     self.screen_step("点击营销包,选择营销营销活动")
     SaleActivePart(self.driver).searchSaleActive(OfferCode)
     self.screen_step("选择营销活动")
     SaleActivePart(self.driver).selectActive(OfferCode)  #选择营销包
     # RuleCheckBefore(self.driver).checkRule()   #规则校验
     RuleCheckBefore(self.driver).checkRule()  #规则校验
     time.sleep(3)
     ####校验码的问题######
     PageCommonPart(self.driver).submit()  #点击提交
     submitMsg = PageAssert(self.driver).assert_Submit()
     logger.info('业务受理信息:{}'.format(submitMsg))
     self.screen_step('点击提交,受理信息:{}'.format(submitMsg))
     self.save_docreport(title)
Ejemplo n.º 18
0
 def test_acceptSubEcCampn(self,dic):
     '''新增集团营销活动'''
     logger.info("开始参数化......")
     groupId = dic.get('GROUP_ID')
     CampnOfferId = dic.get('CAMPN_ID')  #营销活动ID
     OfferKey = dic.get('OFFER_ID')   #营销活动商品
     prePrice = dic.get('PREPRICE')  # 预存金额
     AcctId = dic.get('ACCT_ID')  #集团账户
     month = dic.get('MONTH')  #合约期
     print('开始执行集团营销活动受理案例,测试数据:{}'.format(dic))
     logger.info('开始执行集团营销活动受理案例,测试数据:{}'.format(dic))
     #开始执行用例
     test = EcCampnOper(self.driver)
     title = '新增集团营销活动受理测试记录'
     test.add_dochead(title)
     test.Open_groupMenu(groupId,'crm8500','crm8097') #点击进入菜单 ,父菜单>子菜单
     test.Open_GrpEcCampnOperframe()  # 进入集团订购iframe
     test.screen_step('进入集团营销活动受理')
     test.choose_EcCampnOffer(CampnOfferId,OfferKey,prePrice,AcctId,month)
     test.screen_step('选择营销活动并设置')
     time.sleep(5)
     test.find_element_click((By.ID,'submitButton')) #点击提交
     time.sleep(2)
     test.sendEnter() #确认
     time.sleep(5)
     submitMsg = PageAssert(self.driver).assert_submitAfter(file=file,row=get_TestData('SubEcCampnAdd')['FuncRow'],index=0) #写入结果到xls
     test.screen_step('点击提交,受理信息:{}'.format(submitMsg))
     test.save_docreport(title)
     self.assertIn('业务受理成功',submitMsg)
     self.driver.close()
     time.sleep(3)
Ejemplo n.º 19
0
 def qry_GroupInfo(self, groupId):
     '''查询集团客户信息'''
     Btn_qry = (
         By.CSS_SELECTOR,
         '#QryGroupInfoPart > div.l_queryFn > div > div.right > div > button'
     )
     input_groupID = (By.ID, 'cond_GROUP_ID2')
     Btn_query = (
         By.CSS_SELECTOR,
         '#popupt > div.c_scroll.c_scroll-float.c_scroll-header > div > div.c_submit.c_submit-full > button'
     )
     self.find_element_click(Btn_qry)
     time.sleep(1)
     self.sendkey(input_groupID, groupId)
     time.sleep(1)
     self.find_element_click(Btn_query)
     time.sleep(5)
     qryVaildMsg = PageAssert(self.driver).assert_WadePage()
     logger.info('查询校验信息:{}'.format(qryVaildMsg))
     loc_groupInfo = (
         By.XPATH,
         '//*[@id="groupinfosTable"]/div[1]/div/table/tbody/tr/td[2]/a'
     )  #找到集团编码
     try:
         GroupId = self.get_attribute(loc_groupInfo, name='groupid')
         logger.info('===页面显示的GroupId:{}'.format(GroupId))
         if GroupId == groupId:
             self.find_element_click(loc_groupInfo)
         else:
             logger.info('查询失败!')
     except:
         print('根据集团编码未获取集团信息,测试失败!')
         logger.info('根据集团编码未获取集团信息,测试失败!')
Ejemplo n.º 20
0
 def acceptAddElements(self,
                       accessNum,
                       elementList=[],
                       scene='AddElements'):
     '''
     个人业务-新增服务
     :param accessNum:服务号码
     :param productId:主产品编码
     :param elementList:资费和服务列表
     字典数组,包含 OFFER_CODE 和 Offer_type 2个key
     eg :[{"OFFER_CODE":"120000008174","OFFER_TYPE":"S"},{"OFFER_CODE":"120010122813","OFFER_TYPE":"D"}]
     :return:
     '''
     title = '主产品变更测试记录%s' % accessNum
     self.add_dochead(title)
     self.openProductChange()
     self.screen_step("进入产品变更菜单")
     authUser = DealUserCommon(self.driver).AuthUserInfo(
         accessNum)  #用户鉴权,包含了用户鉴权都结果和规则校验信息
     TR().updateRuleCheckInfo(sceneCode=scene, msg=authUser['msg'])
     Assert().assertTrue(authUser['IsAuthSuc'], msg='用户鉴权失败')  #做个鉴权认证
     #新增优惠按钮
     li_addElement = (By.ID, 'addElement')
     self.isElementDisplay(li_addElement, 'click')
     self.screen_step("选择资费或者服务订购")
     SelectElements(self.driver).addElements(elementList=elementList,
                                             scene=scene)
     self.backProdChgPage()  #点击回到产品变更主页面
     PageCommonPart(self.driver).submit()  #点击提交
     submitMsg = PageAssert(self.driver).assert_Submit()
     logger.info('业务受理信息:{}'.format(submitMsg))
     self.screen_step('点击提交,受理信息:{}'.format(submitMsg))
     self.save_docreport(title)
Ejemplo n.º 21
0
 def accept_DstMb(self, groupId, serialNum, grpUserId):
     '''
     成员商品受理-订购集团成员产品
     :param groupId: 集团编码
     :param serialNum: 成员服务号码
     :param grpUserId: 集团用户标识
     :return:
     '''
     LoginPage(self.driver).login(rc.get_ngboss('username'),
                                  rc.get_ngboss('password'))  # 登录
     MainPage(self.driver).open_CataMenu(
         'crm8000',
         'crm8200',
         'crm8206',
         menuPath='page/order.page.pc.enterprise.operenterprisemember'
     )  # 进入成员商品受理
     self.GroupQryPart(groupId)  #按集团编码查询集团客户
     time.sleep(1)
     DealMebElements(self.driver).QryMebInfo(serialNum)  #查询成员用户信息
     self.OfferSubCata()  #点击已订购目录
     time.sleep(3)
     self.DstMebOffer(grpUserId)
     ####这个还差一个重新认证集团客户的确认动作
     RuleCheckBefore(self.driver).checkRule()  #业务规则判断
     DealMebElements(self.driver).InputDstMbRemark()  #填写备注
     DealMebElements(self.driver).DelSubmitGrpMebOffer()  #注销提交按钮
     submitMsg = PageAssert(self.driver).assert_Submit()
     logger.info('业务受理信息:{}'.format(submitMsg))
     orderId = getDigitFromStr(submitMsg)
     time.sleep(2)
     orderTrace = DataCheck().retOrderTrace(orderId)
     logger.info('=========订单轨迹检查结果========')
     logger.info(orderTrace)
Ejemplo n.º 22
0
 def acceptChgMainProduct(self,
                          accessNum,
                          productId,
                          elementList=[],
                          scene='ChgMainProduct'):
     '''
     个人业务-变更主产品
     :param accessNum:服务号码
     :param productId:主产品编码
     :param elementList:可选组元素列表
     :return:
     '''
     title = '主产品变更测试记录%s' % accessNum
     self.add_dochead(title)
     self.openProductChange()
     self.screen_step("进入产品变更菜单")
     authUser = DealUserCommon(self.driver).AuthUserInfo(
         accessNum)  #用户鉴权,包含了用户鉴权都结果和规则校验信息
     TR().updateRuleCheckInfo(sceneCode=scene, msg=authUser['msg'])
     Assert().assertTrue(authUser['IsAuthSuc'], msg='用户鉴权失败')  #做个鉴权认证
     self.screen_step("点击变更按钮")
     Btn_changeProduct = (By.ID, 'changeButton')
     self.isElementDisplay(Btn_changeProduct, 'click')  #点击产品变更按钮
     time.sleep(2)
     self.screen_step("选择主套餐")
     MainPlanSelectPart(self.driver).MainProductSel(productId, elementList)
     RuleCheckBefore(self.driver).checkRule()  #规则校验
     time.sleep(3)
     self.sendEnter()
     PageCommonPart(self.driver).submit()  #点击提交
     submitMsg = PageAssert(self.driver).assert_Submit()
     logger.info('业务受理信息:{}'.format(submitMsg))
     self.screen_step('点击提交,受理信息:{}'.format(submitMsg))
     self.save_docreport(title)
Ejemplo n.º 23
0
 def accept_CrtUs(self,
                  scene,
                  groupId,
                  brandCode,
                  offerCode,
                  elementAttrBizList=[],
                  contractId=''):
     '''
     集团商品受理(开户)
     :param groupId: 场景编码
     :param groupId: 集团编码
     :param brandCode: 商品品牌
     :param offerCode: 商品编码
     :param AttrBizList:商品特征属性
     :param elementAttrBizList:资费或者服务包括属性列表
     :param contractId:
     :return:
     '''
     title = '集团商品受理测试记录%s' % offerCode
     self.add_dochead(title)
     LoginPage(self.driver).login(rc.get_ngboss('username'),
                                  rc.get_ngboss('password'))  # 登录
     MainPage(self.driver).open_CataMenu(
         'crm8000',
         'crm8200',
         'crm8207',
         menuPath=
         'order.page.pc.enterprise.operenterprisesubscriber.OperEnterpriseSubscriber'
     )  # 进入集团商品受理
     self.GroupQryPart(groupId)  #按集团编码查询集团客户
     time.sleep(2)
     self.SelOfferTypePart(brandCode)  # 选择商品目录
     self.SubGrpOffer(offerCode)  #选择集团商品
     RuleCheckBefore(self.driver).checkRule(scene)  #
     DealElements(self.driver).initOfferAttrInfo()  #点击商品待设置或者点击商品特征设置
     self.screen_step("进入集团商品设置页面")
     # DealElements(self.driver).setOfferAttr(AttrBizList) #传入需要设置属性列表并设置商品属性
     DealElements(self.driver).setOfferAttrNew(
         elementAttrBizList)  #传入需设置属性列表并设置商品属性
     DealElements(self.driver).submitOfferAttr(offerCode)  #设置商品属性完成
     DealElements(self.driver).initGroupOffer()  #点击新增子商品
     DealElements(self.driver).selectElements(
         elementAttrBizList)  #选择要订购的资费和服务并且设置属性
     self.screen_step("进入子商品选择页面,选择资费和服务")
     # DealElements(self.driver).submitOffers() #页面选择完资费和服务后点击确定
     DealElements(self.driver).selectGroupContract(contractId)  #选择集团对应合同
     time.sleep(2)
     if '2222' == offerCode:
         DealElements(self.driver).setApprovalInfo(staffId='AJF00189')
     DealElements(self.driver).submitAccept()
     submitMsg = PageAssert(self.driver).assert_Submit()
     logger.info('业务受理信息:{}'.format(submitMsg))
     self.screen_step('点击提交,受理信息:{}'.format(submitMsg))
     orderId = getDigitFromStr(submitMsg)
     time.sleep(2)
     orderTrace = DataCheck().retOrderTrace(orderId)
     logger.info(orderTrace)
     print(orderTrace)  #输出到控制台。方便在测试报告html中查看订单轨迹
     self.save_docreport(title)
Ejemplo n.º 24
0
 def test_acceptSubscriberOpen(self, dic):
     """个人用户开户"""
     logger.info("开始参数化......")
     # row = int(dic.get('NO'))   #标识行号,后续写入xls使用
     accessNum = str(dic.get('ACCESS_NUMBER'))
     simId = dic.get('ICC_ID')
     offerId = str(dic.get('OFFER_ID'))
     logger.info("开户号码:{},SIM卡号:{},主套餐:{}".format(accessNum, simId,
                                                  offerId))
     print("开户号码:{},SIM卡号:{},主套餐:{}".format(accessNum, simId, offerId))
     logger.info('开始执行第{}个用例,测试数据:{}'.format(row, dic))
     test = SubscriberOpen(self.driver)
     title = '个人用户开户受理测试记录'
     test.add_dochead(title)
     loc_commitAll = (By.XPATH, '//*[@id="CSSUBMIT_BUTTON"]')
     test.Open_subscriberOpen()  # 进入开户页面
     test.set_customerInfo(accessNum)  # 设置客户信息
     validMsg = test.Input_validSim(simId)  #输入SIMID并校验
     logger.info('SIM卡校验结果:{}'.format(validMsg))
     if '业务校验失败' in validMsg:
         write_xlsBycolName_append(file=file,
                                   row=row,
                                   colName='RESULT_INFO',
                                   value=validMsg,
                                   index=0)  #向xls模板指定行列写入结果
     self.assertNotIn('业务校验失败', validMsg)  #加个断点,验证sim是否校验通过
     test.set_personMainOffer(offerId)  #设置个人主套餐
     test.set_Acctinfo()  #设置账户信息
     test.set_personPwd()  #设置用户服务新密码
     test.find_element_click(loc_commitAll)  # 点击提交时校验服务密码
     test.find_element_click(loc_commitAll)  # 再次点击提交
     time.sleep(10)
     #提交时如果发生异常,则将结果写入到xls
     vaildMsg = PageAssert(self.driver).write_vaildErrResult(
         file=file, row=row, index=0)  #如果有错误就写入结果到xls
     self.assertNotIn('校验失败', vaildMsg)
     test.confirm_Payinfo()  # 校验通过后再支付确认
     submitMsg = PageAssert(self.driver).assert_submitAfter(file=file,
                                                            row=row)
     print('===提交后页面返回信息:', submitMsg)
     test.screen_step('点击提交,受理信息:{}'.format(submitMsg))
     # 点击确认支付后,页面返回的信息写入xls
     logger.info('写入测试结果到xls成功.....')
     test.save_docreport(title)
     self.assertIn('业务受理成功', submitMsg)
     self.driver.close()
Ejemplo n.º 25
0
 def test_chgSimCard(self, dic):
     """换卡"""
     logger.info("开始参数化......")
     # row = int(dic.get('NO'))   #标识行号,后续写入xls使用
     print('开始执行用例,测试数据:{}'.format(dic))
     accessNum = str(dic.get('ACCESS_NUMBER'))
     custName = dic.get('CUST_NAME')
     IdenNr = dic.get('IDENNR')
     simId = str(dic.get('NEWSIMID'))  #SIM卡号参数化
     logger.info('开始执行第{}个用例,测试数据:{}'.format(row, dic))
     ####测试用例步骤
     test = ChangeSimCard(self.driver)
     title = '换卡业务受理测试记录'
     test.add_dochead(title)
     text_remark = (By.ID, 'REMARKS')  #备注
     loc_commit = (By.ID, 'CSSUBMIT_BUTTON')  #提交按钮
     PersonBase(self.driver).Open_PersonMenu(accessNum,
                                             password='******',
                                             cataMenuId='crm9400',
                                             menuId='crm9431')  #登录并进入换卡菜单
     time.sleep(5)
     test.open_ChangSimCardFrame()  #进入iframe
     # RuleMsg = test.vaild_BusiRule() #业务检查点(进入菜单时校验)
     RuleMsg = PageAssert(self.driver).check_BusiRule(file,
                                                      row)  #业务检查点(进入菜单时校验)
     print('换卡业务提交前规则:{}'.format(RuleMsg))
     logger.info('换卡业务提交前规则:{}'.format(RuleMsg))
     self.assertNotIn('业务校验失败', RuleMsg)
     test.screen_step('进入换卡菜单')
     test.check_CustInfoByIdcard(custName, IdenNr)  #客户名称
     Vaild_custMsg = PageAssert(self.driver).assert_WadePage()
     print('客户验证信息:{}'.format(Vaild_custMsg))
     logger.info('客户验证信息:{}'.format(Vaild_custMsg))
     self.assertNotIn('警告信息', Vaild_custMsg)
     time.sleep(2)
     test.Input_NewSimId(simId)
     test.sendkey(text_remark, 'AntoTest')  #填写备注信息
     test.find_element_click(loc_commit)  #点击提交
     time.sleep(10)
     submitMsg = PageAssert(self.driver).assert_submitAfter(
         file=file, row=row, index=0)  #写入结果到xls
     logger.info('业务受理信息:{}'.format(submitMsg))
     test.screen_step('点击提交,受理信息:{}'.format(submitMsg))
     test.save_docreport(title)
     self.assertIn('业务受理成功', submitMsg)
Ejemplo n.º 26
0
 def SubGrpOffer(self, offerCode):
     '''
     :param offerCode: 集团商品编码
     :return:
     '''
     OfferCodeStr = "//button[contains(@offer_code,'%s') and contains(@ontap,'CrtUs')]" % offerCode  #传入集团编码并通过Xpath定位
     loc_subOfferCode = (By.XPATH, OfferCodeStr)
     self.isElementDisplay(loc_subOfferCode, 'click')
     PageAssert(self.driver).pageLoading()
Ejemplo n.º 27
0
 def tradeSend(self):
     '''
     工单下发
     :return:
     '''
     btn_sendTrade = (By.ID,'TRADE_SEND_USER')
     self.isElementDisplay(btn_sendTrade,'click')
     PageAssert(self.driver).pageLoading()  #页面一直加载,直到页面加载结束
     time.sleep(1)
Ejemplo n.º 28
0
 def searchElementByCode(self,offerCode):
     '''
     根河Offer_code搜索元素
     :param offerCode: 元素编码 offer_code,资费/服务/平台服务等
     :return:
     '''
     text_elementSearch = (By.ID,'elementListELEM_SEARCH_TEXT')
     self.element_sendkey_enter(text_elementSearch,offerCode)
     PageAssert(self.driver).pageLoading()
Ejemplo n.º 29
0
 def selectProductItem(self,elementList=[]):
     '''
     组选择
     :param elementList:可选组内元素 字典数组包含元素类型和元素编码
     eg :elementList =  [{"OFFER_TYPE":"D","OFFER_CODE":"99410190"},{"OFFER_TYPE":"D","OFFER_CODE":"2285"}]
     :return:
     '''
     for i in range(len(elementList)):
         elementId = elementList[i]['OFFER_CODE']
         elementType = elementList[i]['OFFER_TYPE']
         if not isinstance(elementId,str):
             elementId = str(elementId)
         selectElementStr = "//*[contains(@offercode,'%s') and contains(@offertype,'%s') and contains(@type,'checkbox')]" %(elementId,elementType)
         checkBox_selectElement = (By.XPATH,selectElementStr)
         self.isSelected(checkBox_selectElement,Type='click') # 选中要订购的元素(资费、服务)
     btn_confirmSelect = (By.XPATH,"//button[contains(@ontap,'productSelect.confirmAction')]")
     self.isElementDisplay(btn_confirmSelect,'click')
     PageAssert(self.driver).pageLoading()
     PageAssert(self.driver).assert_WadePage() #做个校验
Ejemplo n.º 30
0
 def addSaleActive(self,offerCode):
     '''
     订购营销活动包
     :param packgeInfo:
     :return:
     '''
     self.selActivePop()  #点击活动办理新增
     self.searchSaleActive(offerCode) #按编码查询营销包
     self.checkSaleActiveExists(offerCode) #校验是否存在,里面做了断言
     self.selectActive() #点击订购
     PageAssert(self.driver).pageLoading()