test(0.16.0): contrat barre latérale et mur — 6 tests adaptés/ajoutés, 171 au total
This commit is contained in:
+48
-21
@@ -1,49 +1,76 @@
|
||||
"""Palier 12 (0.15.0): header unifié desktop/mobile (issue #16)."""
|
||||
"""Palier 12 (0.15.0 → refonte 0.16.0): layout barre latérale (#16)
|
||||
et wallboard sans défilement parasite."""
|
||||
|
||||
import app.main as main
|
||||
|
||||
|
||||
def test_shared_header_on_app_pages(client, fake_gitea):
|
||||
def test_sidebar_on_app_pages(client, fake_gitea):
|
||||
for path in ("/", "/focus", "/today", "/briefing", "/forecast",
|
||||
"/rules", "/health", "/standup", "/capture"):
|
||||
page = client.get(path)
|
||||
assert page.status_code == 200, path
|
||||
assert page.text.count('id="nav-more-btn"') == 1, path
|
||||
assert page.text.count('id="sidebar"') == 1, path
|
||||
assert page.text.count('id="nav-burger"') == 1, path
|
||||
assert page.text.count('id="mobile-nav"') == 1, path
|
||||
assert "with-sidebar" in page.text, path
|
||||
assert "/static/js/nav.js" in page.text, path
|
||||
# Primaires visibles, secondaires dans le menu « Plus ».
|
||||
assert 'href="/today"' in page.text
|
||||
assert 'href="/health"' in page.text # présent (menu Plus/mobile)
|
||||
assert 'class="nav-pills main-nav"' in page.text
|
||||
# Les quatre groupes de la barre latérale.
|
||||
for group in ("Principal", "Rituels", "Pilotage", "Outils"):
|
||||
assert group in page.text, (path, group)
|
||||
assert 'href="/health"' in page.text
|
||||
assert 'id="side-collapse"' in page.text
|
||||
|
||||
|
||||
def test_active_states(client, fake_gitea):
|
||||
def test_sidebar_active_states(client, fake_gitea):
|
||||
home = client.get("/")
|
||||
assert 'href="/" class="nav-pill active"' in home.text
|
||||
assert 'href="/" class="side-link active"' in home.text
|
||||
forecast = client.get("/forecast")
|
||||
# La page active est dans « Plus » : bouton marqué + lien actif.
|
||||
assert "active-soft" in forecast.text
|
||||
assert 'href="/forecast" class="nav-pill active"' in forecast.text
|
||||
assert 'href="/forecast" class="side-link active"' in forecast.text
|
||||
today = client.get("/today")
|
||||
assert 'href="/today" class="nav-pill active"' in today.text
|
||||
assert 'href="/today" class="side-link active"' in today.text
|
||||
|
||||
|
||||
def test_board_header_crumb_and_gitea_link(client, fake_gitea):
|
||||
def test_board_topbar_crumb_and_gitea_link(client, fake_gitea):
|
||||
board = client.get("/board/Projets/demo")
|
||||
assert board.status_code == 200
|
||||
assert 'href="/board/Projets/demo"' in board.text # fil d'Ariane
|
||||
assert 'href="/board/Projets/demo"' in board.text # fil d'Ariane topbar
|
||||
assert "Gitea ↗" in board.text
|
||||
assert 'id="nav-burger"' in board.text
|
||||
assert 'id="sidebar"' in board.text
|
||||
|
||||
|
||||
def test_wall_has_no_app_header(client, fake_gitea):
|
||||
def test_wall_has_no_sidebar(client, fake_gitea):
|
||||
wall = client.get("/wall")
|
||||
assert wall.status_code == 200
|
||||
assert 'id="nav-burger"' not in wall.text # plein écran TV assumé
|
||||
assert 'id="sidebar"' not in wall.text # plein écran TV assumé
|
||||
assert "wall-foot" in wall.text
|
||||
|
||||
|
||||
def test_nav_js_contract(client, fake_gitea):
|
||||
js = client.get("/static/js/nav.js")
|
||||
assert js.status_code == 200
|
||||
assert "nav-burger" in js.text
|
||||
assert "sidebar-collapsed" in js.text
|
||||
assert "localStorage" in js.text
|
||||
assert "side-backdrop" in js.text
|
||||
assert "Escape" in js.text
|
||||
assert "aria-expanded" in js.text
|
||||
|
||||
|
||||
def test_wall_more_cards_line(client, fake_gitea, monkeypatch):
|
||||
async def fake_collect(only_repo):
|
||||
return [{
|
||||
"full_name": "Projets/demo",
|
||||
"counts": {c: 0 for c in
|
||||
("backlog", "todo", "in_progress", "qa", "review", "done")},
|
||||
"open_total": 12,
|
||||
"cards": [
|
||||
{"number": i, "title": f"Carte {i}", "column": "in_progress",
|
||||
"column_label": "🚧 En cours", "age_days": 2, "aging": False}
|
||||
for i in range(1, 10)
|
||||
],
|
||||
"cards_total": 12,
|
||||
"closed_today": 1,
|
||||
}]
|
||||
|
||||
monkeypatch.setattr(main, "_collect_wall_data", fake_collect)
|
||||
page = client.get("/wall")
|
||||
assert page.status_code == 200
|
||||
assert "+3 autres cartes en vol" in page.text
|
||||
assert "📋 Ouvertes" in page.text
|
||||
|
||||
Reference in New Issue
Block a user