{
  "task": "charts-test",
  "date": "2026-07-14",
  "scope": "/live page - every chart",
  "method": "Playwright screenshot + raw API JSON + value-by-value comparison",
  "testcases_total": 16,
  "testcases_pass": 15,
  "testcases_by_design": 1,
  "testcases_fail": 0,
  "testcases": [
    {"id": "TC1", "name": "Top KPIs (8 main + 7 sub)", "verdict": "PASS", "note": "8 main KPIs + 7 sub-metrics all match API to 0.01"},
    {"id": "TC2", "name": "Spend trend (7d bar+line)", "verdict": "PASS", "note": "7/7 daily values match exactly"},
    {"id": "TC3", "name": "Conversion Funnel", "verdict": "PASS", "note": "Stages + rates + transitions all match"},
    {"id": "TC4", "name": "Heatmap (Day × Spend)", "verdict": "PASS", "note": "7/7 day-of-week values match to 0.5"},
    {"id": "TC5", "name": "ROAS Distribution", "verdict": "PASS", "note": "Q1, Median, Q3, Max all match"},
    {"id": "TC6", "name": "Spend Concentration (80/20)", "verdict": "PASS", "note": "51.5% / 27.4% / 21.1% match API topRows"},
    {"id": "TC7", "name": "Gender donut", "verdict": "PASS", "note": "72.8% / 26.8% / 0.5% match API"},
    {"id": "TC8", "name": "Budget Pacing", "verdict": "PASS", "note": "13/31 days, ฿61/day, ฿1,891 forecast match"},
    {"id": "TC9", "name": "Forecast (สิ้นเดือน)", "verdict": "PASS", "note": "All 8 fields match exactly (616, 896, 359, 258, 10167, 16.50, 12, 371)"},
    {"id": "TC10", "name": "Reallocation Suggestion", "verdict": "PASS", "note": "Baseline + W/L count + Shift all match"},
    {"id": "TC11", "name": "Campaign Decision Winners/Losers", "verdict": "PASS", "note": "3+3 campaigns with same data"},
    {"id": "TC12", "name": "7-day ROAS Trend & Top Movers", "verdict": "PASS", "note": "1 campaign -100% WoW matches"},
    {"id": "TC13", "name": "แคมเปญเด่น (Winners)", "verdict": "PASS", "note": "3 campaigns with spend/chat/pur/ROAS all match"},
    {"id": "TC14", "name": "Anomaly Alerts", "verdict": "PASS", "note": "0 alerts as shown"},
    {"id": "TC15", "name": "Chat panel", "verdict": "PASS", "note": "4 conv, 6 msgs, 5 unread, 2/2 pages all match"},
    {"id": "TC16", "name": "Products/Trending/Budget Caps", "verdict": "BY_DESIGN", "note": "Admin-only endpoints (401) - login required shown"}
  ],
  "live_data_snapshot": {
    "spend_7d": 793.05,
    "revenue_7d": 58210,
    "purchases_7d": 30,
    "chats_7d": 78,
    "impressions_7d": 6792,
    "clicks_7d": 728,
    "roas_7d": 73.40,
    "campaigns_active": 3,
    "ad_accounts": 2,
    "chat_messages_db": 11,
    "chat_conversations_db": 4,
    "chat_unread_db": 5
  },
  "data_sources": {
    "main": "/public/live-dashboard (POST)",
    "trends": "/public/trends",
    "forecast": "/public/forecast",
    "campaign_detail": "/public/campaign-detail?campaignId=X",
    "chat": "/public/chats, /public/chat-inbox, /public/chat-stats"
  },
  "conclusion": "All 15 data-driven charts on /live show consistent UI ↔ API data. 3 admin cards require auth (by design)."
}
