feat(админка): состояния costs, metrics и finance
This commit is contained in:
@@ -110,7 +110,14 @@ DATA = {
|
||||
"people": 11},
|
||||
{"month": "2026-09", "revenue_rub": None, "refunded_rub": None, "payers": 0,
|
||||
"cost_rub": 402.1, "charged_rub": 482.5, "profit_rub": None, "requests": 232,
|
||||
"people": 8}], "note": "поступлений пока нет"},
|
||||
"people": 8}],
|
||||
"totals": {"revenue_rub": 0.0, "refunded_rub": 0.0, "cost_rub": 1606.6,
|
||||
"profit_rub": None, "flow_rub": None, "margin_share": None,
|
||||
"flow_share": None, "accounts_total_rub": 2400.0,
|
||||
"accounts_count": 1, "topups_included": False, "payers": 0,
|
||||
"people": 14, "requests": 612, "unpriced": 2,
|
||||
"revenue_per_payer": None, "cost_per_person": 114.76},
|
||||
"note": "поступлений пока нет"},
|
||||
"/api/admin/payments": {"payments": [
|
||||
{"ts": 1757100000, "username": "zakaz@smetashop.pro", "product": "Месяц",
|
||||
"amount_rub": 990, "status": "succeeded", "yk_payment_id": "2f1c-9a"}]},
|
||||
|
||||
@@ -93,11 +93,32 @@ def test_audit_retry_clears_error_row(browser, site):
|
||||
page.close()
|
||||
|
||||
|
||||
def test_costs_error_has_retry(browser, site):
|
||||
page = _open(browser, site, "/api/admin/costs")
|
||||
page.wait_for_timeout(500)
|
||||
assert "Не удалось построить отчёт" in page.locator("#costs-window").inner_text()
|
||||
assert page.locator("#costs-window button", has_text="Повторить").count() == 1
|
||||
assert page.locator("#costs-updated").inner_text() == "ошибка загрузки"
|
||||
page.close()
|
||||
|
||||
|
||||
def test_metrics_error_has_retry(browser, site):
|
||||
page = _open(browser, site, "/api/admin/metrics")
|
||||
page.wait_for_timeout(500)
|
||||
assert "Не удалось получить метрики" in page.locator("#mx-note").inner_text()
|
||||
assert page.locator("#mx-note button", has_text="Повторить").count() == 1
|
||||
assert page.locator("#mx-updated").inner_text() == "ошибка загрузки"
|
||||
page.close()
|
||||
|
||||
|
||||
def test_loaded_tables_show_freshness(browser, site):
|
||||
page = browser.new_page()
|
||||
page.goto(site)
|
||||
page.wait_for_timeout(1200)
|
||||
assert "обновлено" in page.locator("#payments-updated").inner_text()
|
||||
assert "обновлено" in page.locator("#costs-updated").inner_text()
|
||||
assert "обновлено" in page.locator("#mx-updated").inner_text()
|
||||
assert "обновлено" in page.locator("#fin-updated").inner_text()
|
||||
page.evaluate("showPage('audit')")
|
||||
page.wait_for_timeout(400)
|
||||
assert "обновлено" in page.locator("#audit-updated").inner_text()
|
||||
|
||||
Reference in New Issue
Block a user