def setup_face_alert_deployment_task_name_with_mul_portrait_and_delete_task( sb): """ 生成人脸通行任务名称并清理该任务 """ request = {'name': generate_uuid(), 'name2': generate_uuid()} MenuBar.click_menu_item_by_text(sb, '配置', '地图管理') MapPage.add_floor_by_root_floor_name(sb, request['name']) MenuBar.click_menu_item_by_text(sb, '配置', '设备管理') DevicePage.add_group_by_root_group_name(sb, request['name']) rtsp_device = RTSP(request['name'], request['name'], request['name'], request['name'], 'rtsp://confidence.119:6554/SchoolAnniversary.264') DevicePage.add_device_by_type(sb, rtsp_device, '网络摄像机') MenuBar.click_menu_item_by_text(sb, '配置', '人像库管理') PortraitPage.add_portrait_database_by_name(sb, request['name']) PortraitPage.add_portrait_database_by_name(sb, request['name2']) MenuBar.click_menu_item_by_text(sb, '配置', '任务管理') yield request sb.save_teardown_screenshot() MenuBar.click_menu_item_by_text(sb, '配置', '任务管理') TaskPage.click_task_tab_by_type(sb, type='人脸-布控任务') TaskPage.delete_task_by_name(sb, request['name']) MenuBar.click_menu_item_by_text(sb, '配置', '人像库管理') PortraitPage.delete_portrait_database_by_name(sb, request['name']) PortraitPage.delete_portrait_database_by_name(sb, request['name2']) MenuBar.click_menu_item_by_text(sb, '配置', '设备管理') DevicePage.delete_group_by_name(sb, request['name']) MenuBar.click_menu_item_by_text(sb, '配置', '地图管理') MapPage.delete_floor_by_name(sb, request['name'])
def setup_face_access_control_task_name_with_mul_portrait_and_delete_task(sb): """ 生成人脸通行任务名称并清理该任务 """ request = {'name': generate_uuid(), 'name2': generate_uuid()} MenuBar.click_menu_item_by_text(sb, '配置', '地图管理') MapPage.add_floor_by_root_floor_name(sb, request['name']) MenuBar.click_menu_item_by_text(sb, '配置', '设备管理') DevicePage.add_group_by_root_group_name(sb, request['name']) frontend_device = Frontend(request['name'], request['name'], request['name'], request['name'], 'SensePass') DevicePage.add_device_by_type(sb, frontend_device, '人脸识别机(前)') MenuBar.click_menu_item_by_text(sb, '配置', '人像库管理') PortraitPage.add_portrait_database_by_name(sb, request['name']) PortraitPage.add_portrait_database_by_name(sb, request['name2']) MenuBar.click_menu_item_by_text(sb, '配置', '任务管理') yield request sb.save_teardown_screenshot() MenuBar.click_menu_item_by_text(sb, '配置', '任务管理') TaskPage.click_task_tab_by_type(sb, type='人脸-通行任务') TaskPage.delete_task_by_name(sb, request['name']) MenuBar.click_menu_item_by_text(sb, '配置', '人像库管理') PortraitPage.delete_portrait_database_by_name(sb, request['name']) PortraitPage.delete_portrait_database_by_name(sb, request['name2']) MenuBar.click_menu_item_by_text(sb, '配置', '设备管理') DevicePage.delete_group_by_name(sb, request['name']) MenuBar.click_menu_item_by_text(sb, '配置', '地图管理') MapPage.delete_floor_by_name(sb, request['name'])
def test_add_face_alert_deployment_task( sb, login, setup_face_alert_deployment_task_name_and_delete_task): """添加基本的监控任务""" task = FaceAlertDeploymentTask(setup_face_alert_deployment_task_name_and_delete_task['name'], setup_face_alert_deployment_task_name_and_delete_task['name'], portraits=[setup_face_alert_deployment_task_name_and_delete_task['name']]) TaskPage.add_face_alert_deployment_task(sb, task)
def test_add_vehicle_illegally_parking_detection_task( sb, login, setup_vehicle_illegally_parking_detection_task_name_and_delete_task): task = VehicleIllegallyParkingDetectionTask( setup_vehicle_illegally_parking_detection_task_name_and_delete_task[ 'name'], setup_vehicle_illegally_parking_detection_task_name_and_delete_task[ 'name']) TaskPage.add_vehicle_illegally_parking_detection_task(sb, task)
def test_add_pedestrian_area_entry_detection_task( sb, login, setup_pedestrian_area_entry_detection_task_name_and_delete_task): task = PedestrianAreaEntryDetectionTask( setup_pedestrian_area_entry_detection_task_name_and_delete_task[ 'name'], setup_pedestrian_area_entry_detection_task_name_and_delete_task['name'] ) TaskPage.add_pedestrian_area_entry_detection_task(sb, task)
def test_add_face_alert_deployment_task_then_disable(sb, login, setup_face_alert_deployment_task_name_and_delete_task): """添加监控任务后禁用""" task = FaceAccessControlTask(setup_face_alert_deployment_task_name_and_delete_task['name'], setup_face_alert_deployment_task_name_and_delete_task['name'], portraits=[ setup_face_alert_deployment_task_name_and_delete_task['name'] ]) TaskPage.add_face_alert_deployment_task(sb, task) TaskPage.switch_task_status_by_name(sb, task.task_name)
def test_add_pedestrian_crossing_boundary_detection_task( sb, login, setup_pedestrian_crossing_boundary_detection_task_name_and_delete_task ): task = PedestrianCrossingBoundaryDetectionTask( setup_pedestrian_crossing_boundary_detection_task_name_and_delete_task[ 'name'], setup_pedestrian_crossing_boundary_detection_task_name_and_delete_task[ 'name']) TaskPage.add_pedestrian_crossing_boundary_detection_task(sb, task)
def test_add_face_alert_deployment_task_multi_portraits( sb, login, setup_face_alert_deployment_task_name_with_mul_portrait_and_delete_task): """添加多个人像库的监控任务""" task = FaceAlertDeploymentTask(setup_face_alert_deployment_task_name_with_mul_portrait_and_delete_task['name'], setup_face_alert_deployment_task_name_with_mul_portrait_and_delete_task['name'], portraits=[ setup_face_alert_deployment_task_name_with_mul_portrait_and_delete_task['name'], setup_face_alert_deployment_task_name_with_mul_portrait_and_delete_task['name2'] ]) TaskPage.add_face_alert_deployment_task(sb, task)
def test_add_face_access_control_task( sb, login, setup_face_access_control_task_name_and_delete_task): """添加基本的前端设备任务""" task = FaceAccessControlTask( setup_face_access_control_task_name_and_delete_task['name'], setup_face_access_control_task_name_and_delete_task['name'], portraits=[ setup_face_access_control_task_name_and_delete_task['name'] ]) TaskPage.add_face_access_control_task(sb, task)
def test_add_face_alert_deployment_task_duplicate_task_name( sb, login, setup_face_alert_deployment_task_name_and_delete_task): """测试任务名重复""" # 先用初始值创建一个任务 task = FaceAccessControlTask(setup_face_alert_deployment_task_name_and_delete_task['name'], setup_face_alert_deployment_task_name_and_delete_task['name'], portraits=[ setup_face_alert_deployment_task_name_and_delete_task['name'] ]) TaskPage.add_face_alert_deployment_task(sb, task) # 再添加一个设备 MenuBar.click_menu_item_by_text(sb, '配置', '设备管理') rtsp_device = RTSP( setup_face_alert_deployment_task_name_and_delete_task['name'] + 'dup', setup_face_alert_deployment_task_name_and_delete_task['name'] + 'dup', setup_face_alert_deployment_task_name_and_delete_task['name'], setup_face_alert_deployment_task_name_and_delete_task['name'], 'rtsp://confidence.119:6554/SchoolAnniversary.264') DevicePage.add_device_by_type( sb, rtsp_device, '网络摄像机') # 用新的设备和原先的任务名称、人像库作为添加规则的准备数据 task2 = FaceAccessControlTask(setup_face_alert_deployment_task_name_and_delete_task['name'], setup_face_alert_deployment_task_name_and_delete_task['name'] + 'dup', portraits=[ setup_face_alert_deployment_task_name_and_delete_task['name'] ]) # 定位到setup中的任务菜单 MenuBar.click_menu_item_by_text(sb, '配置', '任务管理') # 再次添加规则 TaskPage.add_face_alert_deployment_task(sb, task2) # 校验"任务名已存在" TaskPage.assert_alert_message(sb, '任务名已存在') # 关闭新增任务窗口 TaskPage.click_task_cancel_button(sb)
def test_add_face_alert_deployment_task_attributes(sb, login, attribute_input, setup_face_alert_deployment_task_name_and_delete_task): """添加入口|出口|第三方对接|属性的监控任务""" task = FaceAccessControlTask(setup_face_alert_deployment_task_name_and_delete_task['name'], setup_face_alert_deployment_task_name_and_delete_task['name'], portraits=[ setup_face_alert_deployment_task_name_and_delete_task['name'] ], attributes=attribute_input) TaskPage.add_face_alert_deployment_task(sb, task) TaskPage.detail_task_by_name(sb, setup_face_alert_deployment_task_name_and_delete_task['name']) TaskPage.assert_element_text(sb, '//label[text()="特殊属性"]/parent::*//div', attribute_input[0]) TaskPage.close_task_detail_popup(sb)
def test_add_face_alert_deployment_task_threshold(sb, login, setup_face_alert_deployment_task_name_and_delete_task): """添加指定阈值的监控任务,并校验任务详情中的阈值是否更新""" task = FaceAccessControlTask(setup_face_alert_deployment_task_name_and_delete_task['name'], setup_face_alert_deployment_task_name_and_delete_task['name'], portraits=[ setup_face_alert_deployment_task_name_and_delete_task['name'] ], threshold='70.0') TaskPage.add_face_alert_deployment_task(sb, task) TaskPage.detail_task_by_name(sb, task.task_name) TaskPage.assert_element_text(sb,'//label[text()="阈值"]/parent::*//div', '70.0%') TaskPage.close_task_detail_popup(sb)
def test_add_face_access_control_task_threshold( sb, login, threshold_input, expected, setup_face_access_control_task_name_and_delete_task): """添加指定阈值的前端设备任务,并校验任务详情中的阈值是否更新""" task = FaceAccessControlTask( setup_face_access_control_task_name_and_delete_task['name'], setup_face_access_control_task_name_and_delete_task['name'], portraits=[ setup_face_access_control_task_name_and_delete_task['name'] ], threshold=threshold_input) TaskPage.add_face_access_control_task(sb, task) TaskPage.detail_task_by_name(sb, task.task_name) TaskPage.assert_element_text(sb, '//label[text()="阈值"]/parent::*//span', expected) TaskPage.close_task_detail_popup(sb)
def test_add_face_access_control_task_entrance( sb, login, setup_face_access_control_task_name_and_delete_task): """添加入口属性的前端设备任务""" task = FaceAccessControlTask( setup_face_access_control_task_name_and_delete_task['name'], setup_face_access_control_task_name_and_delete_task['name'], portraits=[ setup_face_access_control_task_name_and_delete_task['name'] ], attributes=['入口']) TaskPage.add_face_access_control_task(sb, task) TaskPage.detail_task_by_name( sb, setup_face_access_control_task_name_and_delete_task['name']) TaskPage.assert_element_text(sb, '//label[text()="特殊属性"]/parent::*//div', '入口') TaskPage.close_task_detail_popup(sb)
def setup_vehicle_illegally_parking_detection_task_name_and_delete_task(sb): """ 生成车辆违停检测任务名称并清理该任务 """ request = {'name': generate_uuid()} MenuBar.click_menu_item_by_text(sb, '配置', '地图管理') MapPage.add_floor_by_root_floor_name(sb, request['name']) MenuBar.click_menu_item_by_text(sb, '配置', '设备管理') DevicePage.add_group_by_root_group_name(sb, request['name']) rtsp_device = RTSP(request['name'], request['name'], request['name'], request['name'], 'rtsp://confidence.119:6554/test.264') DevicePage.add_device_by_type(sb, rtsp_device, '网络摄像机') MenuBar.click_menu_item_by_text(sb, '配置', '人像库管理') PortraitPage.add_portrait_database_by_name(sb, request['name']) MenuBar.click_menu_item_by_text(sb, '配置', '任务管理') yield request sb.save_teardown_screenshot() MenuBar.click_menu_item_by_text(sb, '配置', '任务管理') TaskPage.click_task_tab_by_type(sb, type='车辆-违停检测任务') TaskPage.delete_task_by_name(sb, request['name']) MenuBar.click_menu_item_by_text(sb, '配置', '人像库管理') PortraitPage.delete_portrait_database_by_name(sb, request['name']) MenuBar.click_menu_item_by_text(sb, '配置', '设备管理') DevicePage.delete_group_by_name(sb, request['name']) MenuBar.click_menu_item_by_text(sb, '配置', '地图管理') MapPage.delete_floor_by_name(sb, request['name'])
def test_add_face_access_control_task_then_disable_then_enable( sb, login, setup_face_access_control_task_name_and_delete_task): """添加前端设备任务后禁用再启用""" task = FaceAccessControlTask( setup_face_access_control_task_name_and_delete_task['name'], setup_face_access_control_task_name_and_delete_task['name'], portraits=[ setup_face_access_control_task_name_and_delete_task['name'] ]) TaskPage.add_face_access_control_task(sb, task) TaskPage.switch_task_status_by_name(sb, task.task_name) TaskPage.switch_task_status_by_name(sb, task.task_name)
def test_add_face_access_control_task_duplicate_task_name( sb, login, setup_face_access_control_task_name_and_delete_task): """测试任务名重复""" # 先用初始值创建一个任务 task = FaceAccessControlTask( setup_face_access_control_task_name_and_delete_task['name'], setup_face_access_control_task_name_and_delete_task['name'], portraits=[ setup_face_access_control_task_name_and_delete_task['name'] ]) TaskPage.add_face_access_control_task(sb, task) # 再添加一个设备 MenuBar.click_menu_item_by_text(sb, '配置', '设备管理') frontend_device = Frontend( setup_face_access_control_task_name_and_delete_task['name'] + 'dup', setup_face_access_control_task_name_and_delete_task['name'] + 'dup', setup_face_access_control_task_name_and_delete_task['name'], setup_face_access_control_task_name_and_delete_task['name'], 'SensePass') DevicePage.add_device_by_type(sb, frontend_device, '人脸识别机(前)') # 用新的设备和原先的任务名称、人像库作为添加规则的准备数据 task2 = FaceAccessControlTask( setup_face_access_control_task_name_and_delete_task['name'], setup_face_access_control_task_name_and_delete_task['name'] + 'dup', portraits=[ setup_face_access_control_task_name_and_delete_task['name'] ]) # 定位到setup中的任务菜单 MenuBar.click_menu_item_by_text(sb, '配置', '任务管理') # 再次添加规则 TaskPage.add_face_access_control_task(sb, task2) # 校验"任务名已存在" TaskPage.assert_alert_message(sb, '任务名已存在') # 关闭新增任务窗口 TaskPage.click_task_cancel_button(sb)
def test_add_face_access_control_task_then_update_taskName( sb, login, setup_face_access_control_task_name_and_delete_task): """更新前端设备任务的任务名称, 并校验任务列表中名是否更新 以及任务详情中任务名是否更新 """ task = FaceAccessControlTask( setup_face_access_control_task_name_and_delete_task['name'], setup_face_access_control_task_name_and_delete_task['name'], portraits=[ setup_face_access_control_task_name_and_delete_task['name'] ]) TaskPage.add_face_access_control_task(sb, task) newName = f"{setup_face_access_control_task_name_and_delete_task['name']}upd" TaskPage.edit_task_name( sb, setup_face_access_control_task_name_and_delete_task['name'], newName) TaskPage.search_task_by_name(sb, newName) TaskPage.assert_element_text( sb, '//*[@id="app"]/div/div[1]/section/div/div[2]/div[2]/div[1]/div[1]/div[3]/table/tbody/tr[1]/td[2]/div', newName) TaskPage.detail_task_by_name(sb, newName) TaskPage.assert_element_text(sb, '//label[text()="任务名称"]/parent::*//span', newName) TaskPage.close_task_detail_popup(sb)