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)"]' )
def test_search_existing_portrait( 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']) sb.is_element_visible( f'//table//div[@class="cell" and contains(text(), "{setup_portrait_with_portrait_database_and_delete_portrait_database["name"]}")]' )
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()="暂无数据"]')
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"]}")]' )
def test_search_not_existing_portrait(sb, login, setup_portrait_name): PortraitPage.search_portrait_by_keyword(sb, setup_portrait_name['name']) sb.is_element_visible('//span[text()="暂无数据"]')