diff --git a/plinth/modules/zoph/tests/test_functional.py b/plinth/modules/zoph/tests/test_functional.py index f0ebab73a..854f7fb75 100644 --- a/plinth/modules/zoph/tests/test_functional.py +++ b/plinth/modules/zoph/tests/test_functional.py @@ -3,14 +3,42 @@ Functional, browser based tests for zoph app. """ -from pytest_bdd import given, parsers, scenarios - +import pytest from plinth.tests import functional -scenarios('zoph.feature') +pytestmark = [pytest.mark.apps, pytest.mark.zoph] + + +@pytest.fixture(scope='module', autouse=True) +def fixture_background(session_browser): + """Login and install the app.""" + functional.login(session_browser) + functional.install(session_browser, 'zoph') + _zoph_is_setup(session_browser) + yield + functional.app_disable(session_browser, 'zoph') + + +def test_enable_disable(session_browser): + """Test enabling the app.""" + functional.app_disable(session_browser, 'zoph') + + functional.app_enable(session_browser, 'zoph') + assert functional.app_is_enabled(session_browser, 'zoph') + + functional.app_disable(session_browser, 'zoph') + assert not functional.app_is_enabled(session_browser, 'zoph') + + +@pytest.mark.backups +def test_backup_restore(session_browser): + """Test backup and restore.""" + functional.app_enable(session_browser, 'zoph') + functional.backup_create(session_browser, 'zoph', 'test_zoph') + functional.backup_restore(session_browser, 'zoph', 'test_zoph') + assert functional.app_is_enabled(session_browser, 'zoph') -@given(parsers.parse('the zoph application is setup')) def _zoph_is_setup(session_browser): """Click setup button on the setup page.""" functional.nav_to_module(session_browser, 'zoph') diff --git a/plinth/modules/zoph/tests/zoph.feature b/plinth/modules/zoph/tests/zoph.feature deleted file mode 100644 index e7c655794..000000000 --- a/plinth/modules/zoph/tests/zoph.feature +++ /dev/null @@ -1,27 +0,0 @@ -# SPDX-License-Identifier: AGPL-3.0-or-later - -@apps @zoph -Feature: Zoph Organises PHotos - Run photo organiser - -Background: - Given I'm a logged in user - Given the zoph application is installed - Given the zoph application is setup - -Scenario: Enable zoph application - Given the zoph application is disabled - When I enable the zoph application - Then the zoph application is enabled - -@backups -Scenario: Backup and restore zoph - Given the zoph application is enabled - When I create a backup of the zoph app data with name test_zoph - And I restore the zoph app data backup with name test_zoph - Then the zoph application is enabled - -Scenario: Disable zoph application - Given the zoph application is enabled - When I disable the zoph application - Then the zoph application is disabled