"""1.3.0 : page d'aide, plein écran, navigation, version.""" import re from shortstats.web import charts from .test_web import ORIGIN, app_client, login, users_file # noqa: F401 def test_help_page(app_client): r = app_client.get("/help", follow_redirects=False) assert r.status_code == 303 and r.headers["location"] == "/login" login(app_client) page = app_client.get("/help").text assert 'aria-current="page">Aide' in page and 'id="help-q"' in page and "help.js" in page # sections attendues et ancres utilisées ailleurs (page Thèmes -> /help#themes) for anchor in ("demarrer", "diagrammes", "axes-inverses", "analyse-thematique", "plein-ecran", "calendrier", "themes", "regex-syntaxe", "faq"): assert f'id="{anchor}"' in page, anchor # calendrier tiré du code : 151 étapes, une ligne par rythme assert "à 151 étapes" in page rows = re.findall(r"(Toutes les|Tous les)[^<]*(\d+)", page) assert [int(n) for _, n in rows] == [24, 16, 16, 23, 48, 24] and sum(int(n) for _, n in rows) == len(charts.STEPS) assert "1 h à 24 h" in page and "13 mois à 36 mois" in page assert chr(0x2014) not in page # pas de tiret cadratin def test_fullscreen_buttons_and_nav(app_client): login(app_client) dash = app_client.get("/").text assert 'data-action="full"' in dash and "Plein écran" in dash assert '