From 50cedaf528c54a7a4e44b3a0ff2a68f8f7b1d925 Mon Sep 17 00:00:00 2001 From: Veiko Aasa Date: Thu, 28 Nov 2024 07:35:47 +0200 Subject: [PATCH] tags: tests: Fix deprecated webdriver attribute Fixes errors in functional tests: `AttributeError: 'WebDriver' object has no attribute 'find_element_by_id'` Tests: - All tags tests pass. Signed-off-by: Veiko Aasa Reviewed-by: Sunil Mohan Adapa --- plinth/tests/tags/test_functional.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/plinth/tests/tags/test_functional.py b/plinth/tests/tags/test_functional.py index fa7663b79..7a91f315b 100644 --- a/plinth/tests/tags/test_functional.py +++ b/plinth/tests/tags/test_functional.py @@ -47,13 +47,13 @@ def test_bittorrent_tag(session_browser, bittorrent_tag): def test_search_for_tag(session_browser, bittorrent_tag): """Test that searching for a tag returns the expected apps.""" - search_input = session_browser.driver.find_element_by_id('add-tag-input') + search_input = session_browser.find_by_id('add-tag-input').first with functional.wait_for_page_update( session_browser, timeout=10, expected_url='/plinth/apps/?tag=BitTorrent&tag=File+sharing'): search_input.click() - search_input.send_keys('file sharing') - search_input.send_keys(Keys.ENTER) + search_input.type('file sharing') + search_input.type(Keys.ENTER) for app in ['deluge', 'samba', 'sharing', 'syncthing', 'transmission']: _is_app_listed(session_browser, app) @@ -61,7 +61,7 @@ def test_search_for_tag(session_browser, bittorrent_tag): def test_click_on_tag(session_browser, bittorrent_tag): """Test that clicking on a tag lists the expected apps.""" - search_input = session_browser.driver.find_element_by_id('add-tag-input') + search_input = session_browser.find_by_id('add-tag-input').first with functional.wait_for_page_update( session_browser, timeout=10, expected_url='/plinth/apps/?tag=BitTorrent&tag=File+sync'): @@ -79,10 +79,10 @@ def test_tag_localization(session_browser, locale): badge = session_browser.find_by_css('.tag-badge[data-tag="Sharing"]').first assert 'Compartir' in badge.text - search_input = session_browser.driver.find_element_by_id('add-tag-input') + search_input = session_browser.find_by_id('add-tag-input').first with functional.wait_for_page_update( session_browser, timeout=10, expected_url='/plinth/apps/?tag=Sharing&tag=Bookmarks'): search_input.click() - search_input.send_keys('Marcadores') - search_input.send_keys(Keys.ENTER) + search_input.type('Marcadores') + search_input.type(Keys.ENTER)