FreedomBox/plinth/modules/help/tests/test_functional.py
Sunil Mohan Adapa 2e2a9db195
help: tests: Fix functional test to check for status logs
Fixes: #2171.

Since systemd version 250, journalctl does not print the header line '-- Journal
begins... --'. To accommodate those changes, read the status log lines
accurately and check that they are not empty.

Tests:

- Run help functional tests on stable, testing and unstable.

- Modify code to not print status logs and notice that the functional test
fails.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
2022-01-17 11:15:59 -05:00

39 lines
1018 B
Python

# SPDX-License-Identifier: AGPL-3.0-or-later
"""
Functional, browser based tests for help app.
"""
import pytest
from plinth.tests import functional
pytestmark = [pytest.mark.system, pytest.mark.essential, pytest.mark.help]
# TODO Scenario: Visit the wiki
# TODO Scenario: Visit the mailing list
# TODO Scenario: Visit the IRC channel
# TODO Scenario: View the manual
# TODO Scenario: View the about page
@pytest.fixture(scope='module', autouse=True)
def fixture_background(session_browser):
"""Login."""
functional.login(session_browser)
def test_view_status_logs(session_browser):
"""Test viewing the status logs."""
_go_to_status_logs(session_browser)
assert _are_status_logs_shown(session_browser)
def _go_to_status_logs(browser):
functional.visit(browser, '/plinth/help/status-log/')
def _are_status_logs_shown(browser):
status_log = browser.find_by_css('.status-log').first.text
return ('-- No entries --' in status_log
or status_log.strip().splitlines())