Skip to main content

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

ComponentFile
RouterSafetyApp.Workflows/WorkflowService.cs
HandlerSafetyApp.Workflows.JSAPreparation/JSAPreparationWorkflowService.cs
WorkflowSafetyApp.Workflows.JSAPreparation/JSAPreparationWorkflow.cs

Flow: Task created → WorkflowService.ExecuteAsync() → routes by TaskTypeIdJSAPreparationWorkflowService.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)

StepActionExpected Result
1Login as contractor1Login successful
2Click "+" button in toolbarTask type dialog opens
3Select "จัดเตรียม JSA" (JSA Preparation)Task created, opens in review page
4Verify initial stateState: prepare-jsa, form editable
5Verify toolbar buttonsShows "ส่ง JSA" and "ยกเลิก"

Phase 2: Prepare JSA (Contractor)

StepActionExpected Result
6Fill JSA form (job steps, hazards, controls)Fields accept input
7Click "ส่ง JSA" (Submit)State changes to review-by-safety-officer
8Verify formForm becomes read-only (locked)

Phase 3: Review and Approve (Safety Officer)

StepActionExpected Result
9Logout, login as safetyLogin successful
10Open task from "My Tasks"Task opens
11Verify toolbar optionsShows: "อนุมัติ JSA", "ส่งกลับแก้ไข", "ปฏิเสธ JSA"
12Click "อนุมัติ JSA" (Approve)State changes to completed
13Verify final stateTask is read-only, state shows "เสร็จสิ้น"

Test Case 2: Request Change (Send Back)

Objective: Verify Safety Officer can send task back for revision.

StepActionExpected Result
1-8Complete phases 1-2 (reach review-by-safety-officer)At review state
9Login as safetyLogin successful
10Click "ส่งกลับแก้ไข" (Request Change)Comment dialog opens
11Enter comment and confirmState returns to prepare-jsa
12Verify stepper"จัดเตรียม JSA" step shows (2) badge
13Login as contractor1Login successful
14Make corrections, click "ส่ง JSA"State changes to review-by-safety-officer
15Verify stepper"จป. ตรวจสอบ" step shows (2) badge

Test Case 3: Reject

Objective: Verify Safety Officer can reject the JSA.

StepActionExpected Result
1-8Complete phases 1-2 (reach review-by-safety-officer)At review state
9Login as safetyLogin successful
10Click "ปฏิเสธ JSA" (Reject)Comment dialog opens
11Enter reason and confirmState changes to rejected
12Verify final stateTask is read-only, state shows "ปฏิเสธ"

Test Case 4: Cancel

Objective: Verify task can be cancelled from initial state.

StepActionExpected Result
1Login as contractor1Login successful
2Create new JSA Preparation taskTask created
3Click "ยกเลิก" (Cancel)Confirmation dialog appears
4Confirm cancellationState changes to cancelled
5Verify final stateTask is read-only

UI Verification Checklist

ComponentCheckExpected
Workflow TabTitleShows "จัดเตรียม JSA"
Workflow TabStepperShows correct states
Workflow TabVisit CountShows "(N)" badge when state visited N > 1 times
ToolbarState LabelShows correct Thai text per state
ToolbarCommandsCorrect buttons per state
FormPermissionsCorrect lock/unlock per state

State-Command Reference

StateThai LabelCommands Available
prepare-jsaจัดเตรียม JSAส่ง JSA, ยกเลิก
review-by-safety-officerจป. ตรวจสอบอนุมัติ JSA, ส่งกลับแก้ไข, ปฏิเสธ JSA
completedเสร็จสิ้น(none - terminal)
rejectedปฏิเสธ(none - terminal)
cancelledยกเลิก(none - terminal)

Sign-off

RoleNameDateSignature
Tester
Developer