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 setup_portrait_database_name_and_delete_portrait_database(sb): """ 生成人像库名称并清理该人像库 """ request = {'name': generate_uuid()} MenuBar.click_menu_item_by_text(sb, '配置', '人像库管理') yield request sb.save_teardown_screenshot() PortraitPage.delete_portrait_database_by_name(sb, request['name'])
def test_rename_existing_portrait_database(sb, login, setup_portrait_database): new_name = f'{setup_portrait_database["name"]}N' PortraitPage.rename_portrait_database_by_name( sb, setup_portrait_database['name'], new_name) PortraitPage.search_portrait_database_by_name( sb, setup_portrait_database['name']) sb.is_element_visible(f'//div[@title="{new_name}"]') PortraitPage.delete_portrait_database_by_name(sb, new_name)
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 setup_portrait_with_two_portrait_databases_and_delete_portrait_databases( sb, setup_portrait_database_name): """ 添加人像到人像库并删除人像库 """ request = { 'name': generate_uuid(), 'portrait_databases': [ f'{setup_portrait_database_name["name"]}1', f'{setup_portrait_database_name["name"]}2' ] } for portrait_database in request['portrait_databases']: PortraitPage.add_portrait_database_by_name(sb, portrait_database) MenuBar.click_menu_item_by_text(sb, '配置', '人像库管理') portrait = Portrait(name=request['name'], id_number=request['name'], image_path=os.getcwd() + '/guard/data/portrait/001-JPG.jpg', portrait_databases=request['portrait_databases']) PortraitPage.add_portrait(sb, portrait) yield request sb.save_teardown_screenshot() for portrait_database in request['portrait_databases']: PortraitPage.delete_portrait_database_by_name(sb, portrait_database)
def test_delete_existing_portrait_database(sb, login, setup_portrait_database): PortraitPage.delete_portrait_database_by_name( sb, setup_portrait_database['name']) PortraitPage.assert_alert_message(sb, '删除分组成功') sb.is_element_visible('//span[text()="暂无数据"]')