Skip to main content

Frontend Test Cases: Training Enrollment

Revision 1.0 (2026-01-23) - Consolidated from Service Report #008 (MoM 2026-01-16)

Source: Service Report #008


Test Accounts

RoleEmailPassword
Safety Officersafety-supervisor@outlook.comTest1234*
Contractorsafety-contractor1-0@outlook.comTest1234*

1. Form Validation

TC-TE-001: Submit button disabled without session

Precondition: Contractor opens Training Enrollment task

StepActionExpected
1Open Training Enrollment task with no session selectedSubmit button disabled
2Verify validation banner shows"รอบอบรม" error visible

TC-TE-002: Submit button disabled without workers

StepActionExpected
1Select a session but no workersSubmit button still disabled
2Verify validation banner"ผู้อบรม (อย่างน้อย 1 คน)" error visible

TC-TE-003: Submit button enabled with valid data

StepActionExpected
1Select session AND at least 1 workerSubmit button enabled
2Validation banner disappearsNo error messages

TC-TE-004: Validation error messages display correctly

StepActionExpected
1Open form with no dataOrange validation banner visible
2Check error listClear Thai/English messages for each missing field

TC-TE-005: SO approval requires at least 1 worker

Precondition: SO reviewing enrollment task

StepActionExpected
1Deselect all workersApprove button disabled
2Verify validation message"ต้องเลือกผู้อบรมอย่างน้อย 1 คนเพื่ออนุมัติ"

TC-TE-006: ValidationRequired on Submit command

StepActionExpected
1Leave form empty"ส่งรายชื่อผู้อบรม" button is disabled
2Fill valid dataButton becomes enabled
3"ยกเลิก" buttonAlways enabled (no validation required)

2. Auto-Navigation

TC-TE-007: Contractor auto-opens form

Precondition: Contractor opens Training Enrollment task in FillInTrainingList state

StepActionExpected
1Open the taskForm opens automatically (not document list)
2Verify form is editableSession dropdown and worker list are interactive

TC-TE-008: SO auto-opens form in review

Precondition: SO opens Training Enrollment task in ReviewBySafetyOfficer state

StepActionExpected
1Open the taskForm opens automatically
2Verify form is in review modeWorker checkboxes visible for partial approval

TC-TE-009: Document list is bypassed

StepActionExpected
1Open task as Contractor or SODocument list is NOT shown first
2Form is displayed directlyNo extra click required

3. Document View Gating

TC-TE-010: Commands hidden on document list

Precondition: SO opens task (if auto-nav is disabled or navigates back)

StepActionExpected
1View document listCommand buttons (อนุมัติ, ปฏิเสธ, etc.) are HIDDEN

TC-TE-011: Commands appear on document form

StepActionExpected
1Open document formCommand buttons APPEAR in toolbar

TC-TE-012: Commands hide on back navigation

StepActionExpected
1From form, click Back to document listCommand buttons HIDE again

TC-TE-013: Cross-workflow gating works

StepActionExpected
1Check other workflow tasks (PR, JSA, Tool List)Same gating behavior applies

4. Block Duplicate Enrollment

TC-TE-014: Create enrollment with no pending task

Precondition: Contractor has no pending enrollment tasks

StepActionExpected
1Create Training Enrollment taskTask created successfully

TC-TE-015: Block second enrollment while pending

Precondition: Contractor has a pending enrollment task (awaiting SO review)

StepActionExpected
1Try to create another Training EnrollmentError message shown
2Verify error text"คุณมีรายการส่งรายชื่อผู้อบรมที่รอการอนุมัติอยู่แล้ว..."

TC-TE-016: Create enrollment after approval/rejection

Precondition: Previous enrollment has been approved, rejected, or cancelled

StepActionExpected
1Create new Training EnrollmentTask created successfully

5. Partial Approval

TC-TE-017: SO sees checkboxes in review state

Precondition: SO opens enrollment in ReviewBySafetyOfficer state

StepActionExpected
1Open formWorker checkboxes visible
2Workers with issuesRed background, checkbox disabled

TC-TE-018: Blocked workers cannot be selected

StepActionExpected
1Find blacklisted workerRed background, checkbox disabled
2Find already-enrolled workerRed background, checkbox disabled
3Try clicking disabled checkboxNothing happens

TC-TE-019: SO deselects workers and approves

StepActionExpected
1Deselect some workers (uncheck)Workers removed from selection
2Click "อนุมัติรายชื่อ"Only selected workers are enrolled
3Verify attendance recordsOnly for selected workers

TC-TE-020: Approve button disabled with no selection

StepActionExpected
1Deselect ALL workersApprove button disabled
2Re-select at least 1Approve button enabled

TC-TE-021: Validation error when none selected

StepActionExpected
1Deselect all workersValidation message appears
2Verify message"ต้องเลือกผู้อบรมอย่างน้อย 1 คนเพื่ออนุมัติ"

6. Training Attendance Verification

TC-TE-022: Passed worker shows green background

StepActionExpected
1Find worker with TrainingStatus = PassedRow has green background (bg-green-50)
2Worker is selectableCheckbox enabled

TC-TE-023: Passed worker with enrollment shows red

StepActionExpected
1Find passed worker already enrolled in THIS sessionRow has red background
2Checkbox disabledCannot select

TC-TE-024: Passed but blacklisted shows red

StepActionExpected
1Find passed worker who is blacklistedRow has red background
2Checkbox disabledCannot select

TC-TE-025: Expired worker with missing docs shows red

StepActionExpected
1Find worker with Expired status + missing documentsRed background, blocked

TC-TE-026: None status with valid docs is selectable

StepActionExpected
1Find worker with None status + all documentsNo colored background
2Checkbox enabledCan select

TC-TE-027: Tooltip on passed worker

StepActionExpected
1Hover over passed worker's validation iconTooltip: "ผ่านการอบรมแล้ว - สามารถลงทะเบียนอบรมทบทวนได้"

7. Worker Selection Dialog

TC-TE-028: Dialog opens with default filter

StepActionExpected
1Click "จัดการรายชื่อ"Dialog opens
2Verify default chip selected"ยังไม่ได้อบรม" chip active

TC-TE-029: Search by name or ID

StepActionExpected
1Type worker name in searchList filters by name
2Type ID card numberList filters by ID

TC-TE-030: Filter by training status chips

StepActionExpected
1Click "ผ่าน" chipOnly passed workers shown, all disabled
2Click "รอการอบรม" chipOnly pending workers, all disabled
3Click "ยังไม่ได้อบรม" chipNot-trained workers, selectable

TC-TE-031: Deselect chip shows all

StepActionExpected
1Click active chip againChip deselected, all workers shown

TC-TE-032: Select All only selects eligible

StepActionExpected
1Show all workers (deselect filter)Mix of enabled/disabled
2Click "เลือกทั้งหมด"Only eligible workers selected
3Disabled workers remain uncheckedPassed/Pending/Blacklisted not selected

TC-TE-033: Blacklisted worker shows red badge

StepActionExpected
1Find blacklisted workerRed badge visible
2Row is grayed outCannot select

TC-TE-034: Clicking disabled worker does nothing

StepActionExpected
1Click on a disabled worker rowNo selection change

TC-TE-035: Confirm adds workers to form

StepActionExpected
1Select multiple workersCheckboxes checked
2Click "ยืนยันรายชื่อ (N)"Dialog closes
3Verify formWorkers added to worker list table

TC-TE-036: Confirm button shows count

StepActionExpected
1Select 3 workersButton shows "ยืนยันรายชื่อ (3)"
2Select 5 workersButton shows "ยืนยันรายชื่อ (5)"

8. Training Info Quick Enroll

TC-TE-037: Register button visible for Contractor

Precondition: Login as Contractor

StepActionExpected
1Open Training Info (เครื่องมือ > ข้อมูลการอบรม)Page loads
2Find Open session"ลงทะเบียน" button visible

TC-TE-038: Progress bar during creation

StepActionExpected
1Click "ลงทะเบียน"Progress bar appears below navbar

TC-TE-039: Success toast and redirect

StepActionExpected
1Wait for task creationGreen toast: "สร้างงานส่งรายชื่อผู้อบรมสำเร็จ"
2Verify navigationRedirected to Task Review page for new task

TC-TE-040: Register column hidden for SO

Precondition: Login as Safety Officer

StepActionExpected
1Open Training Info page"ลงทะเบียน" column NOT visible

TC-TE-041: Button hidden for expired session

StepActionExpected
1Find expired session"ลงทะเบียน" button NOT shown

TC-TE-042: Button hidden for closed/full session

StepActionExpected
1Find closed or full session"ลงทะเบียน" button NOT shown

9. Inbox Notifications

TC-TE-043: SO receives notification on submit

Precondition: Contractor submits enrollment

StepActionExpected
1Contractor submits training listTask moves to ReviewBySafetyOfficer
2Login as SOBell icon shows unread count
3Click bellNotification about new enrollment visible

TC-TE-044: Contractor receives notification on approve

StepActionExpected
1SO approves enrollmentTask completed
2Login as ContractorBell icon shows unread count
3Check notificationApproval notification visible

TC-TE-045: Contractor receives notification on reject

StepActionExpected
1SO rejects enrollmentTask rejected
2Login as ContractorRejection notification visible

TC-TE-046: Click notification navigates to task

StepActionExpected
1Click on a notificationNavigate to related task review page

TC-TE-047: Mark notifications as read

StepActionExpected
1Open inbox pageNotifications listed
2Select notifications → Mark as readBadge count decreases

TC-TE-048: Archive notifications

StepActionExpected
1Select notifications → ArchiveNotifications removed from list

TC-TE-049: Bell icon shows correct count

StepActionExpected
1Check bell iconShows unread notification count
2Mark all as readBadge disappears or shows 0

TC-TE-050: Notification on request change

StepActionExpected
1SO sends back for changesTask returns to FillInTrainingList
2Login as ContractorNotification about changes needed

Summary

CategoryTest CasesCount
1. Form ValidationTC-TE-001 to 0066
2. Auto-NavigationTC-TE-007 to 0093
3. Document View GatingTC-TE-010 to 0134
4. Block Duplicate EnrollmentTC-TE-014 to 0163
5. Partial ApprovalTC-TE-017 to 0215
6. Training Attendance VerificationTC-TE-022 to 0276
7. Worker Selection DialogTC-TE-028 to 0369
8. Training Info Quick EnrollTC-TE-037 to 0426
9. Inbox NotificationsTC-TE-043 to 0508
Total50