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_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_portrait_database(sb, portrait_type): """ 添加人像库 """ request = {'name': generate_uuid()} MenuBar.click_menu_item_by_text(sb, '配置', '人像库管理') PortraitPage.add_portrait_database_by_name(sb, request['name'], type=portrait_type) yield request sb.save_teardown_screenshot()
def test_portrait(self): # 访问人像库管理页面 MenuBar.click_menu_item_by_text(self, '配置', '人像库管理') # 添加白名单库 PortraitPage.add_portrait_database_by_name( self, SmokeTest.SMOKE_PORTRAIT_DATABASE_WHITELIST_NAME, type='白名单') # PortraitPage.assert_alert_message(self, '创建下一级分组成功') # 添加重点人员库 PortraitPage.add_portrait_database_by_name( self, SmokeTest.SMOKE_PORTRAIT_DATABASE_KEY_PERSONNEL_NAME, type='重点人员')
def test_add_portrait_database( sb, login, portrait_type, setup_portrait_database_name_and_delete_portrait_database): PortraitPage.add_portrait_database_by_name( sb, setup_portrait_database_name_and_delete_portrait_database['name'], type=portrait_type) PortraitPage.assert_alert_message(sb, '创建下一级分组成功') PortraitPage.search_portrait_database_by_name( sb, setup_portrait_database_name_and_delete_portrait_database['name']) sb.is_element_visible( f'//div[@title="{setup_portrait_database_name_and_delete_portrait_database["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_add_portrait_database_with_invalid_name(sb, login, name): MenuBar.click_menu_item_by_text(sb, '配置', '人像库管理') PortraitPage.add_portrait_database_by_name(sb, name) PortraitPage.assert_element_text(sb, '.tips > span', '请输入分组名称')