From bed579c377c2b0decee0286bf974dd34b04f602d Mon Sep 17 00:00:00 2001 From: James Valleroy Date: Sun, 17 Oct 2021 10:28:01 -0400 Subject: [PATCH] tests: Add run diagnostics test to BaseAppTests Signed-off-by: James Valleroy [sunil: Use more forgiving selectors] Signed-off-by: Sunil Mohan Adapa Reviewed-by: Sunil Mohan Adapa --- plinth/tests/functional/__init__.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/plinth/tests/functional/__init__.py b/plinth/tests/functional/__init__.py index 26d84f467..6c9bc73a0 100644 --- a/plinth/tests/functional/__init__.py +++ b/plinth/tests/functional/__init__.py @@ -598,6 +598,7 @@ class BaseAppTests: # TODO: Check the components of the app instead of configuring here. has_service = False has_web = True + check_diagnostics = True def assert_app_running(self, session_browser): """Assert that the app is running.""" @@ -635,8 +636,20 @@ class BaseAppTests: def test_run_diagnostics(self, session_browser): """Test that all app diagnostics are passing.""" + if not self.check_diagnostics: + pytest.skip(f'Skipping diagnostics check for ${self.app_name}.') + app_enable(session_browser, self.app_name) - # TODO + session_browser.find_by_id('id_extra_actions_button').click() + submit(session_browser, form_class='form-diagnostics-button') + + warning_results = session_browser.find_by_css('.badge-warning') + if warning_results: + warnings.warn( + f'Diagnostics warnings for {self.app_name}: {warning_results}') + + failure_results = session_browser.find_by_css('.badge-danger') + assert not failure_results @pytest.mark.backups def test_backup_restore(self, session_browser):