diff --git a/plinth/tests/functional/__init__.py b/plinth/tests/functional/__init__.py index 11fbd6018..b3c14d9c3 100644 --- a/plinth/tests/functional/__init__.py +++ b/plinth/tests/functional/__init__.py @@ -379,6 +379,13 @@ def app_disable(browser, app_name): _change_app_status(browser, app_name, 'disabled') +def app_is_enabled(browser, app_name): + """Return whether the app is enabled.""" + nav_to_module(browser, app_name) + should_enable_field = browser.find_by_id('id_should_enable') + return should_enable_field.value == 'False' + + def app_can_be_disabled(browser, app_name): """Return whether the application can be disabled.""" nav_to_module(browser, app_name) diff --git a/plinth/tests/functional/step_definitions.py b/plinth/tests/functional/step_definitions.py index a20f0a0fd..9bb445f70 100644 --- a/plinth/tests/functional/step_definitions.py +++ b/plinth/tests/functional/step_definitions.py @@ -58,6 +58,13 @@ def app_can_be_disabled(session_browser, app_name): pytest.skip('network time application can\'t be disabled') +@then(parsers.parse('the {app_name:w} application is {enabled:w}')) +def app_assert_is_enabled(session_browser, app_name, enabled): + assert enabled in ('enabled', 'disabled') + enabled = (enabled == 'enabled') + assert functional.app_is_enabled(session_browser, app_name) == enabled + + @then(parsers.parse('the {service_name:w} service should be running')) def service_should_be_running(session_browser, service_name): assert functional.eventually(functional.service_is_running,