miniflux: tests: functional: Use helper functions from functional libary

Also, ignore pexpect module in mypy checks.

Tests:
  - All miniflux tests pass.

Signed-off-by: Veiko Aasa <veiko17@disroot.org>
[sunil: Update to reflect the new utility function name]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
Veiko Aasa 2024-12-25 19:48:17 +02:00 committed by Sunil Mohan Adapa
parent 92c35e4640
commit eca6a65080
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2
2 changed files with 8 additions and 16 deletions

View File

@ -34,9 +34,7 @@ class TestMinifluxApp(functional.BaseAppTests):
"""Test creating an admin user.""" """Test creating an admin user."""
_miniflux_login(session_browser) _miniflux_login(session_browser)
# Verify that this user can see admin settings # Verify that this user can see admin settings
with functional.wait_for_page_update(session_browser): functional.click_link_by_href(session_browser, '/miniflux/settings')
session_browser.links.find_by_href(
'/miniflux/settings').first.click()
assert not session_browser.links.find_by_href( assert not session_browser.links.find_by_href(
'/miniflux/users').is_empty() '/miniflux/users').is_empty()
@ -61,9 +59,7 @@ class TestMinifluxApp(functional.BaseAppTests):
def _fill_credentials_form(browser, href): def _fill_credentials_form(browser, href):
"""Fill the user credentials form in Miniflux app.""" """Fill the user credentials form in Miniflux app."""
functional.nav_to_module(browser, 'miniflux') functional.nav_to_module(browser, 'miniflux')
with functional.wait_for_page_update(browser): functional.click_link_by_href(browser, f'/plinth/apps/miniflux/{href}/')
browser.links.find_by_href(
f'/plinth/apps/miniflux/{href}/').first.click()
browser.fill('miniflux-username', CREDENTIALS['username']) browser.fill('miniflux-username', CREDENTIALS['username'])
browser.fill('miniflux-password', CREDENTIALS['password']) browser.fill('miniflux-password', CREDENTIALS['password'])
@ -89,8 +85,7 @@ def _miniflux_logout(browser):
_open_miniflux_app(browser) _open_miniflux_app(browser)
maybe_logout_button = browser.links.find_by_href('/miniflux/logout') maybe_logout_button = browser.links.find_by_href('/miniflux/logout')
if not maybe_logout_button.is_empty(): if not maybe_logout_button.is_empty():
with functional.wait_for_page_update(browser): functional.click_and_wait(browser, maybe_logout_button)
maybe_logout_button.first.click()
def _miniflux_submit(browser): def _miniflux_submit(browser):
@ -117,19 +112,15 @@ def _subscribe(browser, feed_url):
"""Subscribe to a feed in Miniflux.""" """Subscribe to a feed in Miniflux."""
_open_miniflux_app(browser) _open_miniflux_app(browser)
_miniflux_login(browser) _miniflux_login(browser)
with functional.wait_for_page_update(browser): functional.click_link_by_href(browser, '/miniflux/subscribe')
browser.links.find_by_href('/miniflux/subscribe').first.click() browser.find_by_id('form-url').fill(feed_url)
_miniflux_submit(browser)
with functional.wait_for_page_update(browser):
browser.find_by_id('form-url').fill(feed_url)
_miniflux_submit(browser)
def _is_subscribed(browser, feed_name): def _is_subscribed(browser, feed_name):
"""Check if the user is subscribed to a feed.""" """Check if the user is subscribed to a feed."""
_open_miniflux_app(browser) _open_miniflux_app(browser)
_miniflux_login(browser) _miniflux_login(browser)
with functional.wait_for_page_update(browser): functional.click_link_by_href(browser, '/miniflux/feeds')
browser.links.find_by_href('/miniflux/feeds').first.click()
return browser.is_text_present(feed_name) return browser.is_text_present(feed_name)

View File

@ -164,6 +164,7 @@ module = [
"django.*", "django.*",
"gi.*", "gi.*",
"pam.*", "pam.*",
"pexpect.*",
"pgi.*", "pgi.*",
"plinth.tests.config_local", "plinth.tests.config_local",
"pytest_splinter.*", "pytest_splinter.*",