From 9cc69ed32c7d2bbcda4cf55d802c631b26b9b544 Mon Sep 17 00:00:00 2001 From: James Valleroy Date: Tue, 7 Sep 2021 11:01:46 -0400 Subject: [PATCH] matrixsynapse: 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 --- .../matrixsynapse/tests/matrixsynapse.feature | 21 -------------- .../matrixsynapse/tests/test_functional.py | 28 +++++++++++++++++-- 2 files changed, 26 insertions(+), 23 deletions(-) delete mode 100644 plinth/modules/matrixsynapse/tests/matrixsynapse.feature diff --git a/plinth/modules/matrixsynapse/tests/matrixsynapse.feature b/plinth/modules/matrixsynapse/tests/matrixsynapse.feature deleted file mode 100644 index aefa9fc72..000000000 --- a/plinth/modules/matrixsynapse/tests/matrixsynapse.feature +++ /dev/null @@ -1,21 +0,0 @@ -# SPDX-License-Identifier: AGPL-3.0-or-later - -@apps @matrixsynapse -Feature: Matrix Synapse VoIP and Chat Server - Run Matrix Synapse server - -Background: - Given I'm a logged in user - Given the domain name is set to mydomain.example - Given the matrixsynapse application is installed - Given the domain name for matrixsynapse is set to mydomain.example - -Scenario: Enable matrixsynapse application - Given the matrixsynapse application is disabled - When I enable the matrixsynapse application - Then the matrixsynapse service should be running - -Scenario: Disable matrixsynapse application - Given the matrixsynapse application is enabled - When I disable the matrixsynapse application - Then the matrixsynapse service should not be running diff --git a/plinth/modules/matrixsynapse/tests/test_functional.py b/plinth/modules/matrixsynapse/tests/test_functional.py index 46d251545..3d13bc553 100644 --- a/plinth/modules/matrixsynapse/tests/test_functional.py +++ b/plinth/modules/matrixsynapse/tests/test_functional.py @@ -3,6 +3,30 @@ Functional, browser based tests for matrixsynapse app. """ -from pytest_bdd import scenarios +import pytest +from plinth.tests import functional -scenarios('matrixsynapse.feature') +pytestmark = [pytest.mark.apps, pytest.mark.matrixsynapse] + + +@pytest.fixture(scope='module', autouse=True) +def fixture_background(session_browser): + """Login and install the app.""" + functional.login(session_browser) + functional.set_domain_name(session_browser, 'mydomain.example') + functional.install(session_browser, 'matrixsynapse') + functional.app_select_domain_name(session_browser, 'matrixsynapse', + 'mydomain.example') + yield + functional.app_disable(session_browser, 'matrixsynapse') + + +def test_enable_disable(session_browser): + """Test enabling the app.""" + functional.app_disable(session_browser, 'matrixsynapse') + + functional.app_enable(session_browser, 'matrixsynapse') + assert functional.service_is_running(session_browser, 'matrixsynapse') + + functional.app_disable(session_browser, 'matrixsynapse') + assert functional.service_is_not_running(session_browser, 'matrixsynapse')