JSA Preparation - Prototype Test
Manual test cases for the JSA (Job Safety Analysis) Preparation workflow.
Workflow Overview
prepare-jsa → review-by-safety-officer → completed/rejected/cancelled
Backend Entry Point
| Component | File |
|---|---|
| Router | SafetyApp.Workflows/WorkflowService.cs |
| Handler | SafetyApp.Workflows.JSAPreparation/JSAPreparationWorkflowService.cs |
| Workflow | SafetyApp.Workflows.JSAPreparation/JSAPreparationWorkflow.cs |
Flow: Task created → WorkflowService.ExecuteAsync() → routes by TaskTypeId → JSAPreparationWorkflowService.ExecuteAsync() → Temporal.io workflow execution
Test Case 1: Happy Path (Approve)
Objective: Verify the complete workflow from creation to approval.
Phase 1: Create Task (Contractor)
| Step | Action | Expected Result |
|---|---|---|
| 1 | Login as contractor1 | Login successful |
| 2 | Click "+" button in toolbar | Task type dialog opens |
| 3 | Select "จัดเตรียม JSA" (JSA Preparation) | Task created, opens in review page |
| 4 | Verify initial state | State: prepare-jsa, form editable |
| 5 | Verify toolbar buttons | Shows "ส่ง JSA" and "ยกเลิก" |
Phase 2: Prepare JSA (Contractor)
| Step | Action | Expected Result |
|---|---|---|
| 6 | Fill JSA form (job steps, hazards, controls) | Fields accept input |
| 7 | Click "ส่ง JSA" (Submit) | State changes to review-by-safety-officer |
| 8 | Verify form | Form becomes read-only (locked) |
Phase 3: Review and Approve (Safety Officer)
| Step | Action | Expected Result |
|---|---|---|
| 9 | Logout, login as safety | Login successful |
| 10 | Open task from "My Tasks" | Task opens |
| 11 | Verify toolbar options | Shows: "อนุมัติ JSA", "ส่งกลับแก้ไข", "ปฏิเสธ JSA" |
| 12 | Click "อนุมัติ JSA" (Approve) | State changes to completed |
| 13 | Verify final state | Task is read-only, state shows "เสร็จสิ้น" |
Test Case 2: Request Change (Send Back)
Objective: Verify Safety Officer can send task back for revision.
| Step | Action | Expected Result |
|---|---|---|
| 1-8 | Complete phases 1-2 (reach review-by-safety-officer) | At review state |
| 9 | Login as safety | Login successful |
| 10 | Click "ส่งกลับแก้ไข" (Request Change) | Comment dialog opens |
| 11 | Enter comment and confirm | State returns to prepare-jsa |
| 12 | Verify stepper | "จัดเตรียม JSA" step shows (2) badge |
| 13 | Login as contractor1 | Login successful |
| 14 | Make corrections, click "ส่ง JSA" | State changes to review-by-safety-officer |
| 15 | Verify stepper | "จป. ตรวจสอบ" step shows (2) badge |
Test Case 3: Reject
Objective: Verify Safety Officer can reject the JSA.
| Step | Action | Expected Result |
|---|---|---|
| 1-8 | Complete phases 1-2 (reach review-by-safety-officer) | At review state |
| 9 | Login as safety | Login successful |
| 10 | Click "ปฏิเสธ JSA" (Reject) | Comment dialog opens |
| 11 | Enter reason and confirm | State changes to rejected |
| 12 | Verify final state | Task is read-only, state shows "ปฏิเสธ" |
Test Case 4: Cancel
Objective: Verify task can be cancelled from initial state.
| Step | Action | Expected Result |
|---|---|---|
| 1 | Login as contractor1 | Login successful |
| 2 | Create new JSA Preparation task | Task created |
| 3 | Click "ยกเลิก" (Cancel) | Confirmation dialog appears |
| 4 | Confirm cancellation | State changes to cancelled |
| 5 | Verify final state | Task is read-only |
UI Verification Checklist
| Component | Check | Expected |
|---|---|---|
| Workflow Tab | Title | Shows "จัดเตรียม JSA" |
| Workflow Tab | Stepper | Shows correct states |
| Workflow Tab | Visit Count | Shows "(N)" badge when state visited N > 1 times |
| Toolbar | State Label | Shows correct Thai text per state |
| Toolbar | Commands | Correct buttons per state |
| Form | Permissions | Correct lock/unlock per state |
State-Command Reference
| State | Thai Label | Commands Available |
|---|---|---|
prepare-jsa | จัดเตรียม JSA | ส่ง JSA, ยกเลิก |
review-by-safety-officer | จป. ตรวจสอบ | อนุมัติ JSA, ส่งกลับแก้ไข, ปฏิเสธ JSA |
completed | เสร็จสิ้น | (none - terminal) |
rejected | ปฏิเสธ | (none - terminal) |
cancelled | ยกเลิก | (none - terminal) |
Sign-off
| Role | Name | Date | Signature |
|---|---|---|---|
| Tester | |||
| Developer |