def testChangeOrder(self): returnNum = myDB.connect_function(myDB, 'func_autoInsertStudent(1)') studentName = '自动化学员' + returnNum self.ChangeOrder(studentName) myDB.connect_function(myDB, 'func_del_autoInsertStudent(' + returnNum + ')')
def testHourCoursePlan60_002(self): returnNum = myDB.connect_function(myDB, 'func_autoInsertStudent(1006)') studentName = '自动化学员' + returnNum teacherName = '自动化教师' + returnNum driver = self.driver ActionChains(driver).click( driver.find_element_by_xpath( "//a[contains(text(),'前台业务')]")).perform() self.wait # 点击学员管理列表 click = driver.find_element_by_xpath( "//*[@id='CustomerStudentManagement']/li[1]/a") ActionChains(driver).click(click).perform() self.wait driver.find_element_by_xpath("//*[@id='noMar']").send_keys(studentName) self.wait driver.find_element_by_xpath("//*[@id='keydown-query']").click() self.wait # 点击学员列表操作 driver.find_element_by_xpath("//*[@id='nw+0']/span").click() self.wait # 点击排课操作 driver.find_element_by_xpath( "//*[@id='body']/popup/div/div/div/ul/li[6]/a").click() # driver.find_element_by_xpath("//a[contains(text(),'排课')]").click() self.wait #调用公共一对一排课界面 valitext = self.hourCours02(teacherName) context_expxcted = "排课成功!共排课1次(1小时)" self.assertEqual(context_expxcted, valitext) #删除测试数据 myDB.connect_function(myDB, 'func_del_autoInsertStudent(' + returnNum + ')')
def testPresentOrder(self):#返课 returnNum = myDB.connect_function(myDB, 'func_autoInsertStudent(1)') studentName = '自动化学员' + returnNum self.Present(studentName) self.wait5 self.PresentVerify(studentName) myDB.connect_function(myDB, 'func_del_autoInsertStudent(' + returnNum + ')')
def testChangePlatform(self):#添加转平台 returnNum = myDB.connect_function(myDB, 'func_autoInsertStudent(1)') studentChangeName = '自动化学员' + returnNum self.ChangePlatform(studentChangeName) self.ChangePlatformVerify(studentChangeName) myDB.connect_function(myDB, 'func_del_autoInsertStudent(' + returnNum + ')') '''self.driver.refresh()
def testActivityCharge(self):#添加活动消课 returnNum = myDB.connect_function(myDB, 'func_autoInsertStudent(1)') studentChargeName = '自动化学员' + returnNum self.ActivityCharge(studentChargeName) self.ActivityChargeVerify(studentChargeName) self.ActivitySumCharge(studentChargeName) self.ActivityChargeReverse(studentChargeName) myDB.connect_function(myDB, 'func_del_autoInsertStudent(' + returnNum + ')')
def testEditCoursePlan60_001(self): logging.info("-------通过对一排课管理入口进入排课编辑------") #数据初始化,新增学员教师 returnNum = myDB.connect_function(myDB, 'func_autoInsertCoursePlan(1006)') studentName = '自动化学员' + returnNum teacherName = '自动化教师' + returnNum driver = self.driver ActionChains(driver).click( driver.find_element_by_xpath( "//a[contains(text(),'前台业务')]")).perform() #一对一管理列表 self.wait1 studentList_loc = (By.XPATH, "//*[@id='CoursePlanManagement']/li[1]/a") click = self.findElement(*studentList_loc) ActionChains(driver).click(click).perform() #学生姓名查询 self.wait1 studenNameSe_loc = (By.XPATH, "//input[@ng-model='mtSeach.student_name']") try: WebDriverWait(driver, 10, 0.2).until( EC.presence_of_element_located(studenNameSe_loc)) except Exception as e: driver.get_screenshot_as_file( '../Report/image/testEditCoursePlan60_001.png') logging.error("找不到【学员姓名】元素") self.findElement(*studenNameSe_loc).send_keys(studentName) ##查询按钮 self.wait1 startValue = '2017-03-01' endValue = '2017-03-01' startTime = "$(\"input[ng-model='mtSeach.start_time']\").removeAttr('readonly');$(\"input[ng-model='mtSeach.start_time']\").attr('value', \"" + startValue + "\" ).trigger('change')" endTime = "$(\"input[ng-model='mtSeach.end_time']\").removeAttr('readonly');$(\"input[ng-model='mtSeach.end_time']\").attr('value', \"" + startValue + "\" ).trigger('change')" self.driver.execute_script(startTime) self.driver.execute_script(endTime) self.wait1 ##查询 driver.find_element_by_xpath("//a[@id='keydown-query']").click() self.wait ##操作 driver.find_element_by_xpath("//*[@id='nw+0']/span").click() self.wait driver.find_element_by_xpath("//a[contains(text(),'编辑')]").click() self.wait self.EditPlan01() #删除测试数据 myDB.connect_function(myDB, 'func_del_autoInsertStudent(' + returnNum + ')')
def testRefundVerify(self):#订单退费 returnNum = myDB.connect_function(myDB, 'func_autoInsertStudent(1)') studentName = '自动化学员' + returnNum orderNo = 'pay' + returnNum driver = self.driver try: click = driver.find_element_by_xpath("//a[contains(text(),'前台业务')]") ActionChains(driver).click(click).perform() self.wait5 except NoSuchElementException as e: print(e) try: driver.find_element_by_link_text("学员管理").click() self.wait5 except NoSuchElementException as e: print(e) driver.find_element_by_xpath("//*[@id='noMar']").send_keys(studentName) self.wait driver.find_element_by_xpath("//a[@ng-click='getStudentBySome()']").click() self.wait5 driver.find_element_by_xpath("//*[@id='nw+0']/span").click() self.wait5 driver.find_element_by_xpath("//a[@ng-click='showReturnView(row)']").click() self.wait5 self.Refund() self.wait5 click = driver.find_element_by_xpath("//a[@data-target='#RefundManagement']") ActionChains(driver).click(click).perform() self.wait1 ActionChains(driver).click(click).perform() self.wait1 ActionChains(driver).click(click).perform() self.wait1 ActionChains(self.driver).key_down(Keys.DOWN).perform() ActionChains(self.driver).key_up(Keys.DOWN).perform() self.wait1 click = driver.find_element_by_xpath("//a[@href='#/sos-admin/refund']") ActionChains(driver).click(click).perform() self.wait1 self.refundOrderVerify(orderNo) myDB.connect_function(myDB, 'func_del_autoInsertStudent(' + returnNum + ')')
def testHourCoursePlan60_001(self): logging.info("-------通过学员管理入口进入排课------") #数据初始化,新增学员教师 returnNum = myDB.connect_function(myDB, 'func_autoInsertStudent(1006)') studentName = '自动化学员' + returnNum teacherName = '自动化教师' + returnNum driver = self.driver ActionChains(driver).click( driver.find_element_by_xpath( "//a[contains(text(),'前台业务')]")).perform() #学员管理列表 self.wait1 studentList_loc = (By.XPATH, "//*[@id='CustomerStudentManagement']/li[1]/a") click = self.findElement(*studentList_loc) ActionChains(driver).click(click).perform() #学生姓名查询 self.wait1 studenNameSe_loc = (By.XPATH, "//*[@id='noMar']") try: WebDriverWait(driver, 10, 0.2).until( EC.presence_of_element_located(studenNameSe_loc)) except Exception as e: driver.get_screenshot_as_file( '../Report/image/testHourCoursePlan60_001_02.png') logging.error("找不到【学员姓名】元素") self.findElement(*studenNameSe_loc).send_keys(studentName) ##查询按钮 self.wait1 buttonSe_Click = driver.find_element_by_xpath( "//*[@id='keydown-query']") ActionChains(driver).click(buttonSe_Click).perform() #学员列表操作 self.wait1 oper_loc = (By.XPATH, "//a[@id='nw+0']/span") self.findElement(*oper_loc).click() #点击排课操作 self.wait1 coursePlan_loc = (By.XPATH, "//*[@id='body']/popup/div/div/div/ul/li[6]/a") self.findElement(*coursePlan_loc).click() #调用公共一对一排课界面 valitext = self.hourCours01(teacherName) context_expxcted = "排课成功!共排课1次(1小时)" self.assertEqual(context_expxcted, valitext) #删除测试数据 myDB.connect_function(myDB, 'func_del_autoInsertStudent(' + returnNum + ')')
def testTrasferOrder(self): returnNum = myDB.connect_function(myDB, 'func_autoInsertStudent(1)') studentOrderName = '自动化学员' + returnNum self.wait1 returnNum1 = myDB.connect_function(myDB, 'func_autoInsertStudent(1)') transferNewStudent = '自动化学员' + returnNum1 self.Transfer(studentOrderName,transferNewStudent) self.wait5 self.TransferVerify(studentOrderName) self.TransferSum(studentOrderName,transferNewStudent) self.wait5 self.TransferReverse() myDB.connect_function(myDB,'func_del_autoInsertStudent('+ returnNum+ ')') myDB.connect_function(myDB, 'func_del_autoInsertStudent(' + returnNum1 + ')')