ทดสอบ smoke ของ Portal
รันหลังแก้ portal UI (docs/.vitepress/theme/) หรือ gateway REST ที่ portal ใช้
สิ่งที่ต้องมีก่อน
- Login แล้ว (
gw_access_tokenใน browser) npm run docs:stack(docs:5173+ API:3001) หรือ remote gateway ผ่านGATEWAY_PROXY_TARGET
bash
npm run theme:test
npm run test:aggregate
npm run portal:smoke # HTTP 200 + HTML fragments (ต้อง docs:stack)Checklist E2E product chat (ฟอร์ม inline → submit → ผล job): Product chat E2E (login แล้ว, docs:stack)
Overview (/th/app/)
- [ ] Hero: Open Playground, Activity, Copy token
- [ ] Usage widget (7 วัน) โหลด; งานล่าสุดคลิกได้ → Explore + job modal
- [ ] การ์ด Workspace: Activity, Access token, Credits, BYOK, Files, Observability
- [ ] credits pill ใน header / sidebar →
/th/app/credits/ - [ ] Resources: Quickstart, MCP, Authentication, Portal smoke test (หน้านี้)
Playground (/th/app/playground/)
Immersive embed — ไม่มี app sidebar/header ดู API Playground (redirect มาที่นี่)
- [ ] Overview hero Open Playground →
/th/app/playground/ - [ ] Iframe โหลด (default worker Create image); ไม่มี loading spinner ไม่จบ
- [ ] Login แล้ว → playground รับ token (Connection OK / list models ได้)
- [ ] List models → เลือโมเดล catalog + ratio จาก list (ไม่เดา)
- [ ] Image job ติ๊ก wait →
resultUrlใน response / preview - [ ] หลัง SUCCESS สลับ REQUEST / ENDPOINTS / AI GUIDE — tab คงอยู่ (poll ไม่แย่ง RESULT)
- [ ] URL อัปเดตเมื่อสลับ worker (
?worker=create-videoฯลฯ) - [ ] Deep link จาก Models ปุ่ม Playground →
?model=กรอกล่วงหน้า - [ ] Optional: Observability Local mirror เปิด → แถว job ปรากฏหลังรัน
Chat (/th/app/chat/)
- [ ] Low-credit banner เมื่อยอด < threshold
- [ ] BYOK hint เมื่อ gateway มี mapped chat models — ลิงก์ Open BYOK
- [ ] Hint อัปเดตเมื่อเลือโมเดล BYOK-mapped (พร้อม provider key ที่บันทึก)
- [ ] Model picker แสดง badge BYOK บน mapped models
Product mode (ค่าเริ่มต้น) — checklist เต็ม: Product chat E2E. สรุป:
- [ ] Intent media → inline job + API details + quick actions
- [ ] Intent support (credit / affiliate) → chips ไม่มี inline job form
- [ ]
POST /gateway/chatมีmediaModelContext.account - [ ] อัตโนมัติ (mock):
npm run portal:browser:test -- tests/browser/chat-product-inline.spec.ts tests/browser/chat-product-intents.spec.ts
Activity (/th/app/activity/)
ดู Activity hub สำหรับ URL params ผ่านเร็ว:
- [ ] Overview → period, Refresh, Export CSV, Usage by type → Explore
- [ ] Top models → Explore
?model=; cache tooltip; job modal?job=ต่อแถว - [ ] Explore → filters, Load more, Clear all filters
- [ ] Billing → ลิงก์คง
?period=
Access token (/th/app/token/)
- [ ] Tab curl (Gommo) or MCP (Gommo) snippet; Copy token; ข้อความ Test connection สำเร็จ
- [ ] ลิงก์ last activity → Activity Explore (เมื่อมี jobs)
Files (/th/app/files/)
- [ ] Upload → ข้อความสำเร็จ; Recent uploads คงหลัง reload
- [ ] Copy URL / Copy fields
BYOK (/th/app/byok/)
ดู BYOK reference และ BYOK production checklist ผ่านเร็ว:
- [ ] Save key → ข้อความเขียว (ไม่ flash ทั้งหน้า; Refreshing… เท่านั้น)
- [ ] Test / Delete พร้อม confirm
- [ ] Usage tab → ลิงก์ Activity; event badges เมื่อ chat BYOK รันแล้ว
Observability (/th/app/observability/)
ดู Observability reference ผ่านเร็ว:
- [ ] Stat cards → Activity / Credits
- [ ] Webhook add, test, delete; payload Copy JSON
- [ ]
wait: falseasync job + webhook → delivery หลัง background poll (data.background: true) - [ ] Optional live:
npm run observability:verify-background— ดู Observability reference
Credits (/th/app/credits/)
ดู Billing & credits ผ่านเร็ว:
- [ ] Low-balance banner เมื่อ credits < threshold
- [ ] KPI row: balance, total topped up, order count, last order
- [ ] Quick links → Activity Billing, Job logs, Overview, Billing docs
- [ ] Package grid: featured accent, อื่น primary; checkout modal
- [ ] Top-up history table; stale pending toggle; header Refresh reload packages + orders
Profile (/th/app/profile/)
- [ ] Usage pill 7d; ลิงก์ไป Activity period เดียวกัน
- [ ] Recent jobs → Explore job modal
Automated
bash
npm run theme:test # URL helpers, usage normalize
npm run test:aggregate # usage aggregate cache (Activity Overview)
npm run portal:smoke # route + fragment checks (docs :5173 + API :3001)
node scripts/verify-request-tab.mjs # Playground response tab pin (ต้อง docs:stack)
npm run observability:verify-background # live async job + webhook (ต้อง token ใน .env)