รายการเครื่องมือ (Tool List) - Test Cases
Overview
เอกสารนี้รวบรวมขั้นตอนการทดสอบสำหรับ Tool List Preparation workflow
ความต้องการพื้นฐาน
ระบบที่ต้องเปิดใช้งาน
| Component | URL/Port | Description |
|---|---|---|
| Temporal.io | localhost:7233 | Workflow engine |
| Backend API | localhost:5000 | .NET Web API |
| Frontend | localhost:4200 | Angular application |
Account ที่ต้องมี
จำเป็นต้องมี Account ในระบบให้ครบถ้วนอย่างน้อย 1 Account ในทุกบทบาท:
| Role | Thai Name | หน้าที่ใน Workflow |
|---|---|---|
| Contractor | ผู้รับเหมา | สร้างงานและกรอกรายการเครื่องมือ |
| Work Owner | เจ้าของงาน | ตรวจสอบและอนุมัติรายการ |
Test Cases
| Test Case | Description | Link |
|---|---|---|
| Test Case 1 | ส่งรายการเครื่องมือและอนุมัติ (Happy Path) | test-case-1.md |
Workflow States
Commands Reference
| State | Available Commands | Thai Name |
|---|---|---|
| PrepareToolList | SubmitToolList | ส่งรายการเครื่องมือ |
| PrepareToolList | Cancel | ยกเลิก |
| ReviewByWorkOwner | ApproveToolList | อนุมัติรายการ |
| ReviewByWorkOwner | RequestChange | ส่งกลับแก้ไข |
| ReviewByWorkOwner | RejectToolList | ปฏิเสธ |
New Features (2026-01-25)
Added in Service Report #010
Form Validation
- Empty tool list → Submit button disabled
- Orange warning banner shows "รายการเครื่องมืออย่างน้อย 1 รายการ"
- Add 1 tool → Submit button enabled, warning hidden
Duplicate Prevention
- Create Tool List for Project A → Success
- Create another Tool List for Project A → Error dialog shows existing task
- Click "Go to Existing Task" → Navigates to existing workflow
- Cancel existing Tool List → Create new one → Success
Email Notifications
- Contractor submits, SO approves → Contractor receives email
- Check smtp.iotserver.in.th for test emails
Date/Time Picker
- Set appointment date → No JavaScript errors
- Change date → Time is preserved
- Change time → Date is preserved
- Refresh page → Values persist
Verification Checklist
หลังทดสอบเสร็จสิ้น ตรวจสอบว่า:
- สร้างงานใหม่ได้สำเร็จ (state = PrepareToolList)
- ปุ่มคำสั่งแสดงตามสถานะและ role ถูกต้อง
- กรอกรายการเครื่องมือได้ (เพิ่ม/ลบแถว)
- ส่งรายการเครื่องมือได้ (state → ReviewByWorkOwner)
- เจ้าของงานเห็นงานใน My Tasks
- ฟอร์มล็อคเมื่ออยู่ในสถานะตรวจสอบ
- อนุมัติ/ปฏิเสธ/ส่งกลับแก้ไข ทำงานถูกต้อง
- Workflow diagram อัพเดทตาม state