From c2844d358e3991dd2a175c0c47f56cefb5c10b24 Mon Sep 17 00:00:00 2001 From: James Valleroy Date: Mon, 6 Sep 2021 20:52:42 -0400 Subject: [PATCH] performance: Convert functional tests to non-BDD python format Signed-off-by: James Valleroy [sunil: Add markers] Signed-off-by: Sunil Mohan Adapa Reviewed-by: Sunil Mohan Adapa --- .../performance/tests/performance.feature | 20 --------------- .../performance/tests/test_functional.py | 25 +++++++++++++++++-- 2 files changed, 23 insertions(+), 22 deletions(-) delete mode 100644 plinth/modules/performance/tests/performance.feature diff --git a/plinth/modules/performance/tests/performance.feature b/plinth/modules/performance/tests/performance.feature deleted file mode 100644 index cbae2c492..000000000 --- a/plinth/modules/performance/tests/performance.feature +++ /dev/null @@ -1,20 +0,0 @@ -# SPDX-License-Identifier: AGPL-3.0-or-later - -@system @performance -Feature: Performance - system monitoring - Run the Performance Co-Pilot app. - -Background: - Given I'm a logged in user - And advanced mode is on - And the performance application is installed - -Scenario: Enable performance application - Given the performance application is disabled - When I enable the performance application - Then the performance service should be running - -Scenario: Disable performance application - Given the performance application is enabled - When I disable the performance application - Then the performance service should not be running diff --git a/plinth/modules/performance/tests/test_functional.py b/plinth/modules/performance/tests/test_functional.py index eed641b09..3f7e7a70e 100644 --- a/plinth/modules/performance/tests/test_functional.py +++ b/plinth/modules/performance/tests/test_functional.py @@ -3,6 +3,27 @@ Functional, browser based tests for performance app. """ -from pytest_bdd import scenarios +import pytest +from plinth.tests import functional -scenarios('performance.feature') +pytestmark = [pytest.mark.system, pytest.mark.performance] + + +@pytest.fixture(scope='module', autouse=True) +def fixture_background(session_browser): + """Login and install the app.""" + functional.login(session_browser) + functional.install(session_browser, 'performance') + yield + functional.app_disable(session_browser, 'performance') + + +def test_enable_disable(session_browser): + """Test enabling the app.""" + functional.app_disable(session_browser, 'performance') + + functional.app_enable(session_browser, 'performance') + assert functional.service_is_running(session_browser, 'performance') + + functional.app_disable(session_browser, 'performance') + assert functional.service_is_not_running(session_browser, 'performance')