Skip to main content

Work Permit - Prototype Test

Manual test cases for the Work Permit workflow.


Workflow Overview

fill-in-permit-request → review-by-safety-officer → completed/rejected/cancelled

Backend Entry Point

ComponentFile
RouterSafetyApp.Workflows/WorkflowService.cs
HandlerSafetyApp.Workflows/SimpleWorkflowService.cs
DefinitionSafetyApp.WebApi/assets/data/simple-workflows/work-permit.json

Flow: Task created → WorkflowService.ExecuteAsync() → routes by TaskTypeIdSimpleWorkflowService.ExecuteAsync() → initializes state from JSON definition


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 "ใบขออนุญาตปฏิบัติงาน" (Work Permit)Task created, opens in review page
4Verify initial stateState: fill-in-permit-request, form editable
5Verify toolbar buttonsShows "ส่งใบขออนุญาต" and "ยกเลิก"

Phase 2: Fill Permit Request (Contractor)

StepActionExpected Result
6Fill work permit form fieldsFields accept input
7Click "ส่งใบขออนุญาต" (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: "อนุมัติใบขออนุญาต", "ส่งกลับแก้ไข", "ปฏิเสธใบขออนุญาต"
12Click "อนุมัติใบขออนุญาต" (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 fill-in-permit-request
12Verify stepper"กรอกใบขออนุญาต" step shows (2) badge
13Login as contractor1Login successful
14Make corrections, click "ส่งใบขออนุญาต"State changes to review-by-safety-officer
15Verify stepper"จป. ตรวจสอบ" step shows (2) badge

Test Case 3: Reject

Objective: Verify Safety Officer can reject the permit request.

StepActionExpected Result
1-8Complete phases 1-2 (reach review-by-safety-officer)At review state
9Login as safetyLogin successful
10Click "ปฏิเสธใบขออนุญาต" (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 Work Permit taskTask created
3Click "ยกเลิก" (Cancel)Confirmation dialog appears
4Confirm cancellationState changes to cancelled
5Verify final stateTask is read-only

UI Verification Checklist

ComponentCheckExpected
Workflow TabTitleShows "ใบขออนุญาตปฏิบัติงาน"
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
fill-in-permit-requestกรอกใบขออนุญาตส่งใบขออนุญาต, ยกเลิก
review-by-safety-officerจป. ตรวจสอบอนุมัติใบขออนุญาต, ส่งกลับแก้ไข, ปฏิเสธใบขออนุญาต
completedเสร็จสิ้น(none - terminal)
rejectedปฏิเสธ(none - terminal)
cancelledยกเลิก(none - terminal)

Sign-off

RoleNameDateSignature
Tester
Developer