fix(orion): replace cover result box with compact status text

This commit is contained in:
Schubert Ferenc 2026-07-12 13:15:02 +02:00
parent 068d00513d
commit 85cd1c30ab
7 changed files with 75 additions and 7 deletions

View file

@ -917,23 +917,52 @@ def test_orion_result_boxes_render_on_cover_summary_and_results(tmp_path):
html = OrionReportService(db, tmp_path).render_html(validation.id)
assert html.count("VALIDIERUNGSERGEBNIS") >= 3
assert "BESTANDEN MIT AUFLAGEN" in html
assert html.count("VALIDIERUNGSERGEBNIS") >= 2
assert 'class="result-box result-box--cover' not in html
assert html.count('class="result-box result-box--compact') >= 2
assert "Ergebnis der Validierung" in html
assert "Die technische Validierung wurde mit Auflagen bestanden." in html
assert "BESTANDEN MIT AUFLAGEN" not in html
assert "Bestanden mit Auflagen" in html
assert 'class="cover-closing"' in html
assert 'class="cover-result-text"' in html
assert 'class="signature-block"' in html
assert "Unterschrift technische Validierung" in html
assert "Unterschrift Auftraggeber" not in html
assert html.index('id="cover"') < html.index("BESTANDEN MIT AUFLAGEN")
assert html.index('id="summary"') < html.index("Bestanden mit Auflagen")
assert html.index('id="results"') < html.rindex("Bestanden mit Auflagen")
def test_orion_cover_result_text_for_supported_statuses(tmp_path):
expected = {
"BESTANDEN": "Die technische Validierung wurde erfolgreich bestanden.",
"BESTANDEN_MIT_AUFLAGEN": "Die technische Validierung wurde mit Auflagen bestanden.",
"NICHT_BESTANDEN": "Die technische Validierung wurde nicht bestanden.",
}
for value, sentence in expected.items():
db = session()
customer, location, device = seed(db)
validation = valid_validation(customer, location, device)
validation.report_number = f"VAL-{value}"
validation.result = value
db.add(validation)
db.flush()
html = OrionReportService(db, tmp_path / value).render_html(validation.id)
assert "Ergebnis der Validierung" in html
assert sentence in html
assert 'class="result-box result-box--cover' not in html
assert html.count('class="result-box result-box--compact') >= 2
def test_orion_result_box_css_prevents_page_breaks():
css = Path("app/modules/orion/templates/report.css").read_text(encoding="utf-8")
assert ".result-box" in css
assert ".cover-closing" in css
assert ".cover-result-text" in css
assert ".signature-block" in css
assert "break-inside: avoid" in css
assert "page-break-inside: avoid" in css
@ -1116,8 +1145,8 @@ def test_orion_pdf_first_page_is_cover_not_blank(tmp_path):
assert "PRÜFBERICHTZURVALIDIERUNG" in normalized_text
assert "FUNKTIONS-UNDLEISTUNGSQUALIFIKATION" in normalized_text
assert "VALIDIERUNGSERGEBNIS" in normalized_text
assert "BESTANDEN" in normalized_text
assert "ERGEBNISDERVALIDIERUNG" in normalized_text
assert "DIETECHNISCHEVALIDIERUNGWURDEERFOLGREICHBESTANDEN" in normalized_text
def test_orion_bookmark_labels_are_created_from_central_sections(tmp_path):