def test_menu_04(self): """根据菜单路径进入日常业务""" driver = self.driver driver.get(base_url) login = LoginPage(self.driver) login.login(username, password) Me = MainPage(self.driver) Me.daily_busi() self.assertIn('客户关系管理系统CRM', self.driver.title) self.driver.close()
def test_menu_01(self): """根据菜单路径进入开户业务""" driver = self.driver driver.get(base_url) login = LoginPage(self.driver) login.login(username, password) Me = MainPage(self.driver) Me.sel_person_subscriber() self.assertIn('客户关系管理系统CRM', self.driver.title) self.driver.close()
def test_menu_02(self): """菜单搜索进入""" driver = self.driver driver.get(base_url) login = LoginPage(self.driver) login.login(username, password) Me = MainPage(self.driver) Me.search_menu("集团商品业务查询") self.assertIn(self.driver.title, '客户关系管理系统CRM') self.driver.close()
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)
def openCrtUserPage(self): LoginPage(self.driver).login() # 登录 MainPage(self.driver).open_CataMenu( 'crm9000', 'crm9100', 'crmw908', menuPath='order.page.pc.person.createuser.CreateUser') # 进入集团商品受理
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)
def openPlatServiceOrder(self): LoginPage(self.driver).login() # 登录 MainPage(self.driver).open_CataMenu( 'crm9000', 'IBS1000', 'IBS9271', menuPath='page/order.page.pc.person.plat.PlatOrder') # 进入产品变更页面 logger.info('进入平台业务办理页面')
def openCrtUserPage(self): LoginPage(self.driver).login(rc.get_ngboss('username'), rc.get_ngboss('password')) # 登录 MainPage(self.driver).open_CataMenu( 'crm9000', 'crm9100', 'crmw908', menuPath='order.page.pc.person.createuser.CreateUser') # 进入集团商品受理
def openProductChange(self): LoginPage(self.driver).login() # 登录 MainPage(self.driver).open_CataMenu( 'crm9000', 'crm9200', 'crmw912', menuPath='page/order.page.pc.person.changeproduct.ChangeProduct' ) # 进入产品变更页面 logger.info('进入产品变更页面')
def openSaleActive(self): LoginPage(self.driver).login() # 登录 MainPage(self.driver).open_CataMenu( 'crm9000', 'crm9300', 'crmw902', menuPath='order.page.pc.saleActive.accept.SaleActiveAccept' ) # 进入产品变更页面 logger.info('进入营销活动受理(存送营销)菜单')
def openProductChange(self): LoginPage(self.driver).login(rc.get_ngboss('username'), rc.get_ngboss('password')) # 登录 MainPage(self.driver).open_CataMenu( 'crm9000', 'crm9200', 'crmw912', menuPath='page/order.page.pc.person.changeproduct.ChangeProduct' ) # 进入产品变更页面 logger.info('进入产品变更页面')
def openSaleActive(self): LoginPage(self.driver).login(rc.get_ngboss('username'), rc.get_ngboss('password')) # 登录 MainPage(self.driver).open_CataMenu( 'crm9000', 'crm9300', 'crmw902', menuPath='order.page.pc.saleActive.accept.SaleActiveAccept' ) # 进入产品变更页面 logger.info('进入营销活动受理(存送营销)菜单')
def accept_DstUs(self, groupId, offerCode, reason='不必要使用该产品', scene='DstUs'): '''集团商品受理(销户)''' 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.screen_step("进入集团商品受理菜单") self.GroupQryPart(groupId) #按集团编码查询集团客户 time.sleep(2) self.selectGroupOffer() # 选择集团商品按钮 self.OfferSubCata() #点击已订购目录 time.sleep(2) self.screen_step("选择要注销的集团商品") # self.DstGrpOfferCode(offerCode,userId) #传入要注销的集团商品编码和用户标识点击注销 self.DstGrpOfferCodeNew(offerCode) #传入要注销的集团商品编码和用户标识点击注销 RuleCheckBefore(self.driver).checkRule(scene) #点击注销后判断规则 DealElements(self.driver).selectRemoveReason(reason) #选择注销原因 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) self.save_docreport(title)
time.sleep(1) self.find( (By.XPATH, '//*[@id="MEMBER_RELA_float"]/div[2]/div/div/ul/li[2]' )).click() #成员关系->雇佣关系 self.find((By.ID, 'MEMBER_PROPERTY_span')).click() time.sleep(1) self.find((By.XPATH, '//*[@id="MEMBER_PROPERTY_float"]/div[2]/div/div/ul/li[2]' )).click() Btn_confirm = ( By.CSS_SELECTOR, '#groupRel > div.c_scroll.c_scroll-float.c_scroll-header > div > div.c_submit.c_submit-full > button' ) self.find(Btn_confirm).click() #点击确认 def submiyAll(self): self.find_element_click((By.ID, 'submitButton')) if __name__ == '__main__': print("用例开始执行时间:" + time.strftime("%Y%m%d%H%M%S")) driver = webdriver.Chrome() test = GroupMebAdd(driver) test.open_base() MainPage(driver).open_CataMenu(0, 'crm5000', 'crm5300', 'crm5217') test.Open_GroupMebAddFrame() test.qry_GroupMebInfoByAccessNum('18808723367') test.set_groupMebRela('8723403452') test.submiyAll() PageAssert(self.driver).assert_WadePage()
def accept_CrtMb(self, groupId, serialNum, offerCode, grpUserId, planType, itemId, elementAttrBizList=[]): ''' 成员商品受理-订购集团成员产品 :param groupId: 集团编码 :param serialNum: 成员服务号码 :param grpUserId: 集团用户标识 :param AttrBizList: 成员属性列表,需要页面设置 :param elementList: 成员资费和服务 :param planType: 成员付费关系 :param itemId: 成员付费科目 :return: ''' title = '成员商品受理测试记录%s' % serialNum self.add_dochead(title) 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.screen_step("进入成员商品受理菜单") self.GroupQryPart(groupId) #按集团编码查询集团客户 time.sleep(1) DealMebElements(self.driver).QryMebInfo(serialNum) #查询成员用户信息 time.sleep(2) self.selectGroupOffer() # 选择集团商品按钮 self.screen_step("选择集团商品") time.sleep(3) self.SubMebOffer(grpUserId) #成员商品订购按钮 DealElements(self.driver).initOfferAttrInfo() #点击商品待设置或者点击商品特征设置 DealElements(self.driver).setOfferAttrNew( elementAttrBizList) #传入需要设置属性列表并设置商品属性 self.screen_step("设置成员商品规格特征") DealMebElements(self.driver).submitMebOfferAttr(offerCode) DealElements(self.driver).initGroupOffer() #点击新增子商品 DealElements(self.driver).selectElements( elementAttrBizList) #选择要订购的资费和服务以及属性 # DealElements(self.driver).submitOffers() #页面选择完资费和服务后点击确定 DealElements(self.driver).setPriceOfferCha( elementAttrBizList) # 在受理主页面再设置一次资费服务属性 self.screen_step("选择子商品成员资费和服务") if offerCode == '2222': DealMebElements(self.driver).setGrpMebPayRela( planType, itemId) #桌面电话,只有集团付费,设置集团付费关系 else: DealMebElements(self.driver).selMebPayPlan( planType, itemId) #【可以选择个人付费或集团付费的处理】设置成员付费关系 DealMebElements(self.driver).OpenSubmitGrpMebOffer() #点击提交 submitMsg = PageAssert(self.driver).assert_Submit() logger.info('业务受理信息:{}'.format(submitMsg)) orderId = getDigitFromStr(submitMsg) time.sleep(2) orderTrace = DataCheck().retOrderTrace(orderId) logger.info(orderTrace) self.screen_step('点击提交,受理信息:{}'.format(submitMsg)) self.save_docreport(title)
'''成员商品注销按钮''' def DstMebOffer(self, grpUserId): ''' :param grpUserId: 传入集团用户标识 :return: ''' dstMebOfferCodeStr = "//button[contains(@value,'%s') and contains(@ontap,'DstMb')]" % grpUserId # 传入集团编码并通过Xpath定位 loc_dstMebOfferCode = (By.XPATH, dstMebOfferCodeStr) self.isElementDisplay(loc_dstMebOfferCode, 'click') RuleCheckBefore(self.driver).checkRule() return self.driver if __name__ == '__main__': driver = webdriver.Chrome() test = MainPage(driver) test.open_base() LoginPage(driver).login(rc.get_ngboss('username'), rc.get_ngboss('password')) #登录 test.open_CataMenu( 'crm8000', 'crm8200', 'crm8207', menuPath= 'order.page.pc.enterprise.operenterprisesubscriber.OperEnterpriseSubscriber' ) #集团商品受理 # test.open_CataMenu('crm8000','crm8200','crm8206',menuPath='order.page.pc.enterprise.operenterprisemember')#成员商品受理 # GroupBusiAcceptTestBase(driver).OfferCata() # driver.close()