From 88722bd28aae9b2d129cd34796c302edacb43b5e Mon Sep 17 00:00:00 2001 From: anor Date: Wed, 18 Nov 2026 03:11:58 +1000 Subject: [PATCH] =?UTF-8?q?feat(=D0=B0=D0=B4=D0=BC=D0=B8=D0=BD=D0=BA=D0=B0?= =?UTF-8?q?):=20=C2=AB=D0=A1=D1=87=D1=91=D1=82=C2=BB,=20=C2=AB=D0=A4=D0=B0?= =?UTF-8?q?=D0=B9=D0=BB=D1=8B=C2=BB=20=D0=B8=20=C2=AB=D0=98=D1=81=D1=82?= =?UTF-8?q?=D0=BE=D1=80=D0=B8=D1=8F=C2=BB=20=D0=B2=20=D0=BA=D0=B0=D1=80?= =?UTF-8?q?=D1=82=D0=BE=D1=87=D0=BA=D0=B5=20=D0=BA=D0=BB=D0=B8=D0=B5=D0=BD?= =?UTF-8?q?=D1=82=D0=B0=20=E2=80=94=20=D1=82=D0=B0=D0=B1=D0=BB=D0=B8=D1=86?= =?UTF-8?q?=D1=8B=20=D0=B2=D0=BC=D0=B5=D1=81=D1=82=D0=BE=20=D1=81=D0=BB?= =?UTF-8?q?=D1=83=D0=B6=D0=B5=D0=B1=D0=BD=D0=BE=D0=B3=D0=BE=20=D1=82=D0=B5?= =?UTF-8?q?=D0=BA=D1=81=D1=82=D0=B0;=20=D0=B2=D0=B5=D1=80=D1=81=D0=B8?= =?UTF-8?q?=D1=8F=202026-11-18f?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Три вкладки показывали ответ сервера как есть: amount_kop, created_by, ts и фигурные скобки. Теперь «Счёт» — дата, сумма в рублях со знаком, примечание, кто внёс, «снимает №N» подписью, над таблицей строка баланса; «Файлы» — имя, размер в КБ/МБ, изменён; «История» — когда, кто, действие с методом и адресом, код ответа. На телефоне строка становится карточкой. Co-Authored-By: Claude Code --- docs/DESIGN_LOG.md | 22 +++ main.py | 2 +- static/admin2/pages/customer.js | 49 ++++++- static/admin2/styles.css | 40 ++++-- static/changelog.json | 7 + tests/test_admin_v2_customer_tabs.py | 195 +++++++++++++++++++++++++++ 6 files changed, 296 insertions(+), 19 deletions(-) create mode 100644 tests/test_admin_v2_customer_tabs.py diff --git a/docs/DESIGN_LOG.md b/docs/DESIGN_LOG.md index e696dda..2fd74f0 100644 --- a/docs/DESIGN_LOG.md +++ b/docs/DESIGN_LOG.md @@ -2,6 +2,28 @@ Правила и шаблон — в `../CLAUDE.md` («Design-gate»). Новые записи — СВЕРХУ. +--- +## 2026-11-18г — карточка клиента: «Счёт», «Файлы», «История» — таблицы +1. **Действие:** в static/admin2/pages/customer.js три вкладки карточки показывали ответ + сервера как есть (`
` с amount_kop, created_by, ts). Теперь таблицы: «Счёт» — дата,
+   сумма в рублях со знаком (+ зелёным, − красным), примечание, кто внёс, сторно; над
+   таблицей строка баланса (внесено / израсходовано). «Файлы» — имя, размер в КБ/МБ,
+   изменён. «История» — когда, кто, действие с методом и адресом запроса, код ответа.
+   Стили: ширины колонок у каждой таблицы свои, на ≤600 px строка становится карточкой.
+   Версия 2026-11-18f.
+2. **Класс риска:** выкат на прод; меняется только показ, ручки и данные не тронуты.
+3. **Прогон №1/№100/№1000:** просмотр; ничего не пишется; нагрузка та же.
+4. **Кто видит побочку:** оператор в админке.
+5. **Чекер?** нет нового.
+6. **Обратимость + радиус:** откат — вернуть customer.js/styles.css, APP_VERSION 2026-11-18e.
+7. **Отвергнутая альтернатива:** оставить служебный текст и подписать поля — Хозяин 18.11
+   показал этот вид как поломку; оператору нужны рубли и даты, а не копейки и метки времени.
+8. **Проверка вживую:** стенд 8112 и боевой 2026-11-18f: снимки вкладок «Счёт», «Файлы»,
+   «История» на настоящих данных.
+9. **Независимая проверка:** tests/test_admin_v2_customer_tabs.py (4 проверки: заголовки,
+   рубли со знаком, единицы размера, действие в истории, отсутствие прокрутки вбок на
+   1400 и 390), мутации: вернуть служебный текст, показать копейки, показать байты.
+
 ---
 ## 2026-11-18в — админка, карточка клиента: «Последний вопрос» не обрезается
 1. **Действие:** в static/admin2/styles.css таблица карточки клиента освобождена от общих
diff --git a/main.py b/main.py
index 2468ec0..cf5b4c2 100644
--- a/main.py
+++ b/main.py
@@ -477,7 +477,7 @@ MAX_MESSAGE_LEN = 10_000
 
 # ⚠️ Версия UI — единый источник. БАМПАТЬ ПРИ КАЖДОМ ДЕПЛОЕ (формат: YYYY-MM-DD + буква).
 # Фронт берёт её через GET /api/version (chat.html + admin.html, элемент .app-version).
-APP_VERSION = "2026-11-18e"
+APP_VERSION = "2026-11-18f"
 
 # Audit: path → action name mapping
 _AUDIT_MAP = [
diff --git a/static/admin2/pages/customer.js b/static/admin2/pages/customer.js
index b427d76..e305a60 100644
--- a/static/admin2/pages/customer.js
+++ b/static/admin2/pages/customer.js
@@ -18,11 +18,21 @@ const вопрос = (r) => {
   const t = String(r.title || r.last_question || '');
   return t.length > 140 ? t.slice(0, 140).trimEnd() + '…' : t;
 };
+// Счёт приходит в копейках: человеку показываем рубли и знак — куда деньги.
+const деньги = (kop) => kop == null ? '—' : (kop > 0 ? '+' : '')
+  + (kop / 100).toLocaleString('ru-RU', {minimumFractionDigits: 2, maximumFractionDigits: 2})
+  + ' ₽';
+const размер = (b) => b == null ? '—'
+  : b < 1024 ? b + ' Б'
+  : b < 1048576 ? Math.round(b / 1024) + ' КБ'
+  : (b / 1048576).toLocaleString('ru-RU', {minimumFractionDigits: 1, maximumFractionDigits: 1})
+    + ' МБ';
 
 export function CustomerDrawer({ email, onClose, onDeleted, onChanged }) {
   const [card, setCard] = useState(null);
   const [tab, setTab] = useState('overview');
   const [rows, setRows] = useState([]);
+  const [summary, setSummary] = useState(null);
   const [error, setError] = useState('');
   const [loading, setLoading] = useState(false);
   const [reload, setReload] = useState(0);
@@ -50,7 +60,12 @@ export function CustomerDrawer({ email, onClose, onDeleted, onChanged }) {
     const suffix = {dialogs: 'dialogs', ledger: 'ledger', files: 'files', history: 'history'}[tab];
     setError(''); setLoading(true);
     api('/api/admin/v2/customers/' + encodeURIComponent(email) + '/' + suffix)
-      .then((d) => { if (alive) setRows(Array.isArray(d) ? d : (d.items || d.entries || [])); })
+      .then((d) => {
+        if (!alive) return;
+        setRows(Array.isArray(d) ? d : (d.items || d.entries || []));
+        // Счёт отдаёт ещё и сводку (баланс, взносы, расход) — показываем строкой над таблицей.
+        setSummary(d && !Array.isArray(d) ? (d.account || null) : null);
+      })
       .catch((e) => { if (alive) setError(e.message || 'Не удалось загрузить вкладку'); })
       .finally(() => { if (alive) setLoading(false); });
     return () => { alive = false; };
@@ -126,7 +141,7 @@ export function CustomerDrawer({ email, onClose, onDeleted, onChanged }) {
       ${!card ? html`<${Loading} rows={2} />` : html`
         
