diff --git a/plinth/modules/backups/tests/test_functional.py b/plinth/modules/backups/tests/test_functional.py index 05b1525e0..353dc2849 100644 --- a/plinth/modules/backups/tests/test_functional.py +++ b/plinth/modules/backups/tests/test_functional.py @@ -77,7 +77,7 @@ def _backup_download(session_browser, downloaded_file_info, archive_name): def _backup_restore_from_upload(session_browser, app_name, downloaded_file_info): - path = downloaded_file_info["path"] + path = downloaded_file_info['path'] try: _upload_and_restore(session_browser, app_name, path) except Exception as err: @@ -155,11 +155,11 @@ def _backup_schedule_set(browser, enable, daily, weekly, monthly, run_at, def _download_file_logged_in(browser, url, suffix=''): """Download a file from Plinth, pretend being logged in via cookies""" - if not url.startswith("http"): + if not url.startswith('http'): current_url = urllib.parse.urlparse(browser.url) - url = "%s://%s%s" % (current_url.scheme, current_url.netloc, url) + url = '%s://%s%s' % (current_url.scheme, current_url.netloc, url) cookies = browser.driver.get_cookies() - cookies = {cookie["name"]: cookie["value"] for cookie in cookies} + cookies = {cookie['name']: cookie['value'] for cookie in cookies} response = requests.get(url, verify=False, cookies=cookies) with tempfile.NamedTemporaryFile(delete=False, suffix=suffix) as temp_file: for chunk in response.iter_content(chunk_size=128): @@ -183,8 +183,8 @@ def _open_main_page(browser): def _upload_and_restore(browser, app_name, downloaded_file_path): functional.nav_to_module(browser, 'backups') browser.links.find_by_href('/plinth/sys/backups/upload/').first.click() - fileinput = browser.driver.find_element_by_id('id_backups-file') - fileinput.send_keys(downloaded_file_path) + fileinput = browser.find_by_id('id_backups-file') + fileinput.fill(downloaded_file_path) # submit upload form functional.submit(browser, form_class='form-upload') # submit restore form diff --git a/plinth/modules/openvpn/tests/test_functional.py b/plinth/modules/openvpn/tests/test_functional.py index 59285c245..4c8aeda47 100644 --- a/plinth/modules/openvpn/tests/test_functional.py +++ b/plinth/modules/openvpn/tests/test_functional.py @@ -63,6 +63,6 @@ def _profile_download_compare(session_browser, openvpn_profile): def _download_profile(browser): """Return the content of the current user's OpenVPN profile.""" browser.visit(base_url) - browser.click_link_by_href(shortcut_href) + browser.links.find_by_href(shortcut_href).click() profile_url = f'{base_url}/plinth/apps/openvpn/profile/' return functional.download_file(browser, profile_url) diff --git a/plinth/modules/transmission/tests/test_functional.py b/plinth/modules/transmission/tests/test_functional.py index 4cea09330..002593671 100644 --- a/plinth/modules/transmission/tests/test_functional.py +++ b/plinth/modules/transmission/tests/test_functional.py @@ -57,11 +57,11 @@ def _remove_all_torrents(browser): torrents.first.click() functional.eventually(browser.is_element_not_present_by_css, args=['#toolbar-remove.disabled']) - browser.click_link_by_id('toolbar-remove') + browser.find_by_id('toolbar-remove').click() functional.eventually( browser.is_element_not_present_by_css, args=['#dialog-container[style="display: none;"]']) - browser.click_link_by_id('dialog_confirm_button') + browser.find_by_id('dialog_confirm_button').click() functional.eventually(browser.is_element_present_by_css, args=['#toolbar-remove.disabled']) @@ -71,11 +71,11 @@ def _upload_sample_torrent(browser): functional.visit(browser, '/transmission') file_path = os.path.join(os.path.dirname(__file__), 'data', 'sample.torrent') - browser.click_link_by_id('toolbar-open') + browser.find_by_id('toolbar-open').click() functional.eventually(browser.is_element_not_present_by_css, args=['#upload-container[style="display: none;"]']) browser.attach_file('torrent_files[]', [file_path]) - browser.click_link_by_id('upload_confirm_button') + browser.find_by_id('upload_confirm_button').click() functional.eventually(browser.is_element_present_by_css, args=['#torrent_list .torrent']) diff --git a/plinth/tests/functional/install.sh b/plinth/tests/functional/install.sh index ff719feb5..678e7b768 100755 --- a/plinth/tests/functional/install.sh +++ b/plinth/tests/functional/install.sh @@ -11,7 +11,7 @@ sudo apt-get install -yq --no-install-recommends \ PIP_VERSION=$(dpkg-query -W -f '${Version}' python3-pip) PIP_OPTIONS= dpkg --compare-versions 23 \<= $PIP_VERSION && PIP_OPTIONS=--break-system-packages -pip3 install $PIP_OPTIONS selenium==4.2.0 splinter==0.17.0 pytest-splinter pytest-reporter-html1 +pip3 install $PIP_OPTIONS selenium==4.25.0 splinter==0.21.0 pytest-splinter pytest-reporter-html1 echo "Installing geckodriver" (