def test_a_payment_confirmation(self): u"""支付管理-支付确认-驳回""" #传入参数 #新增学员电话号码 student_phone = financial_management['reject'] with open('D:\\Mantisadministrationhcmasp\\configFile\\student1.txt', 'w') as f: f.write(student_phone) f.close() #新增学员姓名 student_name = student_centre['name'] #应缴费用 assessment = student_centre['assessment'] #实缴费用 paid = student_centre['paid'] #d调取新增用户-报名 addpayment(self, student_name, student_phone, assessment, paid) driver = self.driver time.sleep(8) #财务管理 driver.find_element_by_xpath("//span[contains(.,'财务管理')]").click() time.sleep(2) driver.find_element_by_link_text('支付确认').click() time.sleep(1) #查询 driver.find_element_by_id('phone').click() driver.find_element_by_id('phone').send_keys(student_phone) driver.find_element_by_xpath( '//*[@id="hisroot"]/div/div/section/div/div/div/section/main/div/section/header/form/div[2]/div/button[1]' ).click() time.sleep(2) #驳回 driver.find_element_by_xpath( '//*[@id="hisroot"]/div/div/section/div/div/div/section/main/div/section/main/div/div/div/div/div/div/div/div[2]/div[2]/div/div/table/tbody/tr[1]/td[2]/span[2]/span/a' ).click() time.sleep(2) #驳回原因 driver.find_element_by_xpath('//*[@id="rejectReason"]').click() driver.find_element_by_xpath('//*[@id="rejectReason"]').send_keys( '信息有误') time.sleep(1) #保存 driver.find_element_by_xpath( '/html/body/div[9]/div/div[2]/div/div[2]/div[3]/button[2]').click( ) time.sleep(2) # #断言 masg = driver.find_element_by_xpath( '//*[@id="hisroot"]/div/div/section/div/div/div/section/main/div/section/main/div/div/div/div/div/div/div/div[2]/div[1]/div/table/tbody/tr[1]/td[4]' ).text print(masg) self.assertEqual(masg, "已驳回")
def test_a_student_center_apply_return(self): u"""学员中心-报名-退费""" #传入参数 #新增学员电话号码 student_phone=student_centre['return'] #新增学员姓名 student_name=student_centre['name'] #应缴费用 assessment=student_centre['assessment'] #实缴费用 paid=student_centre['paid'] #d调取新增用户-报名 addpayment(self, student_name, student_phone, assessment, paid) driver = self.driver time.sleep(1) #点击报名 driver.find_element_by_xpath('//*[@id="student-detail-menu"]/ul/li[10]/a').click() time.sleep(1) #点击操作 driver.find_element_by_xpath('//*[@id="reservation"]/div/div/ul/li/div[3]/div/div[2]/div/div[1]/div/div[2]/div/button[2]').click() time.sleep(1) #退费 driver.find_element_by_xpath('/html/body/div[9]/div/div/ul/li[3]').click() time.sleep(2) #新增等待 #扣费金额 driver.find_element_by_xpath('/html/body/div[10]/div/div[2]/div/div[2]/div[2]/form/div[2]/div[2]/div/div[2]/div/div[2]/div/span/div/div[2]/input').click() driver.find_element_by_xpath('/html/body/div[10]/div/div[2]/div/div[2]/div[2]/form/div[2]/div[2]/div/div[2]/div/div[2]/div/span/div/div[2]/input').send_keys(1) time.sleep(1) #收款人 driver.find_element_by_id('payee').click() driver.find_element_by_id('payee').send_keys(student_name) #收款方式 time.sleep(1) driver.find_element_by_xpath('//*[@id="categoryId"]/div/div').click() time.sleep(1) driver.find_element_by_xpath('/html/body/div[11]/div/div/div/ul').find_element_by_class_name('ant-select-dropdown-menu-item').click() #收款账号 time.sleep(1) driver.find_element_by_xpath('/html/body/div[10]/div/div[2]/div/div[2]/div[2]/form/div[5]/div[2]/div[2]/div/div/div[2]/div/span/input').click() driver.find_element_by_xpath('/html/body/div[10]/div/div[2]/div/div[2]/div[2]/form/div[5]/div[2]/div[2]/div/div/div[2]/div/span/input').send_keys(student_phone) time.sleep(1) #确定 driver.find_element_by_xpath('/html/body/div[10]/div/div[2]/div/div[2]/div[3]/button[2]').click() time.sleep(2) #断言 masg=driver.find_element_by_xpath('//*[@id="reservation"]/div/div/ul/li/div[3]/div/div[2]/div/div[1]/div/div[1]/div/span/span').text print(masg) self.assertEqual(masg,'已退费')
def test_a_order_manage_freeze(self): u"""学服中心-订单管理-冻结""" #传入参数 #新增学员电话号码 student_phone = study_service['freeze'] #新增学员姓名 student_name = student_centre['name'] #应缴费用 assessment = student_centre['assessment'] #实缴费用 paid = student_centre['paid'] #d调取新增用户-报名 addpayment(self, student_name, student_phone, assessment, paid) time.sleep(5) driver = self.driver time.sleep(1) #学服中心 driver.find_element_by_xpath("//span[contains(.,'学服中心')]").click() time.sleep(1) driver.find_element_by_link_text('订单管理').click() time.sleep(2) #查询 driver.find_element_by_id('customerInfo').click() driver.find_element_by_id('customerInfo').send_keys(student_phone) driver.find_element_by_xpath("//button[contains(.,'查 询')]").click() time.sleep(2) #进入子订单 driver.find_element_by_xpath( '//*[@id="hisroot"]/div/div/section/div/div/div/section/main/div/div/div/div/div/div/div/div/div/div/div[2]/div/div/table/tbody/tr[1]/td/span[2]' ).click() time.sleep(1) #冻结 driver.find_element_by_xpath( '//*[@id="hisroot"]/div/div/section/div/div/div/section/main/div/div/div/div/div/div/div/div/div/div/div[3]/div/div/table/tbody/tr[2]/td/span/span[3]/span/a' ).click() time.sleep(1) #确定 driver.find_element_by_xpath( '/html/body/div[9]/div/div/div/div[2]/div/div/div[2]/button[2]' ).click() time.sleep(2) #断言 masg = driver.find_element_by_xpath( '//*[@id="hisroot"]/div/div/section/div/div/div/section/main/div/div/div/div/div/div/div/div/div/div/div[2]/div/div/table/tbody/tr[2]/td' ).text print(masg) self.assertEqual(masg, '已冻结')
def test_a_affirm(self): u"""支付管理-支付确认-确认""" #传入参数 #新增学员电话号码 student_phone = financial_management['affirm'] #新增学员姓名 student_name = student_centre['name'] #应缴费用 assessment = student_centre['assessment'] #实缴费用 paid = student_centre['paid'] #d调取新增用户-报名 addpayment(self, student_name, student_phone, assessment, paid) driver = self.driver time.sleep(8) #财务管理 driver.find_element_by_xpath("//span[contains(.,'财务管理')]").click() time.sleep(2) driver.find_element_by_link_text('支付确认').click() time.sleep(1) #查询 driver.find_element_by_id('phone').click() driver.find_element_by_id('phone').send_keys(student_phone) driver.find_element_by_xpath( '//*[@id="hisroot"]/div/div/section/div/div/div/section/main/div/section/header/form/div[2]/div/button[1]' ).click() time.sleep(2) #确认 driver.find_element_by_xpath( '//*[@id="hisroot"]/div/div/section/div/div/div/section/main/div/section/main/div/div/div/div/div/div/div/div[2]/div[2]/div/div/table/tbody/tr[1]/td[2]/span[2]/a[1]' ).click() time.sleep(2) #确认 driver.find_element_by_xpath( '/html/body/div[9]/div/div[2]/div/div[2]/div[3]/div/button[2]' ).click() time.sleep(2) # #断言 masg = driver.find_element_by_xpath( '//*[@id="hisroot"]/div/div/section/div/div/div/section/main/div/section/main/div/div/div/div/div/div/div/div[2]/div[1]/div/table/tbody/tr[1]/td[4]' ).text print(masg) self.assertEqual(masg, "已确认")
def test_a_student_center_apply_postpone(self): u"""学员中心-报名-延期""" #传入参数 #新增学员电话号码 student_phone = student_centre['postpone'] #新增学员姓名 student_name = student_centre['name'] #应缴费用 assessment = student_centre['assessment'] #实缴费用 paid = student_centre['paid'] #延期时间 postponetime = student_centre['time'] #调取新增用户-报名 addpayment(self, student_name, student_phone, assessment, paid) driver = self.driver time.sleep(1) #点击报名 driver.find_element_by_xpath( '//*[@id="student-detail-menu"]/ul/li[10]/a').click() time.sleep(1) # 点击操作 driver.find_element_by_xpath( '//*[@id="reservation"]/div/div/ul/li/div[3]/div/div[2]/div/div[1]/div/div[2]/div/button[2]' ).click() time.sleep(1) # 延期 driver.find_element_by_xpath( '/html/body/div[9]/div/div/ul/li[2]').click() time.sleep(1) #延期时间 driver.find_element_by_xpath('//*[@id="expireDay"]/div').click() time.sleep(1) driver.find_element_by_xpath( '/html/body/div[11]/div/div/div/div/div[2]/div[2]/table/tbody/tr[6]/td[7]' ).click() time.sleep(1) #确定 driver.find_element_by_xpath( '/html/body/div[10]/div/div[2]/div/div[2]/div[3]/button[2]').click( ) time.sleep(1)
def test_a_student_center_apply_freeze(self): u"""学员中心-报名-冻结""" #传入参数 #新增学员电话号码 student_phone = student_centre['freeze'] #新增学员姓名 student_name = student_centre['name'] #应缴费用 assessment = student_centre['assessment'] #实缴费用 paid = student_centre['paid'] #d调取新增用户-报名 addpayment(self, student_name, student_phone, paid, assessment) driver = self.driver time.sleep(1) #点击报名 driver.find_element_by_xpath( '//*[@id="student-detail-menu"]/ul/li[10]/a').click() time.sleep(1) #冻结 driver.find_element_by_xpath( '//*[@id="reservation"]/div/div/ul/li/div[3]/div/div[2]/div/div[1]/div/div[2]/div/button[1]' ).click() time.sleep(1) #确定 driver.find_element_by_xpath( '/html/body/div[9]/div/div/div/div[2]/div/div/div[2]/button[2]' ).click() time.sleep(2) #断言 masg = driver.find_element_by_xpath( '//*[@id="reservation"]/div/div/ul/li/div[3]/div/div[2]/div/div[1]/div/div[2]/div/button[1]' ).text print(masg)
def test_a_order_manage_return(self): u"""学服中心-订单管理-退费""" #传入参数 #新增学员电话号码 student_phone = study_service['return'] #新增学员姓名 student_name = student_centre['name'] #应缴费用 assessment = student_centre['assessment'] #实缴费用 paid = student_centre['paid'] #退费-扣费金额 return_money = study_service['return_money'] #d调取新增用户-报名 addpayment(self, student_name, student_phone, assessment, paid) time.sleep(5) driver = self.driver time.sleep(1) #学服中心 driver.find_element_by_xpath("//span[contains(.,'学服中心')]").click() time.sleep(1) driver.find_element_by_link_text('订单管理').click() time.sleep(2) #查询 driver.find_element_by_id('customerInfo').click() driver.find_element_by_id('customerInfo').send_keys(student_phone) driver.find_element_by_xpath("//button[contains(.,'查 询')]").click() time.sleep(2) #进入子订单 driver.find_element_by_xpath( '//*[@id="hisroot"]/div/div/section/div/div/div/section/main/div/div/div/div/div/div/div/div/div/div/div[2]/div/div/table/tbody/tr[1]/td/span[2]' ).click() time.sleep(1) #退费 driver.find_element_by_xpath( '//*[@id="hisroot"]/div/div/section/div/div/div/section/main/div/div/div/div/div/div/div/div/div/div/div[3]/div/div/table/tbody/tr[2]/td/span/span[1]/a' ).click() time.sleep(1) #扣费金额 driver.find_element_by_xpath( '/html/body/div[9]/div/div[2]/div/div[2]/div[2]/form/div[2]/div[2]/div/div[2]/div/div[2]/div/span/div/div[2]/input' ).click() driver.find_element_by_xpath( '/html/body/div[9]/div/div[2]/div/div[2]/div[2]/form/div[2]/div[2]/div/div[2]/div/div[2]/div/span/div/div[2]/input' ).send_keys(return_money) time.sleep(1) #收款人 driver.find_element_by_id('payee').click() driver.find_element_by_id('payee').send_keys(student_name) #收款方式 driver.find_element_by_xpath('//*[@id="categoryId"]/div/div').click() driver.find_element_by_xpath( '/html/body/div[10]/div/div/div/ul').find_element_by_class_name( 'ant-select-dropdown-menu-item').click() time.sleep(1) #收款账号 driver.find_element_by_xpath( '/html/body/div[9]/div/div[2]/div/div[2]/div[2]/form/div[5]/div[2]/div[2]/div/div/div[2]/div/span/input' ).click() driver.find_element_by_xpath( '/html/body/div[9]/div/div[2]/div/div[2]/div[2]/form/div[5]/div[2]/div[2]/div/div/div[2]/div/span/input' ).send_keys(student_phone) time.sleep(1) #确定 driver.find_element_by_xpath( '/html/body/div[9]/div/div[2]/div/div[2]/div[3]/button[2]').click( ) time.sleep(5) #d断言 masg = driver.find_element_by_xpath( '//*[@id="hisroot"]/div/div/section/div/div/div/section/main/div/div/div/div/div/div/div/div/div/div/div[2]/div/div/table/tbody/tr[2]/td' ).text print(masg) self.assertEqual(masg, '已退费')
def test_c_invoice(self): u"""财务管理-发票管理—开票""" #传入参数 #新增学员电话号码 student_phone=financial_management['invoice'] #新增学员姓名 student_name=student_centre['name'] #应缴费用 assessment=student_centre['assessment'] #实缴费用 paid=student_centre['paid'] # 发票金额 invoice = student_centre['invoice'] # 发票内容 invoice_content = student_centre['invoice_content'] #d调取新增用户-报名 addpayment(self, student_name, student_phone, assessment, paid) driver = self.driver time.sleep(1) # 发票 driver.find_element_by_link_text('发票').click() time.sleep(2) # 发票申请 driver.find_element_by_xpath( '//*[@id="hisroot"]/div/div/section/div/div/div/section/main/div/div/div/section/section/main/section/main/section/main/section/div/div/header/div/div/h2/button').click() time.sleep(2) # 发票类型 电子发票 driver.find_element_by_xpath('//*[@id="typeCode"]/label[2]').click() time.sleep(2) # 发票抬头 driver.find_element_by_css_selector('#titleTypeCode > label:nth-child(1)').click() time.sleep(1) # 发票金额 driver.find_element_by_id('amount').click() driver.find_element_by_id('amount').send_keys(invoice) time.sleep(1) # 发票内容 driver.find_element_by_id('content').click() driver.find_element_by_id('content').send_keys(invoice_content) time.sleep(1) # 发票抬头 driver.find_element_by_id('title').click() driver.find_element_by_id('title').send_keys('螳螂科技') time.sleep(1) # 纳税人识别码 driver.find_element_by_id('dutyParagraph').click() driver.find_element_by_id('dutyParagraph').send_keys(student_phone) time.sleep(1) # 手机 driver.find_element_by_id('phone').click() driver.find_element_by_id('phone').send_keys(student_phone) time.sleep(1) # 保存 driver.find_element_by_xpath('/html/body/div[9]/div/div[2]/div/div[2]/div[3]/button[2]').click() time.sleep(2) #财务管理 driver.find_element_by_xpath("//span[contains(.,'财务管理')]").click() time.sleep(1) driver.find_element_by_link_text('发票管理').click() time.sleep(2) #查询 driver.find_element_by_xpath('//*[@id="phone"]').click() driver.find_element_by_xpath('//*[@id="phone"]').send_keys(student_phone) driver.find_element_by_xpath('//*[@id="hisroot"]/div/div/section/div/div/div/section/main/div/section/header/form/div[4]/div/button[1]').click() time.sleep(2) #开票 driver.find_element_by_xpath('//*[@id="hisroot"]/div/div/section/div/div/div/section/main/div/section/main/div/div/div/div/div/div/div/div/div/table/tbody/tr/td[14]/span/span/a[1]').click() time.sleep(1) #确定 driver.find_element_by_xpath('/html/body/div[9]/div/div/div/div[2]/div/div/div[2]/button[2]').click() time.sleep(2) #断言 masg=driver.find_element_by_xpath('//*[@id="hisroot"]/div/div/section/div/div/div/section/main/div/section/main/div/div/div/div/div/div/div/div/div/table/tbody/tr/td[1]').text print(masg) self.assertEqual(masg,"已开票") time.sleep(2) #作废 driver.find_element_by_xpath('//*[@id="hisroot"]/div/div/section/div/div/div/section/main/div/section/main/div/div/div/div/div/div/div/div/div/table/tbody/tr/td[14]/span/span[2]/a').click() time.sleep(2) #确定 driver.find_element_by_xpath('/html/body/div[9]/div/div/div/div[2]/div/div/div[2]/button[2]').click() time.sleep(2) #弹窗 driver.find_element_by_xpath('/html/body/div[10]/div/div[2]/div/div[2]/div/div/div[2]/button').click() time.sleep(3)
def test_a_order_mansge_addpllay(self): u"""学服中心-订单管理-增加报考""" #传入参数 #新增学员电话号码 student_phone = study_service['addpllay'] #新增学员姓名 student_name = student_centre['name'] #应缴费用 assessment = student_centre['assessment'] #实缴费用 paid = student_centre['paid'] #d调取新增用户-报名 addpayment(self, student_name, student_phone, assessment, paid) time.sleep(5) driver = self.driver time.sleep(1) #学服中心 driver.find_element_by_xpath("//span[contains(.,'学服中心')]").click() time.sleep(1) driver.find_element_by_link_text('订单管理').click() time.sleep(2) #查询 driver.find_element_by_id('customerInfo').click() driver.find_element_by_id('customerInfo').send_keys(student_phone) driver.find_element_by_xpath("//button[contains(.,'查 询')]").click() time.sleep(2) #报考 driver.find_element_by_xpath( '//*[@id="hisroot"]/div/div/section/div/div/div/section/main/div/div/div/div/div/div/div/div/div/div/div[3]/div/div/table/tbody/tr[1]/td/div/a[2]' ).click() time.sleep(1) #新增 driver.find_element_by_xpath( '/html/body/div[9]/div/div[2]/div/div[2]/div[2]/div/div/div/div/div/div[1]/div/button' ).click() time.sleep(1) #报考年份 driver.find_element_by_id('candidateYear').click() time.sleep(1) driver.find_element_by_id('candidateYear').send_keys('2019') time.sleep(1) #报考省份 driver.find_element_by_xpath('//*[@id="provinceId"]/div/div').click() time.sleep(1) driver.find_element_by_xpath( '/html/body/div[11]/div/div/div/ul').find_element_by_class_name( 'ant-select-dropdown-menu-item').click() time.sleep(1) time.sleep(1) #报考类型 driver.find_element_by_xpath( '//*[@id="candidateType"]/div/div').click() time.sleep(1) driver.find_element_by_xpath( '/html/body/div[12]/div/div/div/ul').find_element_by_class_name( 'ant-select-dropdown-menu-item').click() time.sleep(1) #是否报考 driver.find_element_by_xpath( '//*[@id="iscandidate"]/label[1]/span[1]/input').click() #报考资料提交 driver.find_element_by_xpath( '//*[@id="candidateDataSubmit"]/label[1]/span[1]/input').click() #保存 driver.find_element_by_xpath( '/html/body/div[10]/div/div[2]/div/div[2]/div[3]/button[2]').click( ) time.sleep(2) #断言 masg = driver.find_element_by_xpath( '/html/body/div[9]/div/div[2]/div/div[2]/div[2]/div/div/div/div/div/div[2]/div/table/tbody/tr/td[5]' ).text print(masg) self.assertIsNotNone(masg, ' ') #关闭 driver.find_element_by_xpath( '/html/body/div[9]/div/div[2]/div/div[2]/div[3]/button').click()
def test_b_textbook_inquire(self): u"""学服中心-补发教材-快递补发""" #传入参数 #新增学员电话号码 student_phone = study_service['textbook'] with open('D:\\Mantisadministrationhcmasp\\configFile\\student2.txt', 'w') as f: f.write(student_phone) f.close() #新增学员姓名 student_name = student_centre['name'] #应缴费用 assessment = student_centre['assessment'] #实缴费用 paid = student_centre['paid'] #快递补发地址 site = student_centre['site'] #d调取新增用户-报名 addpayment(self, student_name, student_phone, assessment, paid) time.sleep(5) driver = self.driver time.sleep(1) #学服中心 driver.find_element_by_xpath("//span[contains(.,'学服中心')]").click() time.sleep(1) driver.find_element_by_link_text('订单管理').click() time.sleep(2) #查询 driver.find_element_by_id('customerInfo').click() driver.find_element_by_id('customerInfo').send_keys(student_phone) driver.find_element_by_xpath("//button[contains(.,'查 询')]").click() time.sleep(2) #获取订单id id = driver.find_element_by_xpath( '//*[@id="hisroot"]/div/div/section/div/div/div/section/main/div/div/div/div/div/div/div/div/div/div/div[1]/div/table/tbody/tr[1]/td[3]/span' ).text time.sleep(1) #教材补发 driver.find_element_by_link_text('教材补发').click() time.sleep(2) #根据客户id进行查询' driver.find_element_by_id('mspCustomerId').click() driver.find_element_by_id('mspCustomerId').send_keys(id) driver.find_element_by_xpath( '//*[@id="hisroot"]/div/div/section/div/div/div/section/main/div/section/header/form/div[2]/div[3]/button[2]' ).click() time.sleep(2) #快递补发 driver.find_element_by_xpath( '//*[@id="hisroot"]/div/div/section/div/div/div/section/main/div/section/main/div/div/div/div/div/div/div/div/div/table/tbody/tr/td[11]/span/a[1]' ).click() time.sleep(2) #获取补发教材名称 book = driver.find_element_by_xpath( '//*[@id="bookes"]/label[1]/span[2]').text #选择教材 driver.find_element_by_xpath( '//*[@id="bookes"]/label[1]/span[1]/input').click() #收件地址 driver.find_element_by_xpath( '/html/body/div[9]/div/div[2]/div/div[2]/div[2]/form/div[2]/div[1]/div/div/div/button' ).click() time.sleep(2) #收货人 driver.find_element_by_xpath( '/html/body/div[10]/div/div[2]/div/div[2]/div[2]/form/div[1]/div[1]/div/div[2]/div/span/input' ).click() driver.find_element_by_xpath( '/html/body/div[10]/div/div[2]/div/div[2]/div[2]/form/div[1]/div[1]/div/div[2]/div/span/input' ).send_keys(student_name) #联系方式 driver.find_element_by_xpath( '/html/body/div[10]/div/div[2]/div/div[2]/div[2]/form/div[1]/div[2]/div/div[2]/div/span/input' ).click() driver.find_element_by_xpath( '/html/body/div[10]/div/div[2]/div/div[2]/div[2]/form/div[1]/div[2]/div/div[2]/div/span/input' ).send_keys(student_phone) #地址 driver.find_element_by_xpath( '/html/body/div[10]/div/div[2]/div/div[2]/div[2]/form/div[3]/div/div/div[2]/div/span/textarea' ).click() driver.find_element_by_xpath( '/html/body/div[10]/div/div[2]/div/div[2]/div[2]/form/div[3]/div/div/div[2]/div/span/textarea' ).send_keys(site) #确定 driver.find_element_by_xpath( '/html/body/div[10]/div/div[2]/div/div[2]/div[3]/button[2]').click( ) time.sleep(2) #快递信息-邮寄日期 driver.find_element_by_xpath('//*[@id="bizDate"]/div/input').click() time.sleep(1) driver.find_element_by_partial_link_text('今天').click() #快递公司 driver.find_element_by_xpath( '//*[@id="expressInfoId"]/div/div').click() driver.find_element_by_xpath( '/html/body/div[12]/div/div/div/ul').find_element_by_class_name( 'ant-select-dropdown-menu-item').click() time.sleep(1) #快递单号 driver.find_element_by_id('expressCode').click() driver.find_element_by_id('expressCode').send_keys(student_phone) time.sleep(1) #保存 driver.find_element_by_xpath( '/html/body/div[9]/div/div[2]/div/div[2]/div[3]/button[2]').click( ) time.sleep(2) #断言 masg = driver.find_element_by_xpath( '//*[@id="hisroot"]/div/div/section/div/div/div/section/main/div/section/main/div/div/div/div/div/div/div/div/div/table/tbody/tr/td[9]' ).text print(masg) self.assertNotIn(masg, book)
def test_a_order_manage_transfer(self): u"""学服中心-订单管理-转班""" #传入参数 #新增学员电话号码 student_phone=study_service['transfer'] #新增学员姓名 student_name=student_centre['name'] #报名应缴费用 assessment=student_centre['assessment'] #报名实缴费用 paid=student_centre['paid'] #原班型退费金额 transfer_return=student_centre['transfer_return'] # 转班应缴费用 assessment2 = student_centre['assessment2'] #转班 实缴费用 paid2 = student_centre['paid2'] #转班发票号 fapiao = student_centre['fapiao'] f = open('D:\\Mantisadministrationhcmasp\\configFile\\commodity_name1.txt', 'r', encoding='utf-8') commodity_name1 = f.read() f.close() f = open('D:\\Mantisadministrationhcmasp\\configFile\\kaoqi.txt', 'r', encoding='utf-8') kaoqi = f.read() f.close() f = open('D:\\Mantisadministrationhcmasp\\configFile\\payment_way.txt', 'r', encoding='utf-8') payment_way = f.read() f.close() #d调取新增用户-报名 addpayment(self, student_name, student_phone, assessment, paid) time.sleep(5) driver = self.driver time.sleep(1) # 学服中心 driver.find_element_by_xpath("//span[contains(.,'学服中心')]").click() time.sleep(1) driver.find_element_by_link_text('订单管理').click() time.sleep(2) # 查询 driver.find_element_by_id('customerInfo').click() driver.find_element_by_id('customerInfo').send_keys(student_phone) driver.find_element_by_xpath( "//button[contains(.,'查 询')]").click() time.sleep(2) # 进入子订单 driver.find_element_by_xpath( '//*[@id="hisroot"]/div/div/section/div/div/div/section/main/div/div/div/div/div/div/div/div/div/div/div[2]/div/div/table/tbody/tr[1]/td/span[2]').click() time.sleep(1) # 转班 driver.find_element_by_xpath('//*[@id="hisroot"]/div/div/section/div/div/div/section/main/div/div/div/div/div/div/div/div/div/div/div[3]/div/div/table/tbody/tr[2]/td/span/span[2]/a').click() time.sleep(1) #原班型退费 -- 扣费金额 driver.find_element_by_xpath('/html/body/div[9]/div/div[2]/div/div[2]/div[2]/section/main/div/div/div/form/div[2]/div[2]/div/div[2]/div/div[2]/div/span/div/div[2]/input').click() driver.find_element_by_xpath('/html/body/div[9]/div/div[2]/div/div[2]/div[2]/section/main/div/div/div/form/div[2]/div[2]/div/div[2]/div/div[2]/div/span/div/div[2]/input').send_keys(transfer_return) time.sleep(1) #下一步 driver.find_element_by_xpath('/html/body/div[9]/div/div[2]/div/div[2]/div[2]/section/main/div/div/div/div/button').click() time.sleep(2) #转入新班 driver.find_element_by_xpath('/html/body/div[9]/div/div[2]/div/div[2]/div[2]/section/main/div/div/div/div[1]/div[1]/div/div[2]/div/button').click() time.sleep(1) #班型 driver.find_element_by_xpath('/html/body/div[10]/div/div[2]/div/div[2]/div[2]/div/div/div/div/div[1]/div/div[3]/div/div[2]/div/span/input').click() driver.find_element_by_xpath('/html/body/div[10]/div/div[2]/div/div[2]/div[2]/div/div/div/div/div[1]/div/div[3]/div/div[2]/div/span/input').send_keys(commodity_name1) time.sleep(1) # driver.find_element_by_xpath('/html/body/div[10]/div/div[2]/div/div[2]/div[2]/div/div/div/div/div[2]/div/table/tbody/tr/td[1]/span/label/span/input').click() time.sleep(1) #确定 driver.find_element_by_xpath('/html/body/div[10]/div/div[2]/div/div[2]/div[3]/button[2]').click() time.sleep(2) #考期 driver.find_element_by_xpath('//td[6]/div/div/div').click() driver.find_element_by_xpath("//li[contains(.,'"+kaoqi+"')]").click() time.sleep(2) #应缴费用 time.sleep(1) driver.find_element_by_xpath('/html/body/div[9]/div/div[2]/div/div[2]/div[2]/section/main/div/div/div/div[1]/div[2]/div/div/div/div/div/div/table/tbody/tr/td[7]/div/div[2]/input').send_keys(assessment2) #选择补发形式 driver.find_element_by_xpath('//span[4]/div/div/div').click() time.sleep(1) driver.find_element_by_xpath("//li[contains(.,'现场发放')]").click() time.sleep(1) #下一步 driver.find_element_by_xpath("//button[contains(.,'下一步')]").click() time.sleep(2) #支付信息 新UI driver.find_element_by_xpath( '/html/body/div[9]/div/div[2]/div/div[2]/div[2]/section/main/div/div/div/form/div[3]/div/div[1]/div[1]/div/div[2]/div/span/div/div/div').click() time.sleep(2) driver.find_element_by_xpath("//li[contains(.,'定金费')]").click() time.sleep(3) # 支付方式 driver.find_element_by_xpath( '/html/body/div[9]/div/div[2]/div/div[2]/div[2]/section/main/div/div/div/form/div[3]/div/div[1]/div[2]/div/div[2]/div/span/div/div/div').click() time.sleep(2) driver.find_element_by_xpath("//li[contains(.,'" + payment_way + "')]").click() time.sleep(1) # 小票号 driver.find_element_by_xpath( '/html/body/div[9]/div/div[2]/div/div[2]/div[2]/section/main/div/div/div/form/div[3]/div/div[3]/div[3]/div/div[2]/div/span/input').send_keys( fapiao) time.sleep(1) # 支付金额 driver.find_element_by_xpath( '/html/body/div[9]/div/div[2]/div/div[2]/div[2]/section/main/div/div/div/form/div[3]/div/div[3]/div[2]/div/div[2]/div/span/div/div[2]/input').send_keys( paid2) #提交 driver.find_element_by_xpath( '/html/body/div[9]/div/div[2]/div/div[2]/div[2]/section/main/div/div/div/div/button[2]').click() time.sleep(2) #断言 #进入子订单 driver.find_element_by_xpath( '//*[@id="hisroot"]/div/div/section/div/div/div/section/main/div/div/div/div/div/div/div/div/div/div/div[2]/div/div/table/tbody/tr[1]/td/span[2]').click() time.sleep(1) masg=driver.find_element_by_xpath('//*[@id="hisroot"]/div/div/section/div/div/div/section/main/div/div/div/div/div/div/div/div/div/div/div[2]/div/div/table/tbody/tr[2]/td').text print(masg) self.assertIn(masg,'已转')
def test_a_order_manage_addpayment(self): u"""学服中心-订单管理-增加支付单""" #传入参数 #新增学员电话号码 student_phone = study_service['addpayment'] #新增学员姓名 student_name = student_centre['name'] #应缴费用 assessment = study_service['assessment'] #实缴费用 paid = study_service['paid'] #支付单补缴金额 repair = study_service['repair'] #d调取新增用户-报名 addpayment(self, student_name, student_phone, assessment, paid) driver = self.driver time.sleep(8) #增加通知消失时间 #学服中心 driver.find_element_by_xpath("//span[contains(.,'学服中心')]").click() time.sleep(1) #订单管理 driver.find_element_by_link_text('订单管理').click() time.sleep(2) #查询 driver.find_element_by_id('customerInfo').click() driver.find_element_by_id('customerInfo').send_keys(student_phone) driver.find_element_by_xpath("//button[contains(.,'查 询')]").click() time.sleep(2) #支付单 driver.find_element_by_xpath( '//*[@id="hisroot"]/div/div/section/div/div/div/section/main/div/div/div/div/div/div/div/div/div/div/div[3]/div/div/table/tbody/tr[1]/td/div/a[1]' ).click() time.sleep(1) #新增支付单 driver.find_element_by_xpath( '/html/body/div[9]/div/div[2]/div/div[2]/div[2]/div/div/div/div/div[1]/div/button' ).click() time.sleep(2) #新增支付金额 driver.find_element_by_xpath('//*[@id="amount"]').click() driver.find_element_by_xpath('//*[@id="amount"]').send_keys(repair) #费用类型 driver.find_element_by_xpath('//*[@id="feeTypeId"]/div/div').click() driver.find_element_by_xpath( '/html/body/div[11]/div/div/div/ul').find_element_by_class_name( 'ant-select-dropdown-menu-item').click() time.sleep(1) #确定 driver.find_element_by_xpath( '/html/body/div[10]/div/div[2]/div/div[2]/div[3]/div/button[2]' ).click() time.sleep(1) #断言 masg = driver.find_element_by_xpath( '/html/body/div[9]/div/div[2]/div/div[2]/div[2]/div/div/div/div/div[2]/div/table/tbody/tr/td[4]' ).text print(masg) self.assertIsNotNone(masg, ' ') #取消 driver.find_element_by_xpath( '/html/body/div[9]/div/div[2]/div/div[2]/div[3]/button').click()
def test_a_student_center_apply_transfer(self): u"""学员中心-报名-转班""" #传入参数 f = open( 'D:\\Mantisadministrationhcmasp\\configFile\\commodity_name1.txt', 'r', encoding='utf-8') commodity_name1 = f.read() f.close() f = open('D:\\Mantisadministrationhcmasp\\configFile\\payment_way.txt', 'r', encoding='utf-8') payment_way = f.read() f.close() #新增学员电话号码 student_phone = student_centre['transfer'] #新增学员姓名 student_name = student_centre['name'] #报名应缴费用 assessment = student_centre['assessment'] #报名实缴费用 paid = student_centre['paid'] #原班型退费金额 transfer_return = student_centre['transfer_return'] #转班班型 # 转班应缴费用 assessment2 = student_centre['assessment2'] #转班 实缴费用 paid2 = student_centre['paid2'] #d调取新增用户-报名 addpayment(self, student_name, student_phone, assessment, paid) driver = self.driver time.sleep(1) #点击报名 driver.find_element_by_xpath( '//*[@id="student-detail-menu"]/ul/li[10]/a').click() time.sleep(1) # 点击操作 driver.find_element_by_xpath( '//*[@id="reservation"]/div/div/ul/li/div[3]/div/div[2]/div/div[1]/div/div[2]/div/button[2]' ).click() time.sleep(1) # 转班 driver.find_element_by_xpath( '/html/body/div[9]/div/div/ul/li[1]').click() time.sleep(1) #原班型退费 -- 扣费金额 driver.find_element_by_xpath( '/html/body/div[9]/div/div[2]/div/div[2]/div[2]/section/main/div/div/div/form/div[2]/div[2]/div/div[2]/div/div[2]/div/span/div/div[2]/input' ).click() driver.find_element_by_xpath( '/html/body/div[9]/div/div[2]/div/div[2]/div[2]/section/main/div/div/div/form/div[2]/div[2]/div/div[2]/div/div[2]/div/span/div/div[2]/input' ).send_keys(transfer_return) time.sleep(1) #下一步 driver.find_element_by_xpath( '/html/body/div[9]/div/div[2]/div/div[2]/div[2]/section/main/div/div/div/div/button' ).click() time.sleep(2) #转入新班 driver.find_element_by_xpath( '/html/body/div[9]/div/div[2]/div/div[2]/div[2]/section/main/div/div/div/div[1]/div[1]/div/div[2]/div/button' ).click() time.sleep(1) #班型 driver.find_element_by_xpath( '/html/body/div[10]/div/div[2]/div/div[2]/div[2]/div/div/div/div/div[1]/div/div[3]/div/div[2]/div/span/input' ).click() driver.find_element_by_xpath( '/html/body/div[10]/div/div[2]/div/div[2]/div[2]/div/div/div/div/div[1]/div/div[3]/div/div[2]/div/span/input' ).send_keys(commodity_name1) time.sleep(1) # driver.find_element_by_xpath( '/html/body/div[10]/div/div[2]/div/div[2]/div[2]/div/div/div/div/div[2]/div/table/tbody/tr/td[1]/span/label/span/input' ).click() time.sleep(1) #确定 driver.find_element_by_xpath( '/html/body/div[10]/div/div[2]/div/div[2]/div[3]/button[2]').click( ) time.sleep(2) #考期 driver.find_element_by_xpath( '/html/body/div[9]/div/div[2]/div/div[2]/div[2]/section/main/div/div/div/div[1]/div[2]/div/div/div/div/div/div/table/tbody/tr/td[6]/div/div/div' ).click() time.sleep(1) driver.find_element_by_xpath( '/html/body/div[11]/div/div/div/ul').find_element_by_class_name( 'ant-select-dropdown-menu-item').click() time.sleep(3) #应缴费用 driver.find_element_by_xpath( '/html/body/div[9]/div/div[2]/div/div[2]/div[2]/section/main/div/div/div/div[1]/div[2]/div/div/div/div/div/div/table/tbody/tr/td[7]/div/div[2]/input' ).send_keys(assessment2) #选择补发形式 driver.find_element_by_xpath( '/html/body/div[9]/div/div[2]/div/div[2]/div[2]/section/main/div/div/div/div[2]/span[4]/div/div/div' ).click() driver.find_element_by_xpath( '/html/body/div[12]/div/div/div/ul').find_element_by_class_name( 'ant-select-dropdown-menu-item').click() time.sleep(1) #下一步 driver.find_element_by_xpath( '/html/body/div[9]/div/div[2]/div/div[2]/div[2]/section/main/div/div/div/div[3]/button[2]' ).click() time.sleep(2) #支付信息 # 费用类型 16号修改支付信息页面新UI driver.find_element_by_xpath( '/html/body/div[9]/div/div[2]/div/div[2]/div[2]/section/main/div/div/div/form/div[3]/div/div[1]/div[1]/div/div[2]/div/span/div/div/div' ).click() time.sleep(2) driver.find_element_by_xpath("//li[contains(.,'定金费')]").click() time.sleep(3) # 支付方式 driver.find_element_by_xpath( '/html/body/div[9]/div/div[2]/div/div[2]/div[2]/section/main/div/div/div/form/div[3]/div/div[1]/div[2]/div/div[2]/div/span/div/div/div' ).click() time.sleep(2) driver.find_element_by_xpath("//li[contains(.,'" + payment_way + "')]").click() time.sleep(1) # 小票号 driver.find_element_by_xpath( '/html/body/div[9]/div/div[2]/div/div[2]/div[2]/section/main/div/div/div/form/div[3]/div/div[3]/div[3]/div/div[2]/div/span/input' ).send_keys(student_phone) time.sleep(1) # 支付金额 driver.find_element_by_xpath( '/html/body/div[9]/div/div[2]/div/div[2]/div[2]/section/main/div/div/div/form/div[3]/div/div[3]/div[2]/div/div[2]/div/span/div/div[2]/input' ).send_keys(paid2) try: #分期数 driver.find_element_by_xpath( '/html/body/div[9]/div/div[2]/div/div[2]/div[2]/section/main/div/div/div/form/div[3]/div/div[4]/div/div[2]/div/span/div/div/div' ).click() driver.find_element_by_xpath( '/html/body/div[12]/div/div/div/ul' ).find_element_by_class_name( 'ant-select-dropdown-menu-item').click() except: pass finally: #提交 driver.find_element_by_xpath( '/html/body/div[9]/div/div[2]/div/div[2]/div[2]/section/main/div/div/div/div/button[2]' ).click() time.sleep(2) #断言 masg = driver.find_element_by_xpath( '//*[@id="reservation"]/div/div/ul/li/div[3]/div/div[2]/div[2]/div[1]/div/div[1]/div/span/span' ).text print(masg) self.assertIn(masg, '已转')
def test_b_return_manage_affirm(self): u"""财务管理-退费管理-查看记录-确认""" #传入参数 #新增学员电话号码 student_phone = financial_management['return'] #新增学员姓名 student_name = student_centre['name'] #应缴费用 assessment = student_centre['assessment'] #实缴费用 paid = student_centre['paid'] #退费-扣费金额 return_money = study_service['return_money'] #d调取新增用户-报名 addpayment(self, student_name, student_phone, assessment, paid) driver = self.driver time.sleep(5) #增加等待时间,防止通知遮挡元素 #学服中心 driver.find_element_by_xpath("//span[contains(.,'学服中心')]").click() time.sleep(2) driver.find_element_by_link_text('订单管理').click() time.sleep(2) #查询 driver.find_element_by_id('customerInfo').click() driver.find_element_by_id('customerInfo').send_keys(student_phone) driver.find_element_by_xpath( '//*[@id="hisroot"]/div/div/section/div/div/div/section/main/div/div/form/div/div[21]/button[1]' ).click() #查询按钮26改为21 time.sleep(2) #获取订单id id = driver.find_element_by_xpath( '//*[@id="hisroot"]/div/div/section/div/div/div/section/main/div/div/div/div/div/div/div/div/div/div/div[1]/div/table/tbody/tr[1]/td[3]' ).text time.sleep(1) #进入子订单 driver.find_element_by_xpath( '//*[@id="hisroot"]/div/div/section/div/div/div/section/main/div/div/div/div/div/div/div/div/div/div/div[2]/div/div/table/tbody/tr[1]/td/span[2]' ).click() time.sleep(1) #退费 driver.find_element_by_xpath( '//*[@id="hisroot"]/div/div/section/div/div/div/section/main/div/div/div/div/div/div/div/div/div/div/div[3]/div/div/table/tbody/tr[2]/td/span/span[1]/a' ).click() time.sleep(1) #扣费金额 driver.find_element_by_xpath( '/html/body/div[9]/div/div[2]/div/div[2]/div[2]/form/div[2]/div[2]/div/div[2]/div/div[2]/div/span/div/div[2]/input' ).click() driver.find_element_by_xpath( '/html/body/div[9]/div/div[2]/div/div[2]/div[2]/form/div[2]/div[2]/div/div[2]/div/div[2]/div/span/div/div[2]/input' ).send_keys(return_money) time.sleep(1) #收款人 driver.find_element_by_id('payee').click() driver.find_element_by_id('payee').send_keys(student_name) #收款方式 driver.find_element_by_xpath('//*[@id="categoryId"]/div/div').click() driver.find_element_by_xpath( '/html/body/div[10]/div/div/div/ul').find_element_by_class_name( 'ant-select-dropdown-menu-item').click() time.sleep(1) #收款账号 driver.find_element_by_xpath( '/html/body/div[9]/div/div[2]/div/div[2]/div[2]/form/div[5]/div[2]/div[2]/div/div/div[2]/div/span/input' ).click() driver.find_element_by_xpath( '/html/body/div[9]/div/div[2]/div/div[2]/div[2]/form/div[5]/div[2]/div[2]/div/div/div[2]/div/span/input' ).send_keys(student_phone) time.sleep(1) #确定 driver.find_element_by_xpath( '/html/body/div[9]/div/div[2]/div/div[2]/div[3]/button[2]').click( ) time.sleep(5) # 财务管理 driver.find_element_by_xpath("//span[contains(.,'财务管理')]").click() time.sleep(2) driver.find_element_by_link_text('退费管理').click() time.sleep(2) #查询 driver.find_element_by_xpath('//*[@id="mspCustomerId"]').click() driver.find_element_by_xpath('//*[@id="mspCustomerId"]').send_keys(id) driver.find_element_by_xpath( '//*[@id="hisroot"]/div/div/section/div/div/div/section/main/div/section/header/form/div/div[7]/button[1]' ).click() time.sleep(2) #查看记录 driver.find_element_by_xpath( '//*[@id="hisroot"]/div/div/section/div/div/div/section/main/div/section/main/div/div/div/div/div/div/div/div/div[3]/div/div/table/tbody/tr/td/div/span[2]/span/a' ).click() time.sleep(2) #查看记录断言 masg = driver.find_element_by_xpath( '/html/body/div[9]/div/div[2]/div/div[2]/div[1]/div').text print(masg) self.assertEqual(masg, '退费记录') time.sleep(1) #取消 driver.find_element_by_xpath( '/html/body/div[9]/div/div[2]/div/div[2]/div[3]/button').click() time.sleep(2) #确认 driver.find_element_by_xpath( '//*[@id="hisroot"]/div/div/section/div/div/div/section/main/div/section/main/div/div/div/div/div/div/div/div/div[3]/div/div/table/tbody/tr/td/div/span[1]/a' ).click() time.sleep(2) #打款金额 driver.find_element_by_id('amount').click() driver.find_element_by_id('amount').send_keys('2998') time.sleep(1) #打款时间 driver.find_element_by_xpath('//*[@id="bizTime"]/div/input').click() driver.find_element_by_link_text('今天').click() time.sleep(1) #预计到账时间 driver.find_element_by_xpath('//*[@id="expectTime"]/div/input').click() driver.find_element_by_link_text('今天').click() time.sleep(1) #保存 driver.find_element_by_xpath( '/html/body/div[10]/div/div[2]/div/div[2]/div[3]/button[2]').click( ) time.sleep(2) #断言 --状态 masg = driver.find_element_by_xpath( '//*[@id="hisroot"]/div/div/section/div/div/div/section/main/div/section/main/div/div/div/div/div/div/div/div/div[2]/div/div/table/tbody/tr/td[1]/span[2]' ).text print(masg) self.assertEqual(masg, "已打款")