+            onClick=${() => { setRows([]); setSummary(null); setTab(k); }}>${label}`)}
         ${!card.profile.deleted_at ? html`
` : tab === 'dialogs' ? html`
${loading ? html`<${Loading} rows={2} />` : rows.length === 0 ? html`

Пусто.

` - : html` + : html`
Был(а)Сообщений
${rows.map((r) => html` @@ -166,10 +181,34 @@ export function CustomerDrawer({ email, onClose, onDeleted, onChanged }) { '&owner=' + encodeURIComponent(email)} target="_blank" rel="noopener noreferrer">Открыть`)}
Был(а)Сообщений Последний вопросОткрыть
${when(r.last_ts)}${r.msg_count}
`}
` - : html`
${loading + : html`
+ ${!loading && tab === 'ledger' ? html`

+ ${summary ? html`Баланс ${rub(summary.balance_rub)} · внесено + ${rub(summary.deposited_rub)} · израсходовано ${rub(summary.charged_rub)}` + : 'Счёт не заведён'}

` : null} +
${loading ? html`<${Loading} rows={2} />` : rows.length === 0 ? html`

Пусто.

` - : html`
${JSON.stringify(rows.slice(0, 20), null, 2)}
`}
`} + : tab === 'ledger' ? html` + + ${rows.map((r) => html` + + + + `)}
ДатаСуммаПримечаниеКто
${when(r.ts)} 0 ? 'ok' : 'bad')}>${деньги(r.amount_kop)}${r.comment || '—'}${r.reverses + ? html`
снимает №${r.reverses}` : null}
${r.created_by || '—'}
` + : tab === 'files' ? html` + + ${rows.map((r) => html` + + `)}
ИмяРазмерИзменён
${r.name}${размер(r.size)}${when(r.mtime)}
` + : html` + + ${rows.map((r) => html` + + + `)}
КогдаКтоДействиеИтог
${when(r.timestamp)}${r.username || '—'}${r.action}
${[r.method, r.path].filter(Boolean).join(' ')}${r.detail ? ' · ' + r.detail : ''}
${r.status_code == null ? '—' : r.status_code}
`} +
`} `} `; } diff --git a/static/admin2/styles.css b/static/admin2/styles.css index 9a283e2..c7fa32e 100644 --- a/static/admin2/styles.css +++ b/static/admin2/styles.css @@ -67,22 +67,36 @@ tr.clickable{cursor:pointer} tr.clickable:hover td{background:#f3f6ff} по карточке, длинный вопрос переносится, дата и «Открыть» держат свою ширину. */ .drawer table{min-width:0;table-layout:fixed} .drawer th,.drawer td{white-space:normal;overflow-wrap:anywhere;vertical-align:top} -/* Ширины в пикселях, замеренные в браузере: дата «18.11.2026, 02:26:04» — 135 px, - шапка «Сообщений» — 79 px (обе + поля ячейки). В em нельзя: у шапки свой кегль, - и её 12 px давали колонкам на пятую часть меньше задуманного. */ -.drawer th:nth-child(1),.drawer td:nth-child(1){width:156px} -.drawer th:nth-child(2),.drawer td:nth-child(2){width:100px} -.drawer th:nth-child(4),.drawer td:nth-child(4){width:84px;white-space:nowrap} +/* Колонки диалогов — по замеру: дата «18.11.2026, 02:26:04» 135 px, шапка «Сообщений» + 79 px (обе с полями). В em нельзя: у шапки свой кегль 12 px. */ +.drawer table.dialogs th:nth-child(1),.drawer table.dialogs td:nth-child(1){width:156px} +.drawer table.dialogs th:nth-child(2),.drawer table.dialogs td:nth-child(2){width:100px} +.drawer table.dialogs th:nth-child(4),.drawer table.dialogs td:nth-child(4){width:84px;white-space:nowrap} +/* Счёт: примечание — самое важное, поэтому широкое; сумма держит знак и разряды. */ +.drawer table.ledger th:nth-child(1),.drawer table.ledger td:nth-child(1){width:156px} +.drawer table.ledger th:nth-child(2),.drawer table.ledger td:nth-child(2){width:120px} +.drawer table.ledger th:nth-child(4),.drawer table.ledger td:nth-child(4){width:160px} +.drawer table.files th:nth-child(2),.drawer table.files td:nth-child(2){width:90px} +.drawer table.files th:nth-child(3),.drawer table.files td:nth-child(3){width:156px} +.drawer table.history th:nth-child(1),.drawer table.history td:nth-child(1){width:156px} +.drawer table.history th:nth-child(2),.drawer table.history td:nth-child(2){width:160px} +.drawer table.history th:nth-child(4),.drawer table.history td:nth-child(4){width:70px} +.sub{color:var(--muted);font-size:11px} +.table-wrap > .note{padding:10px} @media(max-width:600px){ - /* На телефоне четыре колонки в строку не влезают: строка становится карточкой — - дата и «Открыть» сверху, вопрос под ними во всю ширину. */ .drawer table thead{display:none} - .drawer tbody tr{display:flex;flex-wrap:wrap;align-items:baseline;gap:2px 12px; + /* Диалоги: строка — карточка, дата и «Открыть» сверху, вопрос под ними во всю ширину. */ + .drawer table.dialogs tbody tr{display:flex;flex-wrap:wrap;align-items:baseline;gap:2px 12px; padding:8px 10px;border-bottom:1px solid var(--line)} - .drawer tbody tr:last-child{border-bottom:0} - .drawer tbody td{border:0;padding:0;width:auto!important} - .drawer tbody td:nth-child(3){flex:0 0 100%;order:3} - .drawer tbody td:nth-child(4){margin-left:auto;order:2} + .drawer table.dialogs tbody tr:last-child{border-bottom:0} + .drawer table.dialogs tbody td{border:0;padding:0;width:auto!important} + .drawer table.dialogs tbody td:nth-child(3){flex:0 0 100%;order:3} + .drawer table.dialogs tbody td:nth-child(4){margin-left:auto;order:2} + /* Остальные: каждое поле своей строкой — вбок ничего не уезжает. */ + .drawer table:not(.dialogs) tbody tr{display:block;padding:8px 10px; + border-bottom:1px solid var(--line)} + .drawer table:not(.dialogs) tbody tr:last-child{border-bottom:0} + .drawer table:not(.dialogs) tbody td{display:block;border:0;padding:1px 0;width:auto!important} } .drawer-head{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-bottom:8px} .drawer-head h2{margin:0;font-size:18px} diff --git a/static/changelog.json b/static/changelog.json index 09215a8..c6e5bf9 100644 --- a/static/changelog.json +++ b/static/changelog.json @@ -1,4 +1,11 @@ [ + { + "version": "2026-11-18f", + "date": "2026-11-18", + "changes": [ + "Карточка клиента: «Счёт», «Файлы» и «История» — таблицы вместо служебного текста: дата, сумма в рублях со знаком, примечание и кто внёс; баланс строкой над счётом; файлы с размером и датой; история с действием и кодом ответа" + ] + }, { "version": "2026-11-18e", "date": "2026-11-18", diff --git a/tests/test_admin_v2_customer_tabs.py b/tests/test_admin_v2_customer_tabs.py new file mode 100644 index 0000000..b0f9200 --- /dev/null +++ b/tests/test_admin_v2_customer_tabs.py @@ -0,0 +1,195 @@ +"""Карточка клиента: «Счёт», «Файлы», «История» — таблицы для человека, не служебный текст. + +Жалоба Хозяина 18.11.2026 (снимок экрана): вкладка «Счёт» показывала ответ сервера как +есть — amount_kop, created_by, ts и фигурные скобки. Оператору нужны дата, сумма в рублях +со знаком, примечание и кто внёс. «Файлы» и «История» были сделаны так же. + +Проверка ведёт настоящую страницу админки через стенд. +Мутации: вернуть
 → падает запрет служебного текста; показывать копейки
+числом → падает проверка суммы; убрать класс таблицы → падают заголовки.
+"""
+import http.server
+import json
+import re
+import socketserver
+import sys
+import threading
+from pathlib import Path
+from urllib.parse import urlparse
+
+import pytest
+
+ROOT = Path(__file__).resolve().parent.parent
+sys.path.insert(0, str(ROOT)); sys.path.insert(0, str(ROOT / "tests"))
+pytest.importorskip("playwright.sync_api", reason="playwright не установлен")
+from test_admin_design_ui import browser  # noqa: E402,F401
+
+CARD = {"profile": {"email": "anna@x", "deleted_at": None, "blocked": False,
+                    "read_only": False, "trial": False, "agent_access": True,
+                    "agent_provider": "claude", "role": "user"},
+        "account": {"balance_rub": 1975.09},
+        "activity": {"last_seen": 1793000000, "messages": 10, "files": 0,
+                     "files_capped": False}}
+
+LEDGER = {"entries": [
+    {"id": 6, "ts": 1794894194.744596, "amount_kop": 200000, "comment": None,
+     "created_by": "yuriii1@inbox.ru", "reverses": None},
+    {"id": 5, "ts": 1793874723.23, "amount_kop": 100000,
+     "comment": "Поручение Хозяина 05.11.2026", "created_by": "yuriii1@inbox.ru",
+     "reverses": None},
+    {"id": 4, "ts": 1792499747.51, "amount_kop": -50000, "comment": "Сторно ошибочного взноса",
+     "created_by": "yuriii1@inbox.ru", "reverses": 5},
+], "account": {"balance_kop": 197509, "balance_rub": 1975.09, "deposited_rub": 5000.0,
+               "charged_rub": 3024.91, "exhausted": False, "unpriced": 0}}
+
+FILES = [{"name": "смета_ЛСР_02-01-08.xlsx", "size": 48213, "mtime": 1793000000},
+         {"name": "вложения/КА.pdf", "size": 2411724, "mtime": 1792900000}]
+
+HISTORY = [{"id": 91, "timestamp": 1794894194.7, "username": "yuriii1@inbox.ru",
+            "action": "admin_deposit", "method": "POST", "path": "/api/admin/v2/customers/x/topup",
+            "detail": "+2000.00 ₽", "ip": "10.0.0.1", "status_code": 200},
+           {"id": 90, "timestamp": 1794894000.0, "username": "anna@x", "action": "login_fail",
+            "method": "POST", "path": "/api/login", "detail": "blocked", "ip": "10.0.0.2",
+            "status_code": 401}]
+
+
+class Handler(http.server.SimpleHTTPRequestHandler):
+    def __init__(self, *a, **kw):
+        super().__init__(*a, directory=str(ROOT), **kw)
+
+    def do_GET(self):
+        u = urlparse(self.path)
+        if u.path == "/api/admin/v2/customers":
+            return self._json({"items": [{"email": "anna@x", "raw_email": "anna@x",
+                                          "role": "user", "status": "active",
+                                          "last_seen": 1793000000, "spent_rub_24h": 0,
+                                          "balance_rub": 1975.09, "agent_access": True,
+                                          "agent_provider": "claude"}],
+                               "total": 1, "page": 1, "per_page": 50})
+        if u.path.endswith("/ledger"):
+            return self._json(LEDGER)
+        if u.path.endswith("/files"):
+            return self._json(FILES)
+        if u.path.endswith("/history"):
+            return self._json(HISTORY)
+        if u.path.startswith("/api/admin/v2/customers/"):
+            return self._json(CARD)
+        if u.path == "/api/admin/v2/ping":
+            return self._json({"ok": True})
+        if u.path == "/admin/v2" or u.path.startswith("/admin/v2/"):
+            data = (ROOT / "static/admin2/index.html").read_bytes()
+            self.send_response(200)
+            self.send_header("Content-Type", "text/html; charset=utf-8")
+            self.send_header("Content-Length", str(len(data)))
+            self.end_headers()
+            self.wfile.write(data); return
+        return super().do_GET()
+
+    def _json(self, obj):
+        data = json.dumps(obj).encode()
+        self.send_response(200)
+        self.send_header("Content-Type", "application/json")
+        self.send_header("Content-Length", str(len(data)))
+        self.end_headers()
+        self.wfile.write(data)
+
+    def log_message(self, *a):
+        return
+
+
+@pytest.fixture(scope="module")
+def site():
+    class Quiet(socketserver.ThreadingTCPServer):
+        allow_reuse_address = True
+        daemon_threads = True
+    srv = Quiet(("127.0.0.1", 0), Handler)
+    threading.Thread(target=srv.serve_forever, daemon=True).start()
+    yield f"http://127.0.0.1:{srv.server_address[1]}"
+    srv.shutdown()
+
+
+def _открыть_вкладку(page, site, вкладка):
+    page.add_init_script("localStorage.setItem('token','t')")
+    page.goto(site + "/admin/v2/customers")
+    page.wait_for_selector("tr.clickable")
+    page.locator("tr.clickable").first.click()
+    page.wait_for_selector(".drawer .tabs")
+    page.locator(".drawer button.tab", has_text=вкладка).click()
+    page.wait_for_selector(".drawer .table-wrap table tbody tr")
+
+
+def _нет_служебного_текста(page):
+    """Ответ сервера как есть (pre.json) — это не оформление для человека."""
+    assert page.locator(".drawer pre.json").count() == 0, (
+        "вкладка показывает служебный текст вместо таблицы: "
+        + page.locator(".drawer").inner_text()[:400])
+
+
+@pytest.mark.parametrize("width", (1400, 390))
+def test_счёт_таблица_с_рублями(browser, site, width):
+    page = browser.new_page(viewport={"width": width, "height": 900})
+    try:
+        _открыть_вкладку(page, site, "Счёт")
+        _нет_служебного_текста(page)
+        шапка = page.locator(".drawer table thead").inner_text()
+        for слово in ("Дата", "Сумма", "Примечание", "Кто"):
+            assert слово in шапка, f"нет столбца «{слово}» в шапке: {шапка!r}"
+        # В разрядах браузер ставит неразрывный пробел — сравниваем после выравнивания.
+        текст = page.locator(".drawer table tbody").inner_text().replace("\xa0", " ")
+        assert "+2 000,00 ₽" in текст, f"взнос не показан в рублях со знаком: {текст!r}"
+        assert "−500,00 ₽" in текст or "-500,00 ₽" in текст, (
+            f"списание не показано со знаком: {текст!r}")
+        assert "200000" not in текст and "100000" not in текст, (
+            f"в таблице копейки вместо рублей: {текст!r}")
+        assert re.search(r"\d{2}\.\d{2}\.\d{4}, \d{2}:\d{2}", текст), (
+            f"дата не в человеческом виде: {текст!r}")
+        assert "снимает №5" in текст, f"сторно не показано: {текст!r}"
+        assert "1 975,09 ₽" in page.locator(".drawer").inner_text().replace("\xa0", " "), (
+            "нет строки баланса")
+        данные = page.evaluate("""() => {
+            const w = document.querySelector('.drawer .table-wrap');
+            const cells = [...w.querySelectorAll('th,td')];
+            return {sw: w.scrollWidth, cw: w.clientWidth,
+                    порезано: cells.filter(c => c.scrollWidth > c.clientWidth + 1).length,
+                    страница: document.documentElement.scrollWidth > innerWidth};
+        }""")
+        assert данные["sw"] <= данные["cw"] + 1, f"таблица шире карточки ({width}): {данные}"
+        assert данные["порезано"] == 0, f"ячейки обрезаны ({width}): {данные}"
+        assert not данные["страница"], f"страница едет вбок ({width}): {данные}"
+    finally:
+        page.close()
+
+
+def test_файлы_таблица_с_размером(browser, site):
+    page = browser.new_page(viewport={"width": 1400, "height": 900})
+    try:
+        _открыть_вкладку(page, site, "Файлы")
+        _нет_служебного_текста(page)
+        шапка = page.locator(".drawer table thead").inner_text()
+        for слово in ("Имя", "Размер", "Изменён"):
+            assert слово in шапка, f"нет столбца «{слово}»: {шапка!r}"
+        текст = page.locator(".drawer table tbody").inner_text()
+        assert "смета_ЛСР_02-01-08.xlsx" in текст and "47 КБ" in текст, (
+            f"имя и размер не показаны: {текст!r}")
+        assert "2,3 МБ" in текст, f"большой файл не в мегабайтах: {текст!r}"
+        assert "48213" not in текст, f"размер показан в байтах: {текст!r}"
+    finally:
+        page.close()
+
+
+def test_история_таблица_с_действием(browser, site):
+    page = browser.new_page(viewport={"width": 1400, "height": 900})
+    try:
+        _открыть_вкладку(page, site, "История")
+        _нет_служебного_текста(page)
+        шапка = page.locator(".drawer table thead").inner_text()
+        for слово in ("Когда", "Кто", "Действие", "Итог"):
+            assert слово in шапка, f"нет столбца «{слово}»: {шапка!r}"
+        текст = page.locator(".drawer table tbody").inner_text()
+        assert "admin_deposit" in текст and "/api/admin/v2/customers/x/topup" in текст, (
+            f"действие и адрес не показаны: {текст!r}")
+        assert "401" in текст, f"код ответа не показан: {текст!r}"
+        assert re.search(r"\d{2}\.\d{2}\.\d{4}, \d{2}:\d{2}", текст), (
+            f"дата не в человеческом виде: {текст!r}")
+    finally:
+        page.close()