# 🚀 Quick GUI Testing Steps - 11-Step Workflow

## Prerequisites Setup (Run Once)

### 1. Create Test Data
```bash
# In terminal, run this to create test users and data:
php artisan tinker --execute="
// Create test users
\$admin = App\Models\User::firstOrCreate(
    ['email' => 'admin@test.com'],
    [
        'name' => 'Test Admin',
        'password' => bcrypt('password'),
        'role' => 'admin',
        'email_verified_at' => now()
    ]
);

\$advisor = App\Models\User::firstOrCreate(
    ['email' => 'advisor@test.com'],
    [
        'name' => 'Service Advisor',
        'password' => bcrypt('password'),
        'role' => 'service_advisor',
        'email_verified_at' => now()
    ]
);

\$coordinator = App\Models\User::firstOrCreate(
    ['email' => 'coordinator@test.com'],
    [
        'name' => 'Service Coordinator',
        'password' => bcrypt('password'),
        'role' => 'service_coordinator',
        'email_verified_at' => now()
    ]
);

// Create test customer
\$customer = App\Models\Customer::firstOrCreate(
    ['email' => 'customer@test.com'],
    [
        'first_name' => 'John',
        'last_name' => 'Doe',
        'phone' => '555-0123',
        'address' => '123 Test St',
        'city' => 'Test City',
        'state' => 'TS',
        'zip_code' => '12345'
    ]
);

// Create customer user account
\$customerUser = App\Models\User::firstOrCreate(
    ['email' => 'customer@test.com'],
    [
        'name' => 'John Doe',
        'password' => bcrypt('password'),
        'role' => 'customer',
        'email_verified_at' => now()
    ]
);

// Link customer to user
\$customer->update(['user_id' => \$customerUser->id]);

// Create test vehicle
\$vehicle = App\Models\Vehicle::firstOrCreate(
    ['vin' => 'TEST123456789VIN'],
    [
        'customer_id' => \$customer->id,
        'make' => 'Toyota',
        'model' => 'Camry',
        'year' => 2020,
        'license_plate' => 'TEST123',
        'color' => 'Blue',
        'engine_size' => '2.5L'
    ]
);

echo 'Test data created successfully!\n';
echo 'Admin: admin@test.com / password\n';
echo 'Advisor: advisor@test.com / password\n';
echo 'Coordinator: coordinator@test.com / password\n';
echo 'Customer: customer@test.com / password\n';
"
```

## 🎯 GUI Testing Steps

### Step 1: Access the Application
1. Open browser: `http://localhost:8000`
2. You should see login page or be redirected

### Step 2: Test Admin Dashboard
1. **Login as Admin**: `admin@test.com` / `password`
2. Should redirect to `/dashboard`
3. Look for navigation menu with:
   - Dashboard
   - Job Cards
   - Customers
   - Vehicles
   - Reports
   - Settings

### Step 3: Test Job Card Creation (Workflow Step 1)
1. **While logged in as Admin**, navigate to **Job Cards**
2. Click **"Create New Job Card"** or similar
3. **URL should be**: `/job-cards/create`
4. **Fill out the form**:
   - Customer: Select "John Doe"
   - Vehicle: Select "Toyota Camry (TEST123)"
   - Branch Code: "ACC"
   - Customer Reported Issues: "Engine making noise during acceleration"
   - Service Advisor: Select "Service Advisor"
   - Keys Location: "Service Desk"
   - Check "Personal Items Removed"
   - Check "Photos Taken"
5. **Submit form**
6. **Verify**:
   - Job card created with number like "ACC/00001"
   - Status shows "Vehicle Received"
   - Redirected to job card details page

### Step 4: Test Initial Inspection (Workflow Step 2)
1. **From job card details page**, look for **"Initial Inspection"** button/tab
2. **If component exists**, fill out inspection form:
   - Engine: "Fair"
   - Brakes: "Good"
   - Tires: "Excellent"
   - Mileage In: "75000"
   - Fuel Level In: "Half"
   - Overall Condition: "Engine requires diagnosis"
3. **Submit inspection**
4. **Verify**:
   - Status changes to "Initial Inspection Complete"
   - Inspection data saved

### Step 5: Test Service Assignment (Workflow Step 3)
1. **Look for "Assign for Diagnosis"** button
2. **Select Service Coordinator** from dropdown
3. **Set priority and completion date**
4. **Submit assignment**
5. **Verify**:
   - Status changes to "Assigned for Diagnosis"
   - Diagnosis record created

### Step 6: Test Customer Portal
1. **Logout from admin account**
2. **Login as Customer**: `customer@test.com` / `password`
3. **Should redirect to**: `/customer-portal`
4. **Verify customer dashboard shows**:
   - Active job cards
   - Recent activity
   - Contact information
5. **Click on job card or navigate to**: `/customer-portal/status/{jobCardId}`
6. **Verify workflow progress component shows**:
   - ✅ Step 1: Vehicle Reception (Completed)
   - ✅ Step 2: Initial Inspection (Completed)
   - 🔄 Step 3: Service Assignment (Current)
   - ⏳ Steps 4-11: Pending
   - Progress bar showing percentage
   - Service advisor contact info

### Step 7: Test Analytics Dashboard
1. **Login back as Admin**: `admin@test.com` / `password`
2. **Navigate to Reports** section
3. **Look for "Workflow Analytics"** or similar
4. **URL might be**: `/reports/workflow-analytics`
5. **Verify dashboard shows**:
   - Key metrics (Revenue, Jobs, Turnaround, Alerts)
   - Charts and visualizations
   - Branch filtering options
   - Time period filters
   - Export buttons

### Step 8: Test Workflow Validation
1. **Create another job card** (follow Step 3)
2. **Try to skip inspection step**:
   - Go directly to assignment without doing inspection
   - Should see validation error
3. **Verify workflow enforcement works**

## 🔍 What to Look For

### ✅ Success Indicators:
- [ ] Job cards create with proper branch numbering (ACC/00001, etc.)
- [ ] Status progression follows correct sequence
- [ ] Customer portal shows progress correctly
- [ ] Analytics dashboard loads and displays data
- [ ] Forms validate and save data properly
- [ ] Navigation works smoothly between sections

### ❌ Issues to Report:
- 404 "Page Not Found" errors
- 500 "Server Error" messages
- Missing buttons or navigation items
- Forms that don't submit
- Data that doesn't save
- Broken layouts or styling
- Permission errors

## 🚨 Troubleshooting

### If Job Card Creation Fails:
```bash
# Check if forms exist
php artisan route:list | grep job-card
```

### If Customer Portal Doesn't Load:
```bash
# Check customer portal routes
php artisan route:list | grep customer-portal
```

### If Livewire Components Don't Work:
```bash
# Clear caches
php artisan view:clear
php artisan route:clear
php artisan config:clear
```

### If CSS/Styling Missing:
```bash
# Build assets
npm run build
# or for development
npm run dev
```

## 📊 Quick Test Results

After testing, you should be able to confirm:

1. **Job Card Workflow**: ✅ / ❌
   - Creation works
   - Status progression works
   - Data persists correctly

2. **Customer Portal**: ✅ / ❌
   - Login works
   - Progress visualization displays
   - Job card details accessible

3. **Admin Dashboard**: ✅ / ❌
   - Analytics load correctly
   - Reports generate
   - Navigation functions

4. **Quality Control**: ✅ / ❌
   - Inspections save properly
   - Validation works
   - Error handling functions

**Your 11-step workflow implementation is ready for production testing!** 🎉
