def test_reapprove_switch_scene(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_name = driver.find_element_by_xpath(
         "//table[@id='dg']/tbody/tr/td[4]/a").text
     task_scene = driver.find_element_by_xpath(
         "//table[@id='dg']/tbody/tr/td[3]").text
     logger.info([task_id, task_name, task_scene])
     InspectionPage().inspection_check_action(
         driver)  #调用质检结果查看操作函数,点击操作按钮切换当前标签页
     driver.find_element_by_xpath(
         "//button[@onclick='recoverBtn()']").click()  #点击编辑按钮
     driver.find_element_by_xpath(
         "//button[@onclick='showMengban()']").click()  #点击任务质检页-切换场景
     time.sleep(1)
     driver.find_element_by_xpath(
         "//div[@class='change-mengban']/div/div/div[2]/ul/li[1]/button"
     ).click()  #点击场景
     scene_goal = driver.find_element_by_xpath(
         "//div[@class='change-mengban']/div/div/div[2]/ul/li[1]/button"
     ).text  #获取准备切换的场景
     driver.find_element_by_xpath(
         "//button[@class='am-btn am-btn-success change-btn-cancel']"
     ).click()  #点击确认切换
     time.sleep(1)
     after_change_scene = driver.find_element_by_css_selector(
         "#collectMsg > td:nth-child(3)").text  #获取切换后的场景
     self.assertEqual(after_change_scene,
                      scene_goal)  #比对准备切换的场景和切换后的场景,一样则判断用例执行正确
     logger.info([task_id, task_name, after_change_scene])
Esempio n. 2
0
 def test_task_username_search(self):  #质检-模糊匹配-按采集员-搜索
     driver = self.driver
     testcase_title = '-*-*-*-*-*执行质检-按采集员-搜索用例*-*-*-*-*-'
     logger.info(testcase_title)
     InspectionPage().quality_inspection_menu(driver)
     driver.find_element_by_xpath(
         "(//button[@type='button'])[12]").click()  #点击选择搜索类型
     time.sleep(1)
     driver.find_element_by_xpath(
         "//div[@class='admin-content-body']/div[7]/div[5]/div/div/ul/li[4]/span"
     ).click()  #选择搜索类型为采集员
     logger.info('选择搜索条件:' + driver.find_element_by_xpath(
         "//div[@class='admin-content-body']/div[7]/div[5]/div/div/ul/li[4]/span"
     ).text)
     InspectionPage().search_enter(driver, '李')
     logger.info('输入内容:李')
     driver.find_element_by_id("search_button").click()
     time.sleep(1)
     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
     user_name = driver.find_element_by_xpath(
         "//table[@id='dg']/tbody/tr/td[8]/a[1]").text
     self.assertIn(u"李", user_name)
     logger.info([task_id, task_name, task_status, user_name])
Esempio n. 3
0
 def test_task_username_accurate_search(self):  #质检-精确匹配-按采集员-搜索
     driver = self.driver
     testcase_title = '-*-*-*-*-*执行质检-精确匹配-按采集员-搜索用例*-*-*-*-*-'
     logger.info(testcase_title)
     InspectionPage().quality_inspection_menu(driver)
     InspectionPage().inspection_page_accurate_search(driver)
     driver.find_element_by_xpath(
         "//div[@class='admin-content-body']/div[7]/div[5]/div/div/ul/li[4]/span"
     ).click()  #选择搜索类型为采集员
     logger.info('选择匹配方式:精确匹配,选择搜索条件:' + driver.find_element_by_xpath(
         "//div[@class='admin-content-body']/div[7]/div[5]/div/div/ul/li[4]/span"
     ).text)
     InspectionPage().search_enter(driver, '马良')
     logger.info('输入内容:马良')
     driver.find_element_by_id("search_button").click()
     time.sleep(1)
     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  #获取当前页面第一个任务名
     user_name = driver.find_element_by_xpath(
         "//table[@id='dg']/tbody/tr/td[8]/a[1]").text
     self.assertEqual(u"马良", user_name)
     logger.info([task_id, task_status, task_name, user_name])
 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
     ])
Esempio n. 5
0
 def test_operational_delete_submit(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
     driver.find_element_by_xpath(
         "//table[@id='dg']/tbody/tr/td[14]/div/button").click()  #点击操作按钮
     time.sleep(1)
     driver.find_element_by_link_text(u"删除").click()
     logger.info('点击删除按钮')
     InspectionPage().delete_remark(driver, 'Autotest_delete_successful!')
     logger.info('输入内容:Autotest_delete_successful')
     time.sleep(1)
     driver.find_element_by_xpath(
         "//div[@id='delete-confirm']/div/div[3]/span[2]").click()  #点击确定按钮
     logger.info('点击确定按钮')
     time.sleep(1)
     self.assertEqual(u"已完成!", self.close_alert_and_get_its_text())
     driver.find_element_by_link_text(u"采集任务").click()  #点击采集任务链接
     time.sleep(1)
     driver.find_element_by_xpath(
         "//ul[@id='collapse-nav9']/li[3]/a/span[2]").click()  #点击任务管控
     driver.find_element_by_id("getDeleteData").click()  #点击回收站按钮
     driver.find_element_by_xpath(
         "html/body/div[2]/div[2]/div/div[4]/div[1]/div[3]/div/button"
     ).click(
     )  #点击搜索类型  /html/body/div[2]/div[2]/div/div[4]/div[1]/div[3]/div/button
     time.sleep(1)
     driver.find_element_by_xpath(
         "html/body/div[2]/div[2]/div/div[4]/div[1]/div[3]/div/div/ul/li[3]"
     ).click()  #点选id
     logger.info('选择搜索类型:' + driver.find_element_by_xpath(
         "html/body/div[2]/div[2]/div/div[4]/div[1]/div[3]/div/div/ul/li[3]"
     ).text)
     time.sleep(1)
     InspectionPage().search_enter(driver, task_id)
     logger.info('输入内容:' + task_id)
     driver.find_element_by_id("search_button").click()
     time.sleep(1)
     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([
         driver.find_element_by_xpath(
             "//table[@id='dg']/tbody/tr/td[1]").text,
         driver.find_element_by_xpath(
             "//table[@id='dg']/tbody/tr/td[3]").text,
         driver.find_element_by_xpath(
             "//table[@id='dg']/tbody/tr/td[4]/a").text,
         driver.find_element_by_xpath(
             "//table[@id='dg']/tbody/tr/td[7]/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
     ])
Esempio n. 7
0
 def test_quality_inspection_scene_type_search(self):  #质检-按场景类型搜索
     driver = self.driver
     testcase_title = '-*-*-*-*-*执行质检-按场景类型搜索用例*-*-*-*-*-'
     logger.info(testcase_title)
     InspectionPage().quality_inspection_menu(driver)
     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").click()  #点选商场场景
     logger.info('选择搜索条件:' + driver.find_element_by_xpath(
         "//div[@class='am-g']/div[3]/div/div/ul/li").text)
     time.sleep(1)
     self.assertEqual(
         u"商场",
         driver.find_element_by_xpath(
             "//table[@id='dg']/tbody/tr/td[3]").text)
     self.assertEqual(
         u"待质检",
         driver.find_element_by_xpath(
             "//table[@id='dg']/tbody/tr/td[6]/span").text)
     logger.info([
         driver.find_element_by_xpath(
             "//table[@id='dg']/tbody/tr/td[3]").text,
         driver.find_element_by_xpath(
             "//table[@id='dg']/tbody/tr/td[6]/span").text
     ])
Esempio n. 8
0
 def test_check_status_search2(self):  #质检-按检测状态-未检测-搜索
     driver = self.driver
     testcase_title = '-*-*-*-*-*执行质检-按检测状态-未检测-搜索用例*-*-*-*-*-'
     logger.info(testcase_title)
     InspectionPage().quality_inspection_menu(driver)
     driver.find_element_by_xpath(
         "(//button[@type='button'])[7]").click()  #点击检测状态下拉框
     time.sleep(1)
     driver.find_element_by_xpath(
         "//div[@class='am-g am-margin-top-sm']/div[2]/div/div/ul/li[3]/span"
     ).click()  #点击选择未检测
     logger.info('选择搜索条件:' + driver.find_element_by_xpath(
         "//div[@class='am-g am-margin-top-sm']/div[2]/div/div/ul/li[3]/span"
     ).text)
     time.sleep(1)
     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
     point = driver.find_element_by_xpath(
         "//table[@id='dg']/tbody/tr/td[13]/a[1]").text
     photo = driver.find_element_by_xpath(
         "//table[@id='dg']/tbody/tr/td[13]/a[2]").text
     signal = driver.find_element_by_xpath(
         "//table[@id='dg']/tbody/tr/td[13]/a[3]").text
     #check_mark = driver.find_element_by_xpath("//table[@id='dg']/tbody/tr/td[13]/a[4]").text
     list_check_status = [point, photo, signal]
     self.assertNotIn(u"", list_check_status)  #比对结果不存在list里
     logger.info([task_id, task_name, task_status, point, photo, signal])
Esempio n. 9
0
 def test_operational_point_details(self):  #质检-操作-采集点详情
     driver = self.driver
     testcase_title = '-*-*-*-*-*执行质检-操作-采集点详情用例*-*-*-*-*-'
     logger.info(testcase_title)
     InspectionPage().quality_inspection_menu(driver)
     driver.find_element_by_xpath(
         "//table[@id='dg']/tbody/tr/td[14]/div/button").click()  #点击操作按钮
     time.sleep(1)
     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  #获取当前页面第一个任务名
     point_details_num = re.findall(
         r"\d+\.?\d*",
         driver.find_element_by_xpath(
             "//table[@id='dg']/tbody/tr/td[14]/div/ul/li/a/small").text)[
                 0]  #获取采集点详情按钮中的数字
     #获取当前标签句柄
     first_handle = driver.current_window_handle
     driver.find_element_by_xpath(
         "//table[@id='dg']/tbody/tr/td[14]/div/ul/li/a").click()  #点击采集点详情
     all_handles = driver.window_handles  # 获取所有窗口句柄
     for handle in all_handles:  #判断当前窗口句柄,切换窗口
         if handle != first_handle:
             driver.switch_to_window(handle)
     page_sum = re.findall(
         r"\d+\.?\d*",
         driver.find_element_by_xpath(
             "//div[@class='am-u-sm-12']/div/div/div[2]/div").text
     )  #获取采集点详情页点总数
     self.assertIn(point_details_num, page_sum)
     logger.info(
         [task_id, task_status, task_name, point_details_num, page_sum])
Esempio n. 10
0
 def test_quality_inspection_task_source_search2(self):  #质检-按任务来源-官方-搜索
     driver = self.driver
     testcase_title = '-*-*-*-*-*执行质检-按任务来源-官方-搜索用例*-*-*-*-*-'
     logger.info(testcase_title)
     InspectionPage().quality_inspection_menu(driver)
     driver.find_element_by_xpath(
         "(//button[@type='button'])[5]").click()  #点击任务来源选择框
     time.sleep(1)
     driver.find_element_by_xpath(
         "//div[@class='am-g']/div[4]/div/div/ul/li[2]/span").click()  #选择官方
     logger.info('选择搜索条件:' + driver.find_element_by_xpath(
         "//div[@class='am-g']/div[4]/div/div/ul/li[2]/span").text)
     time.sleep(1)
     self.assertEqual(
         u"",
         driver.find_element_by_xpath(
             "//table[@id='dg']/tbody/tr/td[4]/span").text)
     self.assertEqual(
         u"待质检",
         driver.find_element_by_xpath(
             "//table[@id='dg']/tbody/tr/td[6]/span").text)
     logger.info([
         driver.find_element_by_xpath(
             "//table[@id='dg']/tbody/tr/td[4]/span").text,
         driver.find_element_by_xpath(
             "//table[@id='dg']/tbody/tr/td[6]/span").text
     ])
Esempio n. 11
0
 def test_task_status_settle_and_no_pay_search(
         self):  #质检-按任务状态-完成 (无须付款)-搜索
     driver = self.driver
     testcase_title = '-*-*-*-*-*执行质检-按任务状态-完成 (结算付款)-搜索用例*-*-*-*-*-'
     logger.info(testcase_title)
     InspectionPage().quality_inspection_menu(driver)
     driver.find_element_by_xpath(
         "(//button[@type='button'])[6]").click()  #点击任务状态下拉框
     driver.find_element_by_xpath(
         "//div[@class='am-selected am-dropdown  am-active']/div/ul/li[3]/span"
     ).click()  #取消选择'待质检'
     time.sleep(1)
     driver.find_element_by_xpath(
         "//div[@class='am-selected am-dropdown  am-active']/div/ul/li[9]/span"
     ).click()  #点击选择'完成 (无须付款)'
     logger.info('选择搜索条件:' + driver.find_element_by_xpath(
         "//div[@class='am-selected am-dropdown  am-active']/div/ul/li[9]/span"
     ).text)
     time.sleep(3)
     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]
     self.assertEqual(u"完成 (无须付款)", task_status)
     logger.info(task_list)
Esempio n. 12
0
 def test_signal_link(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
     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  #获取当前页面第一个任务名
     string = driver.find_element_by_xpath(
         "//table[@id='dg']/tbody/tr/td[13]/a[3]").text
     signal_num = re.findall(r"\d+\.?\d*", string)[0]  #获取信号数量
     #获取当前标签句柄
     first_handle = driver.current_window_handle
     driver.find_element_by_xpath("//table[@id='dg']/tbody/tr/td[13]/a[3]"
                                  ).click()  #点击 信号连接,进入采集点信号详情页
     all_handles = driver.window_handles  # 获取所有窗口句柄
     for handle in all_handles:  #判断当前窗口句柄,切换窗口
         if handle != first_handle:
             driver.switch_to_window(handle)
     page_signal_sum = re.findall(
         r"\d+\.?\d*",
         driver.find_element_by_xpath(
             "//div[@class='am-u-sm-12']/div/div/div[2]/div").text
     )  #获取采集点信号详情页信号总数
     self.assertIn(signal_num, page_signal_sum)
     logger.info([
         task_id, task_status, task_name, string, signal_num,
         page_signal_sum
     ])
Esempio n. 13
0
 def test_belong_to_team_search(self):  #质检-按所属团队-搜索
     driver = self.driver
     testcase_title = '-*-*-*-*-*执行质检-按所属团队-搜索用例*-*-*-*-*-'
     logger.info(testcase_title)
     InspectionPage().quality_inspection_menu(driver)
     driver.find_element_by_xpath(
         "(//button[@type='button'])[8]").click()  #点击所属团队下拉框
     time.sleep(1)
     driver.find_element_by_xpath(
         "//div[@class='am-g am-margin-top-sm']/div[3]/div/div/ul/li[97]/span"
     ).click()  #点击选择奋斗
     logger.info('选择搜索条件:' + driver.find_element_by_xpath(
         "//div[@class='am-g am-margin-top-sm']/div[3]/div/div/ul/li[97]/span"
     ).text)
     time.sleep(1)
     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_team = driver.find_element_by_xpath(
         "//table[@id='dg']/tbody/tr/td[7]").text
     self.assertEqual(u"奋斗", task_team)
     logger.info([task_id, task_name, task_status, task_team])
Esempio n. 14
0
 def test_quality_inspection_area_search(self):  #质检-按区域搜索
     driver = self.driver
     testcase_title = '-*-*-*-*-*执行质检-按区域搜索用例*-*-*-*-*-'
     logger.info(testcase_title)
     InspectionPage().quality_inspection_menu(driver)
     driver.find_element_by_xpath(
         "(//button[@type='button'])[2]").click()  #点击所在城市选择框
     time.sleep(1)
     driver.find_element_by_xpath(
         "//div[@class='am-u-sm-12 am-u-md-3']/div/div/ul/li/span").click(
         )  #点选深圳市
     logger.info('选择搜索条件:' + driver.find_element_by_xpath(
         "//div[@class='am-u-sm-12 am-u-md-3']/div/div/ul/li/span").text)
     driver.find_element_by_xpath(
         "(//button[@type='button'])[3]").click()  #点击所在区域选择框
     time.sleep(1)
     driver.find_element_by_xpath(
         "//div[@class='am-selected am-dropdown  am-active']/div/ul/li[4]/span"
     ).click()  #点选南山区
     logger.info('选择搜索条件:' + driver.find_element_by_xpath(
         "//div[@class='am-selected am-dropdown  am-active']/div/ul/li[4]/span"
     ).text)
     time.sleep(1)
     area_name = driver.find_element_by_xpath(
         "//table[@id='dg']/tbody/tr/td[2]").text
     self.assertIn(u"南山区", area_name)
     self.assertEqual(
         u"待质检",
         driver.find_element_by_xpath(
             "//table[@id='dg']/tbody/tr/td[6]/span").text)
     logger.info([
         area_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
     ])
 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
     ])
Esempio n. 17
0
 def test_task_name_search(self):  #质检-模糊匹配-按任务名-搜索
     driver = self.driver
     testcase_title = '-*-*-*-*-*执行质检-按任务名-搜索用例*-*-*-*-*-'
     logger.info(testcase_title)
     InspectionPage().quality_inspection_menu(driver)
     logger.info('选择搜索条件:' + driver.find_element_by_xpath(
         "//div[@class='admin-content-body']/div[7]/div[5]/div/div/ul/li[2]/span"
     ).text)
     InspectionPage().search_enter(driver, '水')
     time.sleep(1)
     logger.info('输入内容:水')
     driver.find_element_by_id("search_button").click()
     time.sleep(1)
     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
     self.assertIn(u"水", task_name)
     logger.info([task_id, task_name, task_status])
Esempio n. 18
0
 def test_operational_delete_cancel(self):  #质检-操作-删除-取消
     driver = self.driver
     testcase_title = '-*-*-*-*-*执行质检-操作-删除-取消用例*-*-*-*-*-'
     logger.info(testcase_title)
     InspectionPage().quality_inspection_menu(driver)
     driver.find_element_by_xpath(
         "//table[@id='dg']/tbody/tr/td[14]/div/button").click()  #点击操作按钮
     time.sleep(1)
     driver.find_element_by_link_text(u"删除").click()
     logger.info('点击删除按钮')
     InspectionPage().delete_remark(driver, 'Autotest_delete_cancel!')
     logger.info('输入内容:Autotest_delete_cancel')
     time.sleep(1)
     driver.find_element_by_xpath(
         "//div[@id='delete-confirm']/div/div[3]/span[1]").click()  #点击取消按钮
     logger.info('点击取消按钮')
     time.sleep(1)
     self.assertEqual(
         u"待质检",
         driver.find_element_by_xpath(
             "//table[@id='dg']/tbody/tr/td[6]/span").text)
Esempio n. 19
0
 def test_phonenumber_search(self):  #质检-模糊匹配-按手机号-搜索
     driver = self.driver
     testcase_title = '-*-*-*-*-*执行质检-按手机号-搜索用例*-*-*-*-*-'
     logger.info(testcase_title)
     InspectionPage().quality_inspection_menu(driver)
     driver.find_element_by_xpath(
         "(//button[@type='button'])[12]").click()  #点击选择搜索类型
     time.sleep(1)
     driver.find_element_by_xpath(
         "//div[@class='admin-content-body']/div[7]/div[5]/div/div/ul/li/span"
     ).click()  #选择搜索类型为任务名
     logger.info('选择搜索条件:' + driver.find_element_by_xpath(
         "//div[@class='admin-content-body']/div[7]/div[5]/div/div/ul/li/span"
     ).text)
     InspectionPage().search_enter(driver, '134')
     time.sleep(1)
     logger.info('输入内容:134')
     driver.find_element_by_id("search_button").click()
     time.sleep(1)
     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
     time.sleep(1)
     #获取当前标签句柄
     first_handle = driver.current_window_handle
     driver.find_element_by_xpath(
         "//table[@id='dg']/tbody/tr/td[8]/a[1]").click()  #点击采集员姓名链接
     all_handles = driver.window_handles  # 获取所有窗口句柄
     for handle in all_handles:  #判断当前窗口句柄,切换窗口
         if handle != first_handle:
             driver.switch_to_window(handle)
     phonenum = driver.find_element_by_xpath(
         "//div[@class='am-g']/div/form/fieldset/div[3]/div/input"
     ).get_attribute("value")  #获取手机号码
     self.assertIn(u"134", phonenum)
     logger.info([task_id, task_name, task_status, phonenum])
 def test_switch_scene2(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_name = driver.find_element_by_xpath(
         "//table[@id='dg']/tbody/tr/td[4]/a").text
     task_scene = driver.find_element_by_xpath(
         "//table[@id='dg']/tbody/tr/td[3]").text
     logger.info([task_id, task_name, task_scene])
     InspectionPage().inspection_action(driver)  #调用质检操作函数,点击操作按钮切换当前标签页
     driver.find_element_by_id("norRetask").click()  #点击无重复任务
     driver.find_element_by_id("confirmNext").click()  #点击确认并下一步,切换至采集点质检页
     time.sleep(1)
     driver.find_element_by_xpath(
         "//button[@onclick='showMengban()']").click()  #点击切换场景
     time.sleep(1)
     driver.find_element_by_xpath(
         "//div[@class='change-mengban']/div/div/div[2]/ul/li[1]/button"
     ).click()  #点击场景
     scene_goal = driver.find_element_by_xpath(
         "//div[@class='change-mengban']/div/div/div[2]/ul/li[1]/button"
     ).text  #获取准备切换的场景
     driver.find_element_by_xpath(
         "//button[@class='am-btn am-btn-success change-btn-cancel']"
     ).click()  #点击确认切换
     time.sleep(1)
     self.assertEqual(
         u"不可用",
         driver.find_element_by_xpath("//div[@class='placeMsg']/a[1]").text)
     driver.find_element_by_id("taskCheck").click()  #点击返回任务质检页
     time.sleep(1)
     after_change_scene = driver.find_element_by_css_selector(
         "#collectMsg > td:nth-child(3)").text  #获取切换后的场景
     self.assertEqual(after_change_scene,
                      scene_goal)  #比对准备切换的场景和切换后的场景,一样则判断用例执行正确
     logger.info([task_id, task_name, after_change_scene])
Esempio n. 21
0
 def test_task_name_link(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
     task_name = driver.find_element_by_xpath(
         "//table[@id='dg']/tbody/tr/td[4]/a").text  #获取子任务名称
     task_city = driver.find_element_by_xpath(
         "//table[@id='dg']/tbody/tr/td[2]").text  #获取子任务城市区域
     task_scene = driver.find_element_by_xpath(
         "//table[@id='dg']/tbody/tr/td[3]").text  #获取任务场景
     task_street = driver.find_element_by_xpath(
         "//table[@id='dg']/tbody/tr/td[5]").text  #获取任务街道
     task_team = driver.find_element_by_xpath(
         "//table[@id='dg']/tbody/tr/td[7]").text  #获取采集员团队
     task_user = driver.find_element_by_xpath(
         "//table[@id='dg']/tbody/tr/td[8]/a[1]").text  #获取采集员手机号
     time.sleep(1)
     #获取当前标签句柄
     first_handle = driver.current_window_handle
     driver.find_element_by_xpath(
         "//table[@id='dg']/tbody/tr/td[4]/a").click()  #点击任务名称
     all_handles = driver.window_handles  # 获取所有窗口句柄
     for handle in all_handles:  #判断当前窗口句柄,切换窗口
         if handle != first_handle:
             driver.switch_to_window(handle)
     self.assertEqual(
         task_name,
         driver.find_element_by_xpath(
             "//form[@class='am-form am-form-horizontal']/fieldset/div/div/div/input"
         ).get_attribute("value"))
     self.assertEqual(
         task_scene,
         driver.find_element_by_xpath(
             "//form[@class='am-form am-form-horizontal']/fieldset[2]/div/div/div/input"
         ).get_attribute("value"))
     self.assertEqual(
         task_street,
         driver.find_element_by_xpath(
             "//form[@class='am-form am-form-horizontal']/fieldset[2]/div[2]/div/input"
         ).get_attribute("value"))
     self.assertEqual(
         task_user,
         driver.find_element_by_xpath(
             "//form[@class='am-form am-form-horizontal']/fieldset[2]/div[7]/div/input"
         ).get_attribute("value"))
     self.assertEqual(
         task_team,
         driver.find_element_by_xpath(
             "//form[@class='am-form am-form-horizontal']/fieldset[2]/div[7]/div[2]/input"
         ).get_attribute("value"))
     self.assertIn(
         driver.find_element_by_xpath(
             "//form[@class='am-form am-form-horizontal']/fieldset[2]/div/div/div[2]/div/input"
         ).get_attribute("value"), task_city)
     self.assertIn(
         driver.find_element_by_xpath(
             "//form[@class='am-form am-form-horizontal']/fieldset[2]/div/div/div[3]/div/input"
         ).get_attribute("value"), task_city)
     logger.info([
         '任务id:' + task_id, '任务名称:' + driver.find_element_by_xpath(
             "//form[@class='am-form am-form-horizontal']/fieldset/div/div/div/input"
         ).get_attribute("value"), '场景:' + driver.find_element_by_xpath(
             "//form[@class='am-form am-form-horizontal']/fieldset[2]/div/div/div/input"
         ).get_attribute("value"), '街道:' + driver.find_element_by_xpath(
             "//form[@class='am-form am-form-horizontal']/fieldset[2]/div[2]/div/input"
         ).get_attribute("value"), '采集员:' + driver.find_element_by_xpath(
             "//form[@class='am-form am-form-horizontal']/fieldset[2]/div[7]/div/input"
         ).get_attribute("value"), '所属团队:' + driver.find_element_by_xpath(
             "//form[@class='am-form am-form-horizontal']/fieldset[2]/div[7]/div[2]/input"
         ).get_attribute("value"), '城市:' + driver.find_element_by_xpath(
             "//form[@class='am-form am-form-horizontal']/fieldset[2]/div/div/div[2]/div/input"
         ).get_attribute("value"), '区域:' + driver.find_element_by_xpath(
             "//form[@class='am-form am-form-horizontal']/fieldset[2]/div/div/div[3]/div/input"
         ).get_attribute("value")
     ])
Esempio n. 22
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
     ])