zoph: Convert functional tests to non-BDD python format

Signed-off-by: James Valleroy <jvalleroy@mailbox.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
James Valleroy authored and Sunil Mohan Adapa committed 2021-10-05 15:29:21 -07:00
1 parent c92c95e39d
commit a89b4de8b7
2 files changed
+32 -31

No files matched your search

+32 -4
View File
@@ -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')
-27
View File
@@ -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