def test_task_10(self): '''撤销及恢复任务''' driver = self.driver driver.get(self.base_url) user.login(self) sleep(1) pub.module_icon(self) driver.find_element_by_class_name("j_ico_task").click() sleep(1) pub.switchtoframe(self) page_task.newTask(self) sleep(1) driver.find_element_by_xpath('//*[@id="taskList"]').click() sleep(1) driver.find_element_by_css_selector('td.ellipsis.ch').click() sleep(1) #撤销任务 driver.find_element_by_xpath('//*[@id="taskRevokeBtn"]').click() sleep(2) driver.find_element_by_xpath('//*[@id="submitBtn"]').click() sleep(1) popInfo = driver.find_element_by_xpath('//*[@id="notificationstop-center"]').text print u'提示信息:%s'%popInfo #恢复任务 driver.find_element_by_xpath('//*[@id="taskRecoverBtn"]').click() sleep(1) driver.find_element_by_xpath('//*[@id="okBtn"]').click() sleep(1) popInfo_1 = driver.find_element_by_xpath('//*[@id="notificationstop-center"]').text print u'提示信息:%s'%popInfo_1 # self.assertEqual(popInfo_1,u'操作成功','Test failed!!!') if popInfo == u'操作成功': print 'Test passed!' else: print 'Test failed!'
def test_task_01(self): '''新建任务''' driver = self.driver driver.get(self.base_url) user.login(self) sleep(1) pub.module_icon(self) driver.find_element_by_class_name("j_ico_task").click() sleep(1) pub.switchtoframe(self) sleep(1) page_task.newTask(self) popInfo = driver.find_element_by_xpath('//*[@id="notificationstop-center"]').text sleep(1) print u'提示信息:%s'%popInfo # self.assertEqual(popInfo,u'创建成功','Test failed!!!') if popInfo == u'创建成功': print 'Test passed!' else: print 'Test failed!'
def test_task_14(self): '''回收站_恢复任务''' driver = self.driver driver.get(self.base_url) user.login(self) sleep(1) pub.module_icon(self) driver.find_element_by_class_name("j_ico_task").click() sleep(1) pub.switchtoframe(self) page_task.newTask(self) sleep(1) driver.find_element_by_xpath('//*[@id="taskList"]').click() sleep(1) driver.find_element_by_css_selector('td.ellipsis.ch').click() sleep(1) #撤销任务 driver.find_element_by_xpath('//*[@id="taskRevokeBtn"]').click() sleep(1) driver.find_element_by_xpath('//*[@id="submitBtn"]').click() sleep(1) #从回收站恢复任务 driver.find_element_by_xpath("//a[@id='suspendListBtn']/span").click() sleep(1) undoTaskTitle_1 = driver.find_element_by_css_selector('div.ellipsis').text # /html/body/div/div/div[2]/div[3]/div/table/tbody/tr/td[1]/div driver.find_element_by_xpath('//table[@id="taskListTable"]/tbody/tr[1]/td[4]/a[2]').click() sleep(1) driver.find_element_by_xpath('//*[@id="okBtn"]').click() sleep(1) #恢复任务后,此时回收站中第一条任务应该与之前的任务标题不同;若相同,则恢复不成功。 try: undoTaskTitle_2 = driver.find_element_by_css_selector('td.ellipsis.ch').text print u'恢复操作的任务标题:%s'%undoTaskTitle_1 if undoTaskTitle_1 == undoTaskTitle_2: print 'Test failed!' else: print 'Test passed!' except: print u'回收站无数据!'