Files
odysseus/tests/test_visual_report_mobile_toolbar.py
T
64b457dc0a fix(tests): read static sources as UTF-8 in the static assertion tests (#6850)
On native Windows the default text encoding is the ANSI code page
(cp1252 on en/pt systems), so the module-level read_text() calls in
eight static tests fail at collection with UnicodeDecodeError on bytes
0x81/0x90 that appear in static/js/chat.js, chatRenderer.js, app.js,
index.html and src/visual_report.py. Pass encoding="utf-8" like the
other 700+ tests in the suite already do.

Found by running the suite natively on Windows 11 (Python 3.11).

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Co-authored-by: Alexandre Teixeira <general@alexandreteixeira.dev>
2026-11-01 01:26:11 +00:00

29 lines
994 B
Python

from pathlib import Path
from bs4 import BeautifulSoup
from src.visual_report import generate_visual_report
SOURCE = (Path(__file__).resolve().parents[1] / "src/visual_report.py").read_text(encoding="utf-8")
def test_export_bookmark_is_anchored_and_expands_on_demand():
toolbar = SOURCE[SOURCE.index("/* ── Toolbar") : SOURCE.index("/* ── Hero ─")]
assert "position: absolute;" in toolbar
assert ".export-bookmark {{" in toolbar
assert "width: 38px;" in toolbar
assert ".export-bookmark.is-open {{ width: 108px; }}" in SOURCE
def test_hide_toolbar_is_an_export_menu_option_not_a_close_button():
soup = BeautifulSoup(
generate_visual_report("Toolbar report", "## Findings\n\nBody."),
"html.parser",
)
hide_button = soup.select_one("#export-menu > #btn-hide-toolbar")
assert hide_button is not None
assert hide_button.get_text(strip=True) == "Hide toolbar"
assert soup.select_one(".toolbar > .toolbar-close") is None