feat(5.10): UX trimiteri (pill filtre, paginare, editare) + Mapari in meniu + branding ROMFAST
14 stories TDD prin echipa de workeri (lead orchestreaza, 3 teammates pe valuri cu fisiere disjuncte; routes.py + base.html serializate ca fisiere fierbinti). - US-001 fix filtrare data (_iso_date_prefix pe garda+comparatie, prinde timestamp cu ora) - US-002/007 operatie service distincta in payload_view + afisare in detaliu - US-003 pill-uri categorii (button/aria-pressed; needs_mapping --warn, needs_data/error --err); fara lista ID-uri/dropdown - US-004 paginare numerotata 25/pag (total ramificat SQL-COUNT vs fetch-all+slice, clamp page, poll pastreaza pagina) - US-005 VIN block-level sub nr - US-006/006b editare cod RAR + validare nomenclator + recalcul idempotency (needs_data/needs_mapping via /corecteaza, error via /repune) - US-008 card eroare 3-niveluri doar pe read-only + rezumat top-of-form - US-009 Mapari in meniu hamburger; scoatere tab-bar + role=tablist orfan - US-010/011 pagina Mapari consolidata + butoane icon SVG + dirty-state (fara kebab/emoji) - US-012/012b header centrat + logo ROMFAST (/static/romfast_logo.png) in header - US-013 paleta azur ROMFAST (#2E74D6/#1F66C9) + IBM Plex Sans/Mono self-host (woff2 reale) - US-014 selector tema ciclic Light/Dark/Petrol/Auto + anti-FOUC pe 4 stari Backend trimitere (worker/masina stari/idempotenta/mapping) + schema NEATINSE (UI/UX pur + 1 fix de filtrare). VERIFY context curat PASS; /code-review high: 1 finding material reparat (US-006b). Regresie 896 passed, 1 skipped, 0 failed. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
135
tests/test_web_mapari_layout.py
Normal file
135
tests/test_web_mapari_layout.py
Normal file
@@ -0,0 +1,135 @@
|
||||
"""Teste US-010 (PRD 5.10): restructurare pagina Mapari intr-o singura pagina consolidata.
|
||||
|
||||
Modificari cerute:
|
||||
- Ordinea sectiunilor: (1) De rezolvat, (2) Mapari salvate, (3) Reguli automate, (4) Formate coloane.
|
||||
- Sectiunea de ajutor (<details class="ajutor-mapari">) eliminata.
|
||||
- Textul empty-state „Nicio operatie nemapata — tot ce a venit s-a tradus in coduri RAR..." eliminat.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import re
|
||||
import tempfile
|
||||
|
||||
import pytest
|
||||
from starlette.testclient import TestClient
|
||||
|
||||
|
||||
def _create_account_user(email: str, name: str = "Service", password: str = "parolasecreta10"):
|
||||
from app.accounts import create_account
|
||||
from app.users import create_user
|
||||
from app.db import get_connection
|
||||
|
||||
conn = get_connection()
|
||||
try:
|
||||
acct_id = create_account(conn, name, active=True)
|
||||
create_user(conn, acct_id, email, password)
|
||||
return acct_id
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
|
||||
def _login(client, email: str, password: str = "parolasecreta10") -> None:
|
||||
resp = client.get("/login")
|
||||
m = re.search(r'name="csrf_token"\s+value="([^"]+)"', resp.text) or \
|
||||
re.search(r'value="([^"]+)"\s+name="csrf_token"', resp.text)
|
||||
assert m
|
||||
resp = client.post(
|
||||
"/login",
|
||||
data={"email": email, "parola": password, "csrf_token": m.group(1)},
|
||||
)
|
||||
assert resp.status_code == 303
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
def client(monkeypatch):
|
||||
tmp = tempfile.mkdtemp()
|
||||
monkeypatch.setenv("AUTOPASS_DB_PATH", os.path.join(tmp, "mapari_layout.db"))
|
||||
monkeypatch.setenv("AUTOPASS_WEB_AUTH_REQUIRED", "true")
|
||||
from app.config import get_settings
|
||||
get_settings.cache_clear()
|
||||
from app.web import ratelimit
|
||||
ratelimit._hits.clear()
|
||||
from app.main import app
|
||||
with TestClient(app, follow_redirects=False) as c:
|
||||
yield c
|
||||
ratelimit._hits.clear()
|
||||
get_settings.cache_clear()
|
||||
|
||||
|
||||
def test_de_rezolvat_prima(client):
|
||||
"""Sectiunea „De rezolvat" apare prima — inaintea „Mapari operatii salvate"."""
|
||||
_create_account_user("mapari_ord@test.com")
|
||||
_login(client, "mapari_ord@test.com")
|
||||
|
||||
resp = client.get("/_fragments/mapari")
|
||||
assert resp.status_code == 200
|
||||
html = resp.text
|
||||
|
||||
pos_de_rezolvat = html.find("De rezolvat")
|
||||
pos_salvate = html.find("Mapari operatii salvate")
|
||||
|
||||
assert pos_de_rezolvat != -1, "Sectiunea 'De rezolvat' trebuie sa existe in pagina."
|
||||
assert pos_salvate != -1, "Sectiunea 'Mapari operatii salvate' trebuie sa existe in pagina."
|
||||
assert pos_de_rezolvat < pos_salvate, (
|
||||
f"'De rezolvat' (pozitia {pos_de_rezolvat}) trebuie sa apara INAINTE de "
|
||||
f"'Mapari operatii salvate' (pozitia {pos_salvate})."
|
||||
)
|
||||
|
||||
|
||||
def test_fara_ajutor_si_empty_text(client):
|
||||
"""Sectiunea de ajutor (ajutor-mapari) si empty-text-ul specific sunt eliminate."""
|
||||
_create_account_user("mapari_fara@test.com")
|
||||
_login(client, "mapari_fara@test.com")
|
||||
|
||||
resp = client.get("/_fragments/mapari")
|
||||
assert resp.status_code == 200
|
||||
html = resp.text
|
||||
|
||||
# Sectiunea de ajutor eliminata
|
||||
assert 'ajutor-mapari' not in html, (
|
||||
"Clasa 'ajutor-mapari' (details de ajutor) trebuie eliminata din pagina Mapari (US-010)."
|
||||
)
|
||||
assert 'class="ajutor-mapari"' not in html, (
|
||||
"<details class=\"ajutor-mapari\"> trebuie eliminat."
|
||||
)
|
||||
|
||||
# Empty-text specific „Nicio operatie nemapata" eliminat
|
||||
assert "Nicio operatie nemapata" not in html, (
|
||||
"Textul empty-state 'Nicio operatie nemapata — tot ce a venit...' trebuie eliminat (US-010)."
|
||||
)
|
||||
assert "tot ce a venit s-a tradus in coduri RAR" not in html, (
|
||||
"Textul empty-state extins trebuie eliminat complet."
|
||||
)
|
||||
|
||||
|
||||
def test_ordine_sectiuni(client):
|
||||
"""Ordinea corecta a sectiunilor: De rezolvat → Mapari salvate → Reguli automate → Formate."""
|
||||
_create_account_user("mapari_ord2@test.com")
|
||||
_login(client, "mapari_ord2@test.com")
|
||||
|
||||
resp = client.get("/_fragments/mapari")
|
||||
assert resp.status_code == 200
|
||||
html = resp.text
|
||||
|
||||
pos1 = html.find("De rezolvat")
|
||||
pos2 = html.find("Mapari operatii salvate")
|
||||
pos3 = html.find("Reguli automate")
|
||||
pos4 = html.find("Formate de coloane")
|
||||
|
||||
assert pos1 != -1, "Sectiunea 'De rezolvat' trebuie sa existe."
|
||||
assert pos2 != -1, "Sectiunea 'Mapari operatii salvate' trebuie sa existe."
|
||||
assert pos3 != -1, "Sectiunea 'Reguli automate' trebuie sa existe."
|
||||
assert pos4 != -1, "Sectiunea 'Formate de coloane' trebuie sa existe."
|
||||
|
||||
assert pos1 < pos2, "De rezolvat trebuie sa fie inaintea Mapari salvate."
|
||||
assert pos2 < pos3, (
|
||||
f"'Mapari operatii salvate' (poz {pos2}) trebuie sa fie inaintea "
|
||||
f"'Reguli automate' (poz {pos3}). Acum Reguli automate e ultima sectiune — "
|
||||
"muta-o pe pozitia 3 (inaintea Formate de coloane)."
|
||||
)
|
||||
assert pos3 < pos4, (
|
||||
f"'Reguli automate' (poz {pos3}) trebuie sa fie inaintea "
|
||||
f"'Formate de coloane' (poz {pos4})."
|
||||
)
|
||||
Reference in New Issue
Block a user