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 2021-10-04 21:36:30 -04:00 committed by Sunil Mohan Adapa
parent c92c95e39d
commit a89b4de8b7
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2
2 changed files with 32 additions and 31 deletions

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')

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