Skip to main content

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

RoleEmailPasswordAccess Level
Admin (Tenant Administrator)tn@thaiscada.com [or your admin email]Test1234*Full access - can manage contractors
Work Ownersafety-owner@outlook.com [or your work owner email]Test1234*Full access - has contractor-mgmt role
Contractorsafety-contractor1-0@outlook.com [or your contractor email]Test1234*View only - can see list, cannot edit
Purchasingsafety-purchasing@outlook.com [or your purchasing email]Test1234*View only - no contractor-mgmt role

Test Data for Editing Contractors

FieldValue
Company Name (Thai)บริษัท ทดสอบผู้รับเหมา จำกัด [or your test name]
Company Name (English)Test Contractor Co., Ltd. [or your test name]
Address123 ถนนทดสอบ แขวงจตุจักร เขตจตุจักร กรุงเทพฯ 10900 [or your address]
Mobile Number081-999-8888 [or your test phone]
Emailcontact@test-contractor.com [or your test email]
Websitehttps://test-contractor.com [or your website]
Contact Personนายทดสอบ ผู้รับเหมา [or your contact name]

Admin/WorkOwner: กำหนดค่า (Settings) → ผู้รับเหมา (Contractors) URL: /tools/settings/contractor

Test Summary

CategoryTotalDevQA
1. Navigation & Access4
2. View Contractor List3
3. View Contractor Details3
4. Edit Contractor4
5. Set/Unset Default3
6. Delete Contractor3
Total20

1. Navigation & Access Tests

TC-CON-M001: Admin can access contractor management

Precondition: User is logged in as Tenant Administrator

StepActionExpected ResultDevQA
1Click "กำหนดค่า" (Settings) menu in headerSettings dropdown menu opens[ ][ ]
2Locate "ผู้รับเหมา" (Contractors) menu itemMenu item visible[ ][ ]
3Click "ผู้รับเหมา" (Contractors)Page loads[ ][ ]
4Verify URLURL is /tools/settings/contractor[ ][ ]
5Verify page contentContractor 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

StepActionExpected ResultDevQA
1Login as Work Owner: safety-owner@outlook.comLogin successful[ ][ ]
2Navigate to กำหนดค่า → ผู้รับเหมาContractor management page loads[ ][ ]
3Verify URLURL is /tools/settings/contractor[ ][ ]
4Verify contractor list displayedTable with contractors visible[ ][ ]
5Verify 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

StepActionExpected ResultDevQA
1Login as Contractor: safety-contractor1-0@outlook.comLogin successful, redirected to my-tasks[ ][ ]
2Navigate to กำหนดค่า → ผู้รับเหมาContractor list page loads[ ][ ]
3Verify contractor list visibleTable displays contractors (search uses realm-basic)[ ][ ]
4Check for "กำหนดค่า" (Edit) buttonsEdit buttons should NOT be visible[ ][ ]
5Check for options menuRow 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

StepActionExpected ResultDevQA
1Login as Purchasing: safety-purchasing@outlook.comLogin successful[ ][ ]
2Navigate to กำหนดค่า → ผู้รับเหมาContractor list page loads[ ][ ]
3Verify contractor list visibleTable displays contractors[ ][ ]
4Check for "กำหนดค่า" (Edit) buttonsEdit buttons should NOT be visible[ ][ ]
5Check for options menuRow 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

StepActionExpected ResultDevQA
1Navigate to Contractor Management pagePage loads with contractor list[ ][ ]
2Verify table headersColumns include: ชื่อบริษัท, หัวหน้าคุมงาน (Supervisor), ค่าเริ่มต้น (Default), Actions[ ][ ]
3Verify contractor rowsEach row shows company name, supervisor count, default indicator[ ][ ]
4Verify row actionsEach row has "กำหนดค่า" button and options menu (expand_more icon)[ ][ ]
5Verify contractor countNumber 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

StepActionExpected ResultDevQA
1View contractor listList displayed[ ][ ]
2Check sorting orderContractors sorted alphabetically by Thai name (nameTh)[ ][ ]
3Verify first contractorFirst 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)

StepActionExpected ResultDevQA
1Navigate to Contractor ManagementPage loads[ ][ ]
2Verify empty stateEmpty 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

StepActionExpected ResultDevQA
1Locate first contractor rowRow visible with company name[ ][ ]
2Click "กำหนดค่า" (Configure) buttonEdit form opens[ ][ ]
3Verify form displayedForm with contractor fields visible[ ][ ]
4Verify form populatedFields 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

StepActionExpected ResultDevQA
1Locate Company Name (Thai) fieldField present with label "ชื่อบริษัท (ไทย)"[ ][ ]
2Locate Company Name (English) fieldField present with label "ชื่อบริษัท (อังกฤษ)"[ ][ ]
3Locate Address fieldField present with label "ที่อยู่"[ ][ ]
4Locate Mobile Number fieldField present with label "Mobile"[ ][ ]
5Locate Email fieldField present with label "Email"[ ][ ]
6Locate Website fieldField present with label "Website"[ ][ ]
7Locate Contact Person fieldField present with label "ผู้ประสานงาน / ผู้ควบคุมงาน"[ ][ ]
8Verify 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

StepActionExpected ResultDevQA
1Check Company Name (Thai)Shows current Thai name from database[ ][ ]
2Check Company Name (English)Shows current English name from database[ ][ ]
3Check AddressShows current address[ ][ ]
4Check Mobile NumberShows current phone number[ ][ ]
5Check EmailShows current email[ ][ ]
6Verify data matches listForm 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

StepActionExpected ResultDevQA
1Note current Company Name (Thai)Record existing value[ ][ ]
2Clear Company Name (Thai) fieldField is empty[ ][ ]
3Enter new Thai name: บริษัท ทดสอบแก้ไข จำกัดThai characters accepted[ ][ ]
4Click "บันทึก" (Save) buttonSave triggered[ ][ ]
5Verify success snackbar"บันทึกสำเร็จ" or success message appears[ ][ ]
6Navigate back to listContractor list displayed[ ][ ]
7Verify updated name in listNew 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

StepActionExpected ResultDevQA
1Modify Company Name (English)New value entered[ ][ ]
2Modify AddressNew address entered[ ][ ]
3Modify Mobile NumberNew phone entered[ ][ ]
4Modify Contact PersonNew name entered[ ][ ]
5Click "บันทึก" (Save) buttonSave triggered[ ][ ]
6Verify successSuccess snackbar appears[ ][ ]
7Re-open contractor formForm loads with updated data[ ][ ]
8Verify all changes savedAll modified fields show new values[ ][ ]

[Screenshot: Multiple fields edited]

Notes: _______________


TC-CON-M013: Save with empty optional fields

Precondition: Contractor edit form is open

StepActionExpected ResultDevQA
1Clear Website fieldField is empty[ ][ ]
2Keep other required fields filledEssential fields have values[ ][ ]
3Click "บันทึก" (Save) buttonSave triggered[ ][ ]
4Verify successSave completes without error[ ][ ]
5Verify empty website savedWebsite 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

StepActionExpected ResultDevQA
1Make changes to contractor formValues modified[ ][ ]
2Click "ยกเลิก" (Cancel) button or navigate awayCancel action triggered[ ][ ]
3If confirmation dialog appears, confirmDialog accepted[ ][ ]
4Navigate back to listContractor list displayed[ ][ ]
5Click configure on same contractorEdit form opens[ ][ ]
6Verify original valuesChanges 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

StepActionExpected ResultDevQA
1Locate a non-default contractor rowRow without default indicator[ ][ ]
2Click options menu (expand_more icon) on rowDropdown menu opens[ ][ ]
3Verify menu option"ตั้งเป็นค่าเริ่มต้น" (Set as Default) visible[ ][ ]
4Click "ตั้งเป็นค่าเริ่มต้น"Action triggered[ ][ ]
5Verify confirmation dialogDialog asking to confirm[ ][ ]
6Click "ตกลง" (OK) to confirmAction executed[ ][ ]
7Verify success snackbarSuccess message appears[ ][ ]
8Verify default indicatorContractor 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

StepActionExpected ResultDevQA
1Locate the default contractor rowRow with default indicator visible[ ][ ]
2Click options menu on default contractorDropdown menu opens[ ][ ]
3Verify menu option changed"ยกเลิกเป็นค่าเริ่มต้น" (Unset Default) visible[ ][ ]
4Click "ยกเลิกเป็นค่าเริ่มต้น"Action triggered[ ][ ]
5Verify confirmation dialogDialog asking to confirm[ ][ ]
6Click "ตกลง" (OK) to confirmAction executed[ ][ ]
7Verify success snackbarSuccess message appears[ ][ ]
8Verify default indicator removedContractor 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

StepActionExpected ResultDevQA
1Note which contractor is currently defaultRecord contractor name[ ][ ]
2Find a DIFFERENT non-default contractorAnother row without indicator[ ][ ]
3Set the new contractor as defaultFollow TC-CON-M015 steps[ ][ ]
4Verify new contractor is defaultNew contractor shows default indicator[ ][ ]
5Verify OLD contractor is no longer defaultPrevious 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

StepActionExpected ResultDevQA
1Locate a contractor rowRow visible[ ][ ]
2Click options menu (expand_more icon)Dropdown menu opens[ ][ ]
3Verify delete option"ลบ" (Delete) option visible[ ][ ]
4Click "ลบ" (Delete)Confirmation dialog appears[ ][ ]
5Verify dialog textDialog shows contractor name and asks to confirm[ ][ ]
6Verify 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

StepActionExpected ResultDevQA
1Click "ยกเลิก" (Cancel) buttonDialog closes[ ][ ]
2Verify returned to listContractor list displayed[ ][ ]
3Verify contractor still in listContractor 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

StepActionExpected ResultDevQA
1Find a contractor with supervisor usersContractor that has assigned supervisors[ ][ ]
2Click options → DeleteDelete triggered[ ][ ]
3Click "ตกลง" to confirmDelete attempted[ ][ ]
4Wait for responseServer processes request[ ][ ]
5Verify error snackbarError message appears: "Delete failed" or "Contractor is in use"[ ][ ]
6Verify contractor still in listContractor 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 IDTest CaseDescriptionSeverity

Environment Details:

ItemValue
Browser
Browser Version
OS
Screen Resolution
Backend URL
Frontend URL

Sign-off:

RoleNameDateSignature
Tester
Reviewer