Exemplo n.º 1
0
def test_delete_existing_portrait_in_two_portrait_databases_from_current_portrait_database(
        sb, login,
        setup_portrait_with_two_portrait_databases_and_delete_portrait_databases
):
    PortraitPage.search_portrait_by_keyword(
        sb,
        setup_portrait_with_two_portrait_databases_and_delete_portrait_databases[
            'name'])
    PortraitPage.click_portrait_database_by_name(
        sb,
        setup_portrait_with_two_portrait_databases_and_delete_portrait_databases[
            'portrait_databases'][0])
    PortraitPage.delete_portrait_by_name(
        sb,
        setup_portrait_with_two_portrait_databases_and_delete_portrait_databases[
            'name'],
        from_current_group=True)
    PortraitPage.assert_alert_message(sb, '删除人像成功')
    PortraitPage.search_portrait_by_keyword(
        sb,
        setup_portrait_with_two_portrait_databases_and_delete_portrait_databases[
            'name'])
    sb.is_element_visible(
        f'//div[@title="{setup_portrait_with_two_portrait_databases_and_delete_portrait_databases["portrait_databases"][1]}" and text()="{setup_portrait_with_two_portrait_databases_and_delete_portrait_databases["portrait_databases"][1]} (1)"]'
    )
Exemplo n.º 2
0
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"]}"]'
    )
Exemplo n.º 3
0
def test_delete_existing_portrait_in_one_portrait_database_from_global_portrait_database(
        sb, login,
        setup_portrait_with_portrait_database_and_delete_portrait_database):
    PortraitPage.search_portrait_by_keyword(
        sb, setup_portrait_with_portrait_database_and_delete_portrait_database[
            'name'])
    PortraitPage.delete_portrait_by_name(
        sb, setup_portrait_with_portrait_database_and_delete_portrait_database[
            'name'])
    PortraitPage.assert_alert_message(sb, '删除人像成功')
    PortraitPage.search_portrait_by_keyword(
        sb, setup_portrait_with_portrait_database_and_delete_portrait_database[
            'name'])
    sb.is_element_visible('//span[text()="暂无数据"]')
Exemplo n.º 4
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"]}")]'
    )
Exemplo n.º 5
0
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()="暂无数据"]')
Exemplo n.º 6
0
def test_add_invalid_portrait_image(sb, login, setup_portrait_name, image_path,
                                    alert_message):
    PortraitPage.click_add_portrait_button(sb)
    PortraitPage.upload_portrait_image(sb, '添加人像', os.getcwd() + image_path)
    PortraitPage.assert_alert_message(sb, alert_message)