Contractor Management - Frontend Manual Test Cases
Test Environment: http://localhost:4200 [or test server URL]
Tester: _______________
Date: _______________
Prerequisites
- Backend server running on
http://localhost:5000 - Frontend running on
http://localhost:4200 - Test accounts available (see Test Data section)
- Modern browser (Chrome recommended)
- At least one contractor exists in the system
Test Data
Test Users
| Role | Password | Access Level | |
|---|---|---|---|
| Admin (Tenant Administrator) | tn@thaiscada.com [or your admin email] | Test1234* | Full access - can manage contractors |
| Work Owner | safety-owner@outlook.com [or your work owner email] | Test1234* | Full access - has contractor-mgmt role |
| Contractor | safety-contractor1-0@outlook.com [or your contractor email] | Test1234* | View only - can see list, cannot edit |
| Purchasing | safety-purchasing@outlook.com [or your purchasing email] | Test1234* | View only - no contractor-mgmt role |
Test Data for Editing Contractors
| Field | Value |
|---|---|
| Company Name (Thai) | บริษัท ทดสอบผู้รับเหมา จำกัด [or your test name] |
| Company Name (English) | Test Contractor Co., Ltd. [or your test name] |
| Address | 123 ถนนทดสอบ แขวงจตุจักร เขตจตุจักร กรุงเทพฯ 10900 [or your address] |
| Mobile Number | 081-999-8888 [or your test phone] |
contact@test-contractor.com [or your test email] | |
| Website | https://test-contractor.com [or your website] |
| Contact Person | นายทดสอบ ผู้รับเหมา [or your contact name] |
Navigation Path
Admin/WorkOwner: กำหนดค่า (Settings) → ผู้รับเหมา (Contractors)
URL: /tools/settings/contractor
Test Summary
| Category | Total | Dev | QA |
|---|---|---|---|
| 1. Navigation & Access | 4 | ||
| 2. View Contractor List | 3 | ||
| 3. View Contractor Details | 3 | ||
| 4. Edit Contractor | 4 | ||
| 5. Set/Unset Default | 3 | ||
| 6. Delete Contractor | 3 | ||
| Total | 20 |
1. Navigation & Access Tests
TC-CON-M001: Admin can access contractor management
Precondition: User is logged in as Tenant Administrator
| Step | Action | Expected Result | Dev | QA |
|---|---|---|---|---|
| 1 | Click "กำหนดค่า" (Settings) menu in header | Settings dropdown menu opens | [ ] | [ ] |
| 2 | Locate "ผู้รับเหมา" (Contractors) menu item | Menu item visible | [ ] | [ ] |
| 3 | Click "ผู้รับเหมา" (Contractors) | Page loads | [ ] | [ ] |
| 4 | Verify URL | URL is /tools/settings/contractor | [ ] | [ ] |
| 5 | Verify page content | Contractor list table displayed | [ ] | [ ] |
[Screenshot: กำหนดค่า menu with ผู้รับเหมา option] [Screenshot: Contractor Management page with list]
Notes: _______________
TC-CON-M002: Work Owner can access contractor management
Precondition: User is logged in as Work Owner role
| Step | Action | Expected Result | Dev | QA |
|---|---|---|---|---|
| 1 | Login as Work Owner: safety-owner@outlook.com | Login successful | [ ] | [ ] |
| 2 | Navigate to กำหนดค่า → ผู้รับเหมา | Contractor management page loads | [ ] | [ ] |
| 3 | Verify URL | URL is /tools/settings/contractor | [ ] | [ ] |
| 4 | Verify contractor list displayed | Table with contractors visible | [ ] | [ ] |
| 5 | Verify edit functionality available | "กำหนดค่า" buttons visible on each row | [ ] | [ ] |
[Screenshot: Work Owner contractor management view]
Notes: Work Owner has same access as Admin for contractor management (contractor-mgmt role)
TC-CON-M003: Contractor user can view but not edit
Precondition: User is logged in as Contractor role
| Step | Action | Expected Result | Dev | QA |
|---|---|---|---|---|
| 1 | Login as Contractor: safety-contractor1-0@outlook.com | Login successful, redirected to my-tasks | [ ] | [ ] |
| 2 | Navigate to กำหนดค่า → ผู้รับเหมา | Contractor list page loads | [ ] | [ ] |
| 3 | Verify contractor list visible | Table displays contractors (search uses realm-basic) | [ ] | [ ] |
| 4 | Check for "กำหนดค่า" (Edit) buttons | Edit buttons should NOT be visible | [ ] | [ ] |
| 5 | Check for options menu | Row options (set default, delete) should NOT be visible | [ ] | [ ] |
[Screenshot: Contractor user view - list only, no edit buttons]
Notes: Contractor users can view the list but cannot edit due to missing contractor-mgmt role
TC-CON-M004: Purchasing user can view but not edit
Precondition: User is logged in as Purchasing role
| Step | Action | Expected Result | Dev | QA |
|---|---|---|---|---|
| 1 | Login as Purchasing: safety-purchasing@outlook.com | Login successful | [ ] | [ ] |
| 2 | Navigate to กำหนดค่า → ผู้รับเหมา | Contractor list page loads | [ ] | [ ] |
| 3 | Verify contractor list visible | Table displays contractors | [ ] | [ ] |
| 4 | Check for "กำหนดค่า" (Edit) buttons | Edit buttons should NOT be visible | [ ] | [ ] |
| 5 | Check for options menu | Row options should NOT be visible | [ ] | [ ] |
[Screenshot: Purchasing user view - list only]
Notes: Purchasing role does NOT have contractor-mgmt permission
2. View Contractor List Tests
TC-CON-M005: View contractor list with table columns
Precondition: Logged in as Admin, on Contractor Management page
| Step | Action | Expected Result | Dev | QA |
|---|---|---|---|---|
| 1 | Navigate to Contractor Management page | Page loads with contractor list | [ ] | [ ] |
| 2 | Verify table headers | Columns include: ชื่อบริษัท, หัวหน้าคุมงาน (Supervisor), ค่าเริ่มต้น (Default), Actions | [ ] | [ ] |
| 3 | Verify contractor rows | Each row shows company name, supervisor count, default indicator | [ ] | [ ] |
| 4 | Verify row actions | Each row has "กำหนดค่า" button and options menu (expand_more icon) | [ ] | [ ] |
| 5 | Verify contractor count | Number of contractors matches database | [ ] | [ ] |
[Screenshot: Contractor list table with headers]
Notes: _______________
TC-CON-M006: Contractors sorted by Thai name
Precondition: On Contractor Management page with multiple contractors
| Step | Action | Expected Result | Dev | QA |
|---|---|---|---|---|
| 1 | View contractor list | List displayed | [ ] | [ ] |
| 2 | Check sorting order | Contractors sorted alphabetically by Thai name (nameTh) | [ ] | [ ] |
| 3 | Verify first contractor | First contractor has name starting with lowest Thai alphabetical order | [ ] | [ ] |
[Screenshot: Sorted contractor list]
Notes: Backend orders results by nameTh field
TC-CON-M007: Empty state when no contractors
Precondition: System has no contractors (rare test case)
| Step | Action | Expected Result | Dev | QA |
|---|---|---|---|---|
| 1 | Navigate to Contractor Management | Page loads | [ ] | [ ] |
| 2 | Verify empty state | Empty table or "No contractors found" message | [ ] | [ ] |
[Screenshot: Empty contractor list state]
Notes: This is a rare scenario as contractors are usually seeded
3. View Contractor Details Tests
TC-CON-M008: Click configure button opens form
Precondition: On Contractor Management page with contractors listed
| Step | Action | Expected Result | Dev | QA |
|---|---|---|---|---|
| 1 | Locate first contractor row | Row visible with company name | [ ] | [ ] |
| 2 | Click "กำหนดค่า" (Configure) button | Edit form opens | [ ] | [ ] |
| 3 | Verify form displayed | Form with contractor fields visible | [ ] | [ ] |
| 4 | Verify form populated | Fields show current contractor data | [ ] | [ ] |
[Screenshot: Configure button on contractor row] [Screenshot: Contractor edit form opened]
Notes: _______________
TC-CON-M009: Verify all form fields present
Precondition: Contractor edit form is open
| Step | Action | Expected Result | Dev | QA |
|---|---|---|---|---|
| 1 | Locate Company Name (Thai) field | Field present with label "ชื่อบริษัท (ไทย)" | [ ] | [ ] |
| 2 | Locate Company Name (English) field | Field present with label "ชื่อบริษัท (อังกฤษ)" | [ ] | [ ] |
| 3 | Locate Address field | Field present with label "ที่อยู่" | [ ] | [ ] |
| 4 | Locate Mobile Number field | Field present with label "Mobile" | [ ] | [ ] |
| 5 | Locate Email field | Field present with label "Email" | [ ] | [ ] |
| 6 | Locate Website field | Field present with label "Website" | [ ] | [ ] |
| 7 | Locate Contact Person field | Field present with label "ผู้ประสานงาน / ผู้ควบคุมงาน" | [ ] | [ ] |
| 8 | Verify Save button | "บันทึก" button present | [ ] | [ ] |
[Screenshot: Full contractor form with all fields]
Notes: _______________
TC-CON-M010: Form shows current contractor data
Precondition: Contractor edit form is open
| Step | Action | Expected Result | Dev | QA |
|---|---|---|---|---|
| 1 | Check Company Name (Thai) | Shows current Thai name from database | [ ] | [ ] |
| 2 | Check Company Name (English) | Shows current English name from database | [ ] | [ ] |
| 3 | Check Address | Shows current address | [ ] | [ ] |
| 4 | Check Mobile Number | Shows current phone number | [ ] | [ ] |
| 5 | Check Email | Shows current email | [ ] | [ ] |
| 6 | Verify data matches list | Form values match what was shown in list | [ ] | [ ] |
[Screenshot: Form with populated data]
Notes: _______________
4. Edit Contractor Tests
TC-CON-M011: Edit contractor name (Thai)
Precondition: Contractor edit form is open
| Step | Action | Expected Result | Dev | QA |
|---|---|---|---|---|
| 1 | Note current Company Name (Thai) | Record existing value | [ ] | [ ] |
| 2 | Clear Company Name (Thai) field | Field is empty | [ ] | [ ] |
| 3 | Enter new Thai name: บริษัท ทดสอบแก้ไข จำกัด | Thai characters accepted | [ ] | [ ] |
| 4 | Click "บันทึก" (Save) button | Save triggered | [ ] | [ ] |
| 5 | Verify success snackbar | "บันทึกสำเร็จ" or success message appears | [ ] | [ ] |
| 6 | Navigate back to list | Contractor list displayed | [ ] | [ ] |
| 7 | Verify updated name in list | New Thai name shown in table | [ ] | [ ] |
[Screenshot: Edited Thai name in form] [Screenshot: Success snackbar] [Screenshot: Updated name in list]
Notes: Remember to restore original value after test
TC-CON-M012: Edit multiple fields at once
Precondition: Contractor edit form is open
| Step | Action | Expected Result | Dev | QA |
|---|---|---|---|---|
| 1 | Modify Company Name (English) | New value entered | [ ] | [ ] |
| 2 | Modify Address | New address entered | [ ] | [ ] |
| 3 | Modify Mobile Number | New phone entered | [ ] | [ ] |
| 4 | Modify Contact Person | New name entered | [ ] | [ ] |
| 5 | Click "บันทึก" (Save) button | Save triggered | [ ] | [ ] |
| 6 | Verify success | Success snackbar appears | [ ] | [ ] |
| 7 | Re-open contractor form | Form loads with updated data | [ ] | [ ] |
| 8 | Verify all changes saved | All modified fields show new values | [ ] | [ ] |
[Screenshot: Multiple fields edited]
Notes: _______________
TC-CON-M013: Save with empty optional fields
Precondition: Contractor edit form is open
| Step | Action | Expected Result | Dev | QA |
|---|---|---|---|---|
| 1 | Clear Website field | Field is empty | [ ] | [ ] |
| 2 | Keep other required fields filled | Essential fields have values | [ ] | [ ] |
| 3 | Click "บันทึก" (Save) button | Save triggered | [ ] | [ ] |
| 4 | Verify success | Save completes without error | [ ] | [ ] |
| 5 | Verify empty website saved | Website field remains empty after reload | [ ] | [ ] |
[Screenshot: Form with empty website field]
Notes: Website is an optional field
TC-CON-M014: Cancel edit discards changes
Precondition: Contractor edit form is open with changes made
| Step | Action | Expected Result | Dev | QA |
|---|---|---|---|---|
| 1 | Make changes to contractor form | Values modified | [ ] | [ ] |
| 2 | Click "ยกเลิก" (Cancel) button or navigate away | Cancel action triggered | [ ] | [ ] |
| 3 | If confirmation dialog appears, confirm | Dialog accepted | [ ] | [ ] |
| 4 | Navigate back to list | Contractor list displayed | [ ] | [ ] |
| 5 | Click configure on same contractor | Edit form opens | [ ] | [ ] |
| 6 | Verify original values | Changes were NOT saved | [ ] | [ ] |
[Screenshot: Cancel button]
Notes: _______________
5. Set/Unset Default Tests
TC-CON-M015: Set contractor as default
Precondition: On Contractor Management page, contractor is NOT currently default
| Step | Action | Expected Result | Dev | QA |
|---|---|---|---|---|
| 1 | Locate a non-default contractor row | Row without default indicator | [ ] | [ ] |
| 2 | Click options menu (expand_more icon) on row | Dropdown menu opens | [ ] | [ ] |
| 3 | Verify menu option | "ตั้งเป็นค่าเริ่มต้น" (Set as Default) visible | [ ] | [ ] |
| 4 | Click "ตั้งเป็นค่าเริ่มต้น" | Action triggered | [ ] | [ ] |
| 5 | Verify confirmation dialog | Dialog asking to confirm | [ ] | [ ] |
| 6 | Click "ตกลง" (OK) to confirm | Action executed | [ ] | [ ] |
| 7 | Verify success snackbar | Success message appears | [ ] | [ ] |
| 8 | Verify default indicator | Contractor row now shows default indicator (star or checkmark) | [ ] | [ ] |
[Screenshot: Options menu with "ตั้งเป็นค่าเริ่มต้น"] [Screenshot: Confirmation dialog] [Screenshot: Contractor with default indicator]
Notes: Only one contractor can be default at a time
TC-CON-M016: Unset default (toggle off)
Precondition: Contractor is currently set as default
| Step | Action | Expected Result | Dev | QA |
|---|---|---|---|---|
| 1 | Locate the default contractor row | Row with default indicator visible | [ ] | [ ] |
| 2 | Click options menu on default contractor | Dropdown menu opens | [ ] | [ ] |
| 3 | Verify menu option changed | "ยกเลิกเป็นค่าเริ่มต้น" (Unset Default) visible | [ ] | [ ] |
| 4 | Click "ยกเลิกเป็นค่าเริ่มต้น" | Action triggered | [ ] | [ ] |
| 5 | Verify confirmation dialog | Dialog asking to confirm | [ ] | [ ] |
| 6 | Click "ตกลง" (OK) to confirm | Action executed | [ ] | [ ] |
| 7 | Verify success snackbar | Success message appears | [ ] | [ ] |
| 8 | Verify default indicator removed | Contractor no longer shows default indicator | [ ] | [ ] |
[Screenshot: Options menu with "ยกเลิกเป็นค่าเริ่มต้น"] [Screenshot: Default indicator removed]
Notes: Setting the same contractor as default twice toggles it off (API behavior)
TC-CON-M017: Setting new default clears previous
Precondition: One contractor is currently set as default
| Step | Action | Expected Result | Dev | QA |
|---|---|---|---|---|
| 1 | Note which contractor is currently default | Record contractor name | [ ] | [ ] |
| 2 | Find a DIFFERENT non-default contractor | Another row without indicator | [ ] | [ ] |
| 3 | Set the new contractor as default | Follow TC-CON-M015 steps | [ ] | [ ] |
| 4 | Verify new contractor is default | New contractor shows default indicator | [ ] | [ ] |
| 5 | Verify OLD contractor is no longer default | Previous default indicator removed | [ ] | [ ] |
[Screenshot: New default contractor, old one no longer default]
Notes: Only one contractor can be default - setting a new one automatically clears the previous
6. Delete Contractor Tests
TC-CON-M018: Open delete confirmation dialog
Precondition: On Contractor Management page as Admin
| Step | Action | Expected Result | Dev | QA |
|---|---|---|---|---|
| 1 | Locate a contractor row | Row visible | [ ] | [ ] |
| 2 | Click options menu (expand_more icon) | Dropdown menu opens | [ ] | [ ] |
| 3 | Verify delete option | "ลบ" (Delete) option visible | [ ] | [ ] |
| 4 | Click "ลบ" (Delete) | Confirmation dialog appears | [ ] | [ ] |
| 5 | Verify dialog text | Dialog shows contractor name and asks to confirm | [ ] | [ ] |
| 6 | Verify dialog buttons | "ตกลง" (OK) and "ยกเลิก" (Cancel) buttons visible | [ ] | [ ] |
[Screenshot: Options menu with delete option] [Screenshot: Delete confirmation dialog]
Notes: _______________
TC-CON-M019: Cancel delete keeps contractor
Precondition: Delete confirmation dialog is showing
| Step | Action | Expected Result | Dev | QA |
|---|---|---|---|---|
| 1 | Click "ยกเลิก" (Cancel) button | Dialog closes | [ ] | [ ] |
| 2 | Verify returned to list | Contractor list displayed | [ ] | [ ] |
| 3 | Verify contractor still in list | Contractor was NOT deleted | [ ] | [ ] |
[Screenshot: Contractor still in list after cancel]
Notes: _______________
TC-CON-M020: FK constraint prevents delete (contractor in use)
Precondition: Contractor has supervisor users assigned
| Step | Action | Expected Result | Dev | QA |
|---|---|---|---|---|
| 1 | Find a contractor with supervisor users | Contractor that has assigned supervisors | [ ] | [ ] |
| 2 | Click options → Delete | Delete triggered | [ ] | [ ] |
| 3 | Click "ตกลง" to confirm | Delete attempted | [ ] | [ ] |
| 4 | Wait for response | Server processes request | [ ] | [ ] |
| 5 | Verify error snackbar | Error message appears: "Delete failed" or "Contractor is in use" | [ ] | [ ] |
| 6 | Verify contractor still in list | Contractor was NOT deleted due to FK constraint | [ ] | [ ] |
[Screenshot: Delete failed error snackbar]
Notes: Contractors with assigned supervisor users cannot be deleted. This is expected behavior - the FK constraint protects data integrity.
Test Execution Notes
Tester Comments:
Issues Found:
| Issue ID | Test Case | Description | Severity |
|---|---|---|---|
Environment Details:
| Item | Value |
|---|---|
| Browser | |
| Browser Version | |
| OS | |
| Screen Resolution | |
| Backend URL | |
| Frontend URL |
Sign-off:
| Role | Name | Date | Signature |
|---|---|---|---|
| Tester | |||
| Reviewer |