示例#1
0
def test_add_valid_portrait(
        sb, login, setup_portrait_database_and_delete_portrait_database,
        setup_portrait_name, image_path):
    portrait = Portrait(
        name=setup_portrait_name['name'],
        id_number=setup_portrait_name['name'],
        image_path=os.getcwd() + image_path,
        portrait_databases=[
            setup_portrait_database_and_delete_portrait_database['name']
        ])
    PortraitPage.add_portrait(sb, portrait)
    PortraitPage.assert_alert_message(sb, '添加人像成功')
    PortraitPage.search_portrait_by_keyword(sb, setup_portrait_name['name'])
    sb.is_element_visible(
        f'//table//div[@class="cell" and contains(text(), "{setup_portrait_name["name"]}")]'
    )
示例#2
0
def setup_portrait_with_portrait_database_and_delete_portrait_database(
        sb, setup_portrait_database_and_delete_portrait_database):
    """ 添加人像到人像库并删除人像库 """
    request = {
        'name':
        generate_uuid(),
        'portrait_database':
        setup_portrait_database_and_delete_portrait_database['name']
    }
    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_database']])
    PortraitPage.add_portrait(sb, portrait)
    yield request
    sb.save_teardown_screenshot()
示例#3
0
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)