def test_settle_and_no_pay(self):  #批量结算不付款
     driver = self.driver
     testcase_title = '-*-*-*-*-*执行批量结算不付款用例*-*-*-*-*-'
     logger.info(testcase_title)
     InspectionPage().quality_inspection_menu(driver)
     InspectionPage().switch_status_to_wait_to_settlement(driver)
     task_id = driver.find_element_by_xpath(
         "//table[@id='dg']/tbody/tr/td[1]").text  #获取要操作的子任务id
     task_status = driver.find_element_by_xpath(
         "//table[@id='dg']/tbody/tr/td[6]/span").text
     task_name = driver.find_element_by_xpath(
         "//table[@id='dg']/tbody/tr/td[4]/a").text
     task_list = [task_id, task_name, task_status]
     logger.info(task_list)
     driver.find_element_by_xpath(
         "//table[@id='dg']/tbody/tr[1]/td[15]/input").click()  #选择勾选框
     driver.find_element_by_link_text(u"批量结算(不付款)").click()  #点击批量结算不付款
     time.sleep(1)
     self.assertEqual(u"完成结算质检!", self.close_alert_and_get_its_text())
     BusinessExecutionPage().business_execution_menu(driver)
     BusinessExecutionPage().business_execution_search_enter(
         driver, task_id)  # 调用业务执行-搜索输入框函数输入id
     driver.find_element_by_id("search_button").click()  #点击搜索
     time.sleep(1)
     self.assertEqual(u"完成 (无须付款)",
                      driver.find_element_by_xpath(
                          "//table[@id='dg']/tbody/tr/td[6]/span").text
                      )  #比对任务状态是否为完成 (无须付款),以判断是否结算成功
     logger.info([
         task_id, task_name,
         driver.find_element_by_xpath(
             "//table[@id='dg']/tbody/tr/td[6]/span").text
     ])
示例#2
0
 def test_allocate_task(self):  #任务分配
     driver = self.driver
     testcase_title = '-*-*-*-*-*执行任务分配用例*-*-*-*-*-'
     logger.info(testcase_title)
     driver.find_element_by_xpath(
         "//ul[@id='collapse-nav9']/li[3]/a/span[2]").click()  #点击任务管控链接
     driver.find_element_by_xpath(
         "(//button[@type='button'])[4]").click()  #点击任务状态选择框
     time.sleep(1)
     driver.find_element_by_xpath(
         "//div[@class='am-g']/div[3]/div/div/ul/li[1]/span").click(
         )  #选择未领取状态
     time.sleep(2)
     task_id = driver.find_element_by_xpath(
         "//table[@id='dg']/tbody/tr/td[1]").text
     task_status = driver.find_element_by_xpath(
         "//table[@id='dg']/tbody/tr/td[6]/span").text
     task_name = driver.find_element_by_xpath(
         "//table[@id='dg']/tbody/tr/td[4]/a").text
     task_list = [task_id, task_name, task_status]
     logger.info(task_list)
     time.sleep(1)
     driver.find_element_by_xpath(
         "//table[@id='dg']/tbody/tr/td[8]/div/button").click()  #点击操作按钮
     time.sleep(1)
     driver.find_element_by_link_text(u"分配").click()  #点击分配按钮
     driver.find_element_by_id("search-text").click()
     driver.find_element_by_id("search-text").clear()
     driver.find_element_by_id("search-text").send_keys("马良")  #输入搜索条件
     driver.find_element_by_id("search-text").send_keys(Keys.ENTER)
     logger.info('输入内容:马良')
     driver.find_element_by_link_text(u"分配到用户").click()  #点击分配到用户按钮
     driver.find_element_by_xpath(
         "//div[@id='my-confirm']/div/div[3]/span[2]").click()  #点击确定按钮
     time.sleep(2)
     self.assertEqual(u"任务分配成功", self.close_alert_and_get_its_text())
     BusinessExecutionPage().business_execution_menu(driver)
     BusinessExecutionPage().business_execution_search_enter(
         driver, task_id)  #调用业务执行-搜索输入框函数输入id
     driver.find_element_by_id("search_button").click()  #点击搜索
     time.sleep(1)
     self.assertEqual(
         u"马良",
         driver.find_element_by_xpath(
             "//table[@id='dg']/tbody/tr/td[8]/a").text)
     self.assertEqual(
         u"待提交",
         driver.find_element_by_xpath(
             "//table[@id='dg']/tbody/tr/td[6]/span").text)
     logger.info([
         task_id, task_name,
         driver.find_element_by_xpath(
             "//table[@id='dg']/tbody/tr/td[8]/a").text,
         driver.find_element_by_xpath(
             "//table[@id='dg']/tbody/tr/td[6]/span").text
     ])
 def test_quality_inspection_not_pass(self):  #质检-任务质检页-质检不通过
     driver = self.driver
     testcase_title = '-*-*-*-*-*执行质检-任务质检页-质检不通过用例*-*-*-*-*-'
     logger.info(testcase_title)
     InspectionPage().quality_inspection_menu(driver)
     task_id = driver.find_element_by_xpath(
         "//table[@id='dg']/tbody/tr/td[1]").text  #获取要操作的子任务id
     task_status = driver.find_element_by_xpath(
         "//table[@id='dg']/tbody/tr/td[6]/span").text
     task_name = driver.find_element_by_xpath(
         "//table[@id='dg']/tbody/tr/td[4]/a").text
     task_list = [task_id, task_name, task_status]
     logger.info(task_list)
     #获取当前标签句柄
     first_handle = driver.current_window_handle
     driver.find_element_by_xpath(
         "//table[@id='dg']/tbody/tr/td[14]/a/small").click()  #点击操作-质检
     all_handles = driver.window_handles  # 获取所有窗口句柄
     for handle in all_handles:  #判断当前窗口句柄,切换窗口
         if handle != first_handle:
             driver.switch_to_window(handle)
     #切换窗口,进行质检操作
     driver.find_element_by_id("checkNoPass").click()  #点击质检不通过按钮
     InspectionPage().inspection_not_pass_remark(
         driver,
         'Autotest_quality_inspection_not_pass!')  #调用质检不通过备注框输入函数输入内容
     driver.find_element_by_css_selector("label.am-checkbox").click()
     driver.find_element_by_xpath(
         "//div[@id='task-online-check']/div/div[4]/span[2]").click(
         )  #点击备注框确定按钮
     time.sleep(2)
     self.assertEqual(u"操作成功", self.close_alert_and_get_its_text())
     time.sleep(1)
     driver.switch_to_window(first_handle)
     time.sleep(1)
     BusinessExecutionPage().business_execution_menu(driver)
     BusinessExecutionPage().business_execution_search_enter(
         driver, task_id)  #调用业务执行-搜索输入框函数输入id
     driver.find_element_by_id("search_button").click()  #点击搜索
     time.sleep(1)
     self.assertEqual(u"质检不通过",
                      driver.find_element_by_xpath(
                          "//table[@id='dg']/tbody/tr/td[6]/span").text
                      )  #比对任务状态是否为质检不通过,以判断是否质检不通过成功
     logger.info([
         task_id, task_name,
         driver.find_element_by_xpath(
             "//table[@id='dg']/tbody/tr/td[6]/span").text
     ])
 def test_examine_and_approve_successful(self):  # 审批通过
     driver = self.driver
     testcase_title = '-*-*-*-*-*执行审批通过用例*-*-*-*-*-'
     logger.info(testcase_title)
     InspectionPage().quality_inspection_menu(driver)
     InspectionPage().switch_status_to_wait_to_approve(driver)
     task_id = driver.find_element_by_xpath(
         "//table[@id='dg']/tbody/tr/td[1]").text  # 获取要操作的子任务id
     task_status = driver.find_element_by_xpath(
         "//table[@id='dg']/tbody/tr/td[6]/span").text
     task_name = driver.find_element_by_xpath(
         "//table[@id='dg']/tbody/tr/td[4]/a").text
     task_list = [task_id, task_name, task_status]
     logger.info(task_list)
     driver.find_element_by_xpath(
         "//table[@class='am-table am-table-bordered am-table-compact table-ms-size dataTable no-footer']/tbody/tr[1]/td[14]/div/button"
     ).click()  # 点击操作按钮
     time.sleep(1)
     driver.find_element_by_xpath(
         "//table[@class='am-table am-table-bordered am-table-compact table-ms-size dataTable no-footer']/tbody/tr[1]/td[14]/div/ul/li[5]/a/small"
     ).click()  # 点击审批按钮
     driver.find_element_by_xpath(
         "//div[@id='task-test-check-status-radios']/label[1]").click(
         )  # 点击审批通过
     InspectionPage().approve_remark(driver,
                                     'Autotest_successful!')  # 备注框输入内容
     driver.find_element_by_xpath(
         "//div[@id='task-test-check']/div/div[3]/span[2]").click()  # 点击确定
     time.sleep(1)
     self.assertEqual(u"完成质检审批!", self.close_alert_and_get_its_text())
     BusinessExecutionPage().business_execution_menu(driver)
     BusinessExecutionPage().business_execution_search_enter(
         driver, task_id)  # 调用业务执行-搜索输入框函数输入id
     driver.find_element_by_id("search_button").click()  # 点击搜索
     time.sleep(1)
     self.assertEqual(u"待结算",
                      driver.find_element_by_xpath(
                          "//table[@id='dg']/tbody/tr/td[6]/span").text
                      )  # 比对任务状态是否为待结算,以判断是否审批通过成功
     logger.info([
         task_id, task_name,
         driver.find_element_by_xpath(
             "//table[@id='dg']/tbody/tr/td[6]/span").text
     ])
 def test_reapprove_unsuccessful(self):  #审批不通过-不予通过
     driver = self.driver
     testcase_title = '-*-*-*-*-*执行审批不通过-不予通过用例*-*-*-*-*-'
     logger.info(testcase_title)
     InspectionPage().quality_inspection_menu(driver)
     InspectionPage().switch_status_to_approve_not_pass(driver)
     task_id = driver.find_element_by_xpath(
         "//table[@id='dg']/tbody/tr/td[1]").text  #获取要操作的子任务id
     task_status = driver.find_element_by_xpath(
         "//table[@id='dg']/tbody/tr/td[6]/span").text
     task_name = driver.find_element_by_xpath(
         "//table[@id='dg']/tbody/tr/td[4]/a").text
     task_list = [task_id, task_name, task_status]
     logger.info(task_list)
     driver.find_element_by_xpath(
         "//table[@id='dg']/tbody/tr/td[14]/div/button").click()  #点击操作按钮
     time.sleep(1)
     driver.find_element_by_xpath(
         "//table[@id='dg']/tbody/tr/td[14]/div/ul/li[5]/a/small").click(
         )  #点击复审(审批不通过)
     driver.find_element_by_xpath(
         "//div[@id='task-test-check-nopass-review-status-radios']/label[2]"
     ).click()  #点击不予通过,回到任务池
     InspectionPage().reapprove_remark(driver,
                                       'Autotest reapprove unsuccessful')
     driver.find_element_by_xpath(
         "//div[@id='task-test-check-nopass-review']/div/div[3]/span[2]"
     ).click()  #点击确定按钮
     time.sleep(6)
     self.assertEqual(u"完成审批不通过复审!", self.close_alert_and_get_its_text())
     BusinessExecutionPage().business_execution_menu(driver)
     BusinessExecutionPage().business_execution_search_enter(
         driver, task_id)  # 调用业务执行-搜索输入框函数输入id
     driver.find_element_by_id("search_button").click()  #点击搜索
     time.sleep(1)
     self.assertEqual(u"待领取",
                      driver.find_element_by_xpath(
                          "//table[@id='dg']/tbody/tr/td[6]/span").text
                      )  #比对任务状态是否为待领取,以判断是否复审不通过返回任务池成功
     logger.info([
         task_id, task_name,
         driver.find_element_by_xpath(
             "//table[@id='dg']/tbody/tr/td[6]/span").text
     ])
示例#6
0
 def test_task_delete(self):  #任务删除
     driver = self.driver
     testcase_title = '-*-*-*-*-*执行任务删除用例*-*-*-*-*-'
     logger.info(testcase_title)
     driver.find_element_by_xpath(
         "//ul[@id='collapse-nav9']/li[3]/a/span[2]").click()  #点击任务管控链接
     time.sleep(1)
     driver.find_element_by_xpath(
         "(//button[@type='button'])[4]").click()  #点击任务状态选择框
     time.sleep(1)
     driver.find_element_by_xpath(
         "//div[@class='am-g']/div[3]/div/div/ul/li[1]/span").click(
         )  #选择未领取状态
     time.sleep(2)
     task_id = driver.find_element_by_xpath(
         "//table[@id='dg']/tbody/tr/td[1]").text
     task_status = driver.find_element_by_xpath(
         "//table[@id='dg']/tbody/tr/td[6]/span").text
     task_name = driver.find_element_by_xpath(
         "//table[@id='dg']/tbody/tr/td[4]/a").text
     task_list = [task_id, task_name, task_status]
     logger.info(task_list)
     driver.find_element_by_xpath(
         "//table[@id='dg']/tbody/tr/td[8]/div/button").click()  #点击操作按钮
     time.sleep(1)
     driver.find_element_by_link_text(u"删除").click()  #点击删除按钮
     InspectionPage().delete_remark(driver,
                                    "Autotest_task_delete_successful!")
     logger.info('输入内容:Autotest_task_delete_successful!')
     time.sleep(1)
     driver.find_element_by_xpath(
         "//div[@id='delete-confirm']/div/div[3]/span[2]").click()  #点击确定按钮
     time.sleep(2)
     self.assertEqual(u"已完成!", self.close_alert_and_get_its_text())
     time.sleep(2)
     driver.find_element_by_id("getDeleteData").click()  # 点击回收站
     time.sleep(1)
     driver.find_element_by_xpath(
         "//div[@class='am-u-sm-12 am-u-md-2']/div/button").click(
         )  #点击选择搜索类型
     time.sleep(1)
     driver.find_element_by_xpath(
         "//div[@class='am-u-sm-12 am-u-md-2']/div/div/ul/li[3]/span"
     ).click()  #选择搜索类型为id
     time.sleep(1)
     BusinessExecutionPage().search_enter(driver, task_id)
     driver.find_element_by_id("search_button").click()  #点击搜索
     time.sleep(2)
     self.assertEqual(
         task_id,
         driver.find_element_by_xpath(
             "//table[@id='dg']/tbody/tr/td[1]").text)
     self.assertEqual(
         u"已删除",
         driver.find_element_by_xpath(
             "//table[@id='dg']/tbody/tr/td[7]/span").text)
     logger.info([
         task_id, task_name,
         driver.find_element_by_xpath(
             "//table[@id='dg']/tbody/tr/td[7]/span").text
     ])