tests: functional: Don't enable/disable app during tests

- Currently, after every test we disable the app and re-enable for the next
test. The original purpose of this disabling is to make sure that an app is
disabled after test on it. So, change the scope of disabling the app to ensure
that it is only disabled once after all the tests on the app. This should
improve the run time of the tests.

Tests:

- Run functional tests on bepasty app.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Veiko Aasa <veiko17@disroot.org>
This commit is contained in:
Sunil Mohan Adapa 2024-11-06 12:55:31 -08:00 committed by Veiko Aasa
parent fe98e3eb69
commit 63ada3ee62
No known key found for this signature in database
GPG Key ID: 478539CAE680674E

View File

@ -738,16 +738,21 @@ class BaseAppTests:
"""Install the app and set it up if needed."""
install(session_browser, self.app_name)
@pytest.fixture(autouse=True, scope='class', name='disable_after_tests')
def fixture_disable_after_tests(self, session_browser):
"""Disable the app after running tests."""
yield
if self.disable_after_tests:
app_disable(session_browser, self.app_name)
@pytest.fixture(autouse=True, name='background')
def fixture_background(self, session_browser):
def fixture_background(self, session_browser, disable_after_tests):
"""Login, install, and enable the app."""
login(session_browser)
self.install_and_setup(session_browser)
app_enable(session_browser, self.app_name)
yield
login(session_browser)
if self.disable_after_tests:
app_disable(session_browser, self.app_name)
def test_enable_disable(self, session_browser):
"""Test enabling and disabling the app."""