# Manual Testing Guide for Automotive Repair Workflow ## Quick Smoke Tests ### Test 1: Basic Service Instantiation ```bash cd /home/dev/car-repairs-shop php artisan tinker --execute=" \$workflowService = app(App\Services\WorkflowService::class); echo 'WorkflowService: OK\n'; \$inspectionService = app(App\Services\InspectionChecklistService::class); echo 'InspectionChecklistService: OK\n'; echo 'Services instantiated successfully.'; " ``` ### Test 2: JobCard Status Constants ```bash php artisan tinker --execute=" \$statuses = App\Models\JobCard::getStatusOptions(); echo 'Available statuses: ' . count(\$statuses) . '\n'; foreach(\$statuses as \$key => \$label) { echo '- ' . \$key . ': ' . \$label . '\n'; } " ``` ### Test 3: Inspection Checklist ```bash php artisan tinker --execute=" \$service = app(App\Services\InspectionChecklistService::class); \$checklist = \$service->getStandardChecklistItems(); echo 'Checklist categories: ' . count(\$checklist) . '\n'; foreach(array_keys(\$checklist) as \$category) { echo '- ' . \$category . '\n'; } " ``` ### Test 4: Create Sample JobCard ```bash php artisan tinker --execute=" // Create sample data \$customer = App\Models\Customer::factory()->create(); \$vehicle = App\Models\Vehicle::factory()->create(['customer_id' => \$customer->id]); \$advisor = App\Models\User::factory()->create(['role' => 'service_advisor']); // Create job card through workflow \$workflow = app(App\Services\WorkflowService::class); \$jobCard = \$workflow->createJobCard([ 'customer_id' => \$customer->id, 'vehicle_id' => \$vehicle->id, 'branch_code' => 'ACC', 'customer_reported_issues' => 'Test issue', 'service_advisor_id' => \$advisor->id, ]); echo 'Job Card Created: ' . \$jobCard->job_card_number . '\n'; echo 'Status: ' . \$jobCard->status . '\n'; echo 'Branch: ' . \$jobCard->branch_code . '\n'; " ``` ### Test 5: Complete Workflow Progression ```bash php artisan tinker --execute=" // Setup \$customer = App\Models\Customer::factory()->create(['name' => 'Test Customer']); \$vehicle = App\Models\Vehicle::factory()->create(['customer_id' => \$customer->id]); \$advisor = App\Models\User::factory()->create(['name' => 'Test Advisor']); \$inspector = App\Models\User::factory()->create(['name' => 'Test Inspector']); \$coordinator = App\Models\User::factory()->create(['name' => 'Test Coordinator']); \$workflow = app(App\Services\WorkflowService::class); // Step 1: Create Job Card \$jobCard = \$workflow->createJobCard([ 'customer_id' => \$customer->id, 'vehicle_id' => \$vehicle->id, 'branch_code' => 'ACC', 'customer_reported_issues' => 'Engine noise during acceleration', 'service_advisor_id' => \$advisor->id, ]); echo 'Step 1 Complete - Job Card: ' . \$jobCard->job_card_number . ' Status: ' . \$jobCard->status . '\n'; // Step 2: Initial Inspection \$inspectionData = [ 'engine' => 'fair', 'brakes' => 'good', 'tires' => 'excellent', 'mileage_in' => 75000, 'fuel_level_in' => 'half', 'inspection_checklist' => ['engine' => 'fair', 'brakes' => 'good', 'tires' => 'excellent'], 'overall_condition' => 'Vehicle in good condition, engine requires diagnosis', ]; \$updatedJobCard = \$workflow->performInitialInspection(\$jobCard, \$inspectionData, \$inspector->id); echo 'Step 2 Complete - Status: ' . \$updatedJobCard->status . ' Mileage: ' . \$updatedJobCard->mileage_in . '\n'; // Step 3: Assign to Service Coordinator \$diagnosis = \$workflow->assignToServiceCoordinator(\$updatedJobCard, \$coordinator->id); \$updatedJobCard->refresh(); echo 'Step 3 Complete - Status: ' . \$updatedJobCard->status . ' Diagnosis ID: ' . \$diagnosis->id . '\n'; echo '\nWorkflow progression test completed successfully!'; " ``` ## Integration Testing with Real Data ### Test 6: Branch-Specific Numbering ```bash php artisan tinker --execute=" \$customer = App\Models\Customer::factory()->create(); \$vehicle = App\Models\Vehicle::factory()->create(['customer_id' => \$customer->id]); \$advisor = App\Models\User::factory()->create(); \$workflow = app(App\Services\WorkflowService::class); // Test ACC branch \$accJob = \$workflow->createJobCard([ 'customer_id' => \$customer->id, 'vehicle_id' => \$vehicle->id, 'branch_code' => 'ACC', 'service_advisor_id' => \$advisor->id, ]); // Test KSI branch \$ksiJob = \$workflow->createJobCard([ 'customer_id' => \$customer->id, 'vehicle_id' => \$vehicle->id, 'branch_code' => 'KSI', 'service_advisor_id' => \$advisor->id, ]); echo 'ACC Job Card: ' . \$accJob->job_card_number . '\n'; echo 'KSI Job Card: ' . \$ksiJob->job_card_number . '\n'; echo 'Branch numbering: ' . (str_starts_with(\$accJob->job_card_number, 'ACC/') ? 'PASS' : 'FAIL') . '\n'; " ``` ### Test 7: Quality Control System ```bash php artisan tinker --execute=" \$service = app(App\Services\InspectionChecklistService::class); \$incoming = ['engine' => 'fair', 'brakes' => 'poor', 'tires' => 'good']; \$outgoing = ['engine' => 'excellent', 'brakes' => 'good', 'tires' => 'good']; \$comparison = \$service->compareInspections(\$incoming, \$outgoing); echo 'Quality Comparison Results:\n'; echo 'Improvements: ' . implode(', ', \$comparison['improvements']) . '\n'; echo 'Quality Score: ' . \$comparison['overall_quality_score'] . '\n'; \$alert = \$service->generateQualityAlert(\$comparison); echo 'Quality Alert: ' . (\$alert ?? 'None') . '\n'; " ``` ## User Interface Testing ### Test 8: Livewire Components (Requires UI) 1. Navigate to customer portal workflow progress page 2. Create a test job card and verify progress visualization 3. Check management analytics dashboard 4. Test export functionality ### Test 9: Database Performance ```bash php artisan tinker --execute=" // Test query performance with indexes \$start = microtime(true); \$jobs = App\Models\JobCard::where('status', 'received') ->where('branch_code', 'ACC') ->limit(100) ->get(); \$time = (microtime(true) - \$start) * 1000; echo 'Query time: ' . round(\$time, 2) . 'ms for ' . \$jobs->count() . ' results\n'; " ``` ## Error Handling Tests ### Test 10: Workflow Validation ```bash php artisan tinker --execute=" \$jobCard = App\Models\JobCard::factory()->create(['status' => 'received']); \$coordinator = App\Models\User::factory()->create(); \$workflow = app(App\Services\WorkflowService::class); try { \$workflow->assignToServiceCoordinator(\$jobCard, \$coordinator->id); echo 'ERROR: Should have thrown validation exception\n'; } catch (InvalidArgumentException \$e) { echo 'PASS: Validation working - ' . \$e->getMessage() . '\n'; } " ``` ## Cleanup Test Data ```bash php artisan tinker --execute=" // Clean up test data App\Models\JobCard::where('job_card_number', 'like', 'ACC/%')->delete(); App\Models\JobCard::where('job_card_number', 'like', 'KSI/%')->delete(); echo 'Test data cleaned up.\n'; " ``` ## Expected Results Summary - ✅ All services instantiate correctly - ✅ JobCard workflow progression follows 11-step process - ✅ Branch-specific numbering works (ACC/, KSI/, etc.) - ✅ Quality control system detects improvements/issues - ✅ Validation prevents workflow step skipping - ✅ Database queries perform well with proper indexes - ✅ Error handling catches invalid operations