Skip to content

ChatFlow Platform - Comprehensive Testing Guide ​

Last Updated: March 22, 2026
Version: 1.0.0
Status: βœ… All Services Running


πŸ“‹ Table of Contents ​

  1. Quick Start
  2. Test Users & Credentials
  3. Service Endpoints
  4. API Testing
  5. UI Testing
  6. Integration Testing
  7. End-to-End User Flows
  8. Troubleshooting

πŸš€ Quick Start ​

Prerequisites ​

  • Docker and Docker Compose running
  • All services started: docker-compose up -d
  • PowerShell or bash terminal

Verify Services Are Running ​

powershell
docker ps --filter name=chatflow --format "table {{.Names}}\t{{.Status}}"

Access Points ​

ServiceURLPurpose
Admin Portalhttp://localhost:4210Administrative dashboard
User Portalhttp://localhost:4220End-user chat interface
API Gatewayhttp://localhost:5000Reverse proxy to all APIs
Auth APIhttp://localhost:5001Authentication service
Chat APIhttp://localhost:5002Conversation management
AI Servicehttp://localhost:8000AI chat integration
AI Docshttp://localhost:8000/docsFastAPI Swagger UI
MailHoghttp://localhost:8025Dev email catcher

πŸ‘₯ Test Users & Credentials ​

Admin User ​

json
{
  "email": "admin@chatflow.com",
  "password": "Admin123!@#",
  "firstName": "System",
  "lastName": "Administrator",
  "role": "Admin"
}

Agent User ​

json
{
  "email": "agent@chatflow.com",
  "password": "Agent123!@#",
  "firstName": "Support",
  "lastName": "Agent",
  "role": "User"
}

Test Customer ​

json
{
  "email": "customer@example.com",
  "password": "Customer123!@#",
  "firstName": "Test",
  "lastName": "Customer",
  "role": "User"
}

Infrastructure Services ​

ServiceNote
PostgreSQLshared-postgres β€” credentials in .env
Redisshared-redis β€” credentials in .env

πŸ”Œ Service Endpoints ​

Authentication Service (Port 5001) ​

OpenAPI Spec: http://localhost:5001/openapi/v1.json

Available Endpoints: ​

POST   /api/v1/Auth/register         - Register new user
POST   /api/v1/Auth/login            - User login
POST   /api/v1/Auth/refresh          - Refresh JWT token
POST   /api/v1/Auth/logout           - User logout
POST   /api/v1/Auth/verify-email     - Verify email address
POST   /api/v1/Auth/forgot-password  - Request password reset
POST   /api/v1/Auth/reset-password   - Reset password with token
GET    /api/v1/Auth/me               - Get current user profile
GET    /health                       - Health check

Conversation Service (Port 5002) ​

Available Endpoints: ​

POST   /api/conversations            - Create new conversation
GET    /api/conversations/{id}       - Get conversation by ID
GET    /api/conversations            - List conversations (paginated)
POST   /api/conversations/{id}/close - Close conversation
POST   /api/messages                 - Send message in conversation
GET    /api/messages/{id}            - Get message by ID
GET    /api/widgets                  - List chat widgets
POST   /api/widgets                  - Create chat widget
GET    /health                       - Health check

API Gateway (Port 5000) ​

Routes: YARP reverse proxy to Auth (5001) and Chat (5002) services

/auth/*       β†’ http://auth-service:5001/*
/chat/*       β†’ http://chat-service:5002/*
/ai/*         β†’ http://ai-service:8000/*

AI Service (Port 8000) ​

Interactive Docs: http://localhost:8000/docs

Available Endpoints: ​

POST   /chat/completions            - Get AI chat completion
POST   /chat/stream                 - Stream AI responses
GET    /models                      - List available AI models
GET    /health                      - Health check
GET    /                            - Service info

πŸ§ͺ API Testing ​

Step 1: Register Test Users ​

Using PowerShell: ​

powershell
# Register Admin
$admin = @{
    email = "admin@chatflow.com"
    password = "Admin123!@#"
    firstName = "System"
    lastName = "Administrator"
} | ConvertTo-Json

$response = Invoke-RestMethod `
    -Uri http://localhost:5001/api/v1/Auth/register `
    -Method Post `
    -Body $admin `
    -ContentType "application/json"

Write-Host "Admin registered: $($response.email)"

Using cURL: ​

bash
curl -X POST http://localhost:5001/api/v1/Auth/register \
  -H "Content-Type: application/json" \
  -d '{
    "email": "admin@chatflow.com",
    "password": "Admin123!@#",
    "firstName": "System",
    "lastName": "Administrator"
  }'

Step 2: Login and Get JWT Token ​

PowerShell: ​

powershell
$loginData = @{
    email = "admin@chatflow.com"
    password = "Admin123!@#"
} | ConvertTo-Json

$loginResponse = Invoke-RestMethod `
    -Uri http://localhost:5001/api/v1/Auth/login `
    -Method Post `
    -Body $loginData `
    -ContentType "application/json"

$token = $loginResponse.accessToken
Write-Host "JWT Token: $token"

# Store token for subsequent requests
$headers = @{
    "Authorization" = "Bearer $token"
    "Content-Type" = "application/json"
}

cURL: ​

bash
curl -X POST http://localhost:5001/api/v1/Auth/login \
  -H "Content-Type: application/json" \
  -d '{
    "email": "admin@chatflow.com",
    "password": "Admin123!@#"
  }' \
  -c cookies.txt

# Use the token from response in subsequent requests

Step 3: Test Authenticated Endpoints ​

Get User Profile: ​

powershell
$profile = Invoke-RestMethod `
    -Uri http://localhost:5001/api/v1/Auth/me `
    -Method Get `
    -Headers $headers

Write-Host "User: $($profile.firstName) $($profile.lastName)"
Write-Host "Role: $($profile.role)"

Step 4: Test Chat Service ​

Create Conversation: ​

powershell
$conversation = @{
    widgetId = "00000000-0000-0000-0000-000000000001"
    visitorId = "visitor-001"
    metadata = @{
        source = "web"
        page = "/home"
    }
} | ConvertTo-Json

$conv = Invoke-RestMethod `
    -Uri http://localhost:5002/api/conversations `
    -Method Post `
    -Body $conversation `
    -Headers $headers `
    -ContentType "application/json"

Write-Host "Conversation created: $($conv.id)"

Step 5: Test AI Service ​

Get AI Completion: ​

powershell
$aiRequest = @{
    model = "gpt-3.5-turbo"
    messages = @(
        @{
            role = "user"
            content = "Hello, how can you help me today?"
        }
    )
} | ConvertTo-Json -Depth 10

$aiResponse = Invoke-RestMethod `
    -Uri http://localhost:8000/chat/completions `
    -Method Post `
    -Body $aiRequest `
    -ContentType "application/json"

Write-Host "AI Response: $($aiResponse.choices[0].message.content)"

🎨 UI Testing ​

Admin Portal Testing Steps ​

1. Access Admin Portal ​

2. Login ​

  • Enter credentials: admin@chatflow.com / Admin123!@#
  • Click "Sign In"
  • Should redirect to dashboard

3. Dashboard Verification ​

Check that the following are visible:

  • [ ] Navigation menu (sidebar or top bar)
  • [ ] User profile/avatar
  • [ ] Dashboard widgets/statistics
  • [ ] Recent conversations list

4. Test Navigation ​

Navigate through all sections:

  • [ ] Dashboard
  • [ ] Conversations
  • [ ] Widgets
  • [ ] Users/Team
  • [ ] Settings
  • [ ] Analytics (if available)

5. Widget Management ​

  • [ ] View existing widgets
  • [ ] Create new widget
  • [ ] Edit widget settings
  • [ ] Test widget embed code

6. Conversation Management ​

  • [ ] View conversation list
  • [ ] Open conversation details
  • [ ] View message history
  • [ ] Close/resolve conversation
  • [ ] Add internal notes

User Portal Testing Steps ​

1. Access User Portal ​

2. Customer Experience ​

  • [ ] Chat widget visible on page
  • [ ] Click to open chat
  • [ ] Send test message
  • [ ] Receive response
  • [ ] Upload file (if supported)
  • [ ] Rate conversation

3. Real-time Testing ​

  • Open Admin Portal in one browser tab
  • Open User Portal in another tab
  • Send message from User Portal
  • Verify message appears in Admin Portal in real-time

πŸ”„ Integration Testing ​

End-to-End Flow Testing ​

Scenario 1: New Customer Conversation ​

Objective: Test complete flow from customer initiation to agent response

  1. Customer Side (User Portal - Port 4220)

    • Open User Portal
    • Click chat widget
    • Enter name and email
    • Send message: "I need help with my account"
    • Expected: Message sent, waiting indicator shown
  2. Agent Side (Admin Portal - Port 4210)

    • Login as agent
    • Navigate to "Active Conversations"
    • Expected: See new conversation appear
    • Click on conversation
    • Expected: See customer message
    • Type response: "Hello! I'd be happy to help. What specifically do you need assistance with?"
    • Send message
    • Expected: Message sent successfully
  3. Customer Side (Verification)

    • Expected: Agent response appears in chat
    • Send reply: "I can't access my dashboard"
    • Expected: Message sent
  4. Agent Side (Verification)

    • Expected: Customer reply appears
    • Send help instructions
    • Close conversation
    • Expected: Conversation marked as resolved

Scenario 2: AI-Assisted Response ​

Objective: Test AI service integration

  1. Setup:

    • Login as agent
    • Open any conversation
  2. AI Integration:

    • Click "AI Assist" or similar button
    • Expected: AI suggests response
    • Review suggestion
    • Edit if needed
    • Send to customer
    • Expected: Response sent successfully
  3. Verification:

    • Check that AI usage is logged
    • Verify token consumption (if tracked)

Scenario 3: Multi-Channel Support ​

Objective: Test different communication channels

  1. Widget Channel:

    • Create conversation via widget
    • Verify it appears in admin portal
  2. Direct Message:

    • Use API to create conversation
    • Verify it appears in admin portal
  3. Verification:

    • All channels show correct source
    • Messages are properly threaded

πŸ“Š Performance Testing ​

Load Testing Scenarios ​

1. Concurrent Users Test ​

powershell
# Create 10 concurrent user registrations
1..10 | ForEach-Object -Parallel {
    $user = @{
        email = "testuser$_@example.com"
        password = "Test123!@#"
        firstName = "Test"
        lastName = "User$_"
    } | ConvertTo-Json

    Invoke-RestMethod `
        -Uri http://localhost:5001/api/v1/Auth/register `
        -Method Post `
        -Body $user `
        -ContentType "application/json"
} -ThrottleLimit 10

Write-Host "10 users registered concurrently"

2. Message Throughput Test ​

powershell
# Send 50 messages rapidly
$token = "YOUR_JWT_TOKEN"
$conversationId = "YOUR_CONVERSATION_ID"

1..50 | ForEach-Object {
    $message = @{
        conversationId = $conversationId
        content = "Test message $_"
        type = "text"
    } | ConvertTo-Json

    Invoke-RestMethod `
        -Uri http://localhost:5002/api/messages `
        -Method Post `
        -Body $message `
        -Headers @{ "Authorization" = "Bearer $token" } `
        -ContentType "application/json"
}

Expected Performance Metrics ​

MetricTargetAcceptable
Login Response Time< 200ms< 500ms
Message Send Time< 100ms< 300ms
AI Response Time< 2s< 5s
WebSocket Latency< 50ms< 150ms
Concurrent Users100+50+

πŸ” Health Checks ​

Verify All Services Healthy ​

powershell
$services = @{
    "Auth" = "http://localhost:5001/health"
    "Chat" = "http://localhost:5002/health"
    "AI" = "http://localhost:8000/health"
}

foreach ($service in $services.GetEnumerator()) {
    try {
        $health = Invoke-RestMethod -Uri $service.Value -TimeoutSec 2
        Write-Host "βœ“ $($service.Key): $health" -ForegroundColor Green
    } catch {
        Write-Host "βœ— $($service.Key): FAILED" -ForegroundColor Red
    }
}

Database Verification ​

powershell
# Test PostgreSQL connection
docker exec chatflow-postgres psql -U chatflow -d chatflow -c "SELECT version();"

# List all schemas
docker exec chatflow-postgres psql -U chatflow -d chatflow -c "\dn"

# Check table counts
docker exec chatflow-postgres psql -U chatflow -d chatflow -c "
    SELECT schemaname, tablename 
    FROM pg_tables 
    WHERE schemaname IN ('auth', 'chat', 'billing', 'analytics', 'integrations');"

Redis Verification ​

powershell
docker exec chatflow-redis redis-cli PING
# Expected: PONG

docker exec chatflow-redis redis-cli INFO stats
# Shows connection and command statistics

πŸ› Troubleshooting ​

Common Issues ​

Issue: 401 Unauthorized on API calls ​

Solution:

  1. Verify JWT token is valid and not expired
  2. Check token is included in Authorization header
  3. Ensure token format: Bearer YOUR_TOKEN

Issue: CORS errors in browser ​

Solution:

  1. Check CORS configuration in service Program.cs
  2. Add frontend origin to allowed origins:
    CORS:AllowedOrigins=http://localhost:4210,http://localhost:4220

Issue: WebSocket connection failed ​

Solution:

  1. Verify SignalR hub is running: check /chat-hub endpoint
  2. Check browser console for connection errors
  3. Ensure proper authentication for WebSocket connection

Issue: Messages not appearing in real-time ​

Solution:

  1. Check Redis Streams connection in service logs
  2. Verify SignalR connection established
  3. Check browser console for errors

Issue: AI service not responding ​

Solution:

  1. Verify AI service environment variables set:
    • OPENAI_API_KEY
    • ANTHROPIC_API_KEY
  2. Check AI service logs: docker logs chatflow-ai-service
  3. Ensure AI provider API keys are valid

Service Logs ​

powershell
# View logs for specific service
docker logs chatflow-auth-service --tail 50 --follow

# View all logs
docker-compose logs -f

# View logs for specific time range
docker logs chatflow-chat-service --since 10m

πŸ“ Test Checklist ​

Pre-Deployment Testing ​

  • [ ] All services start without errors
  • [ ] Health endpoints return "Healthy"
  • [ ] Database migrations applied successfully
  • [ ] Redis connection established (shared-redis DB 1)

Authentication Testing ​

  • [ ] User registration works
  • [ ] Login returns valid JWT token
  • [ ] Token refresh works
  • [ ] Logout invalidates token
  • [ ] Password reset flow works
  • [ ] Email verification works (if SMTP configured)

Chat Functionality Testing ​

  • [ ] Create conversation
  • [ ] Send text message
  • [ ] Send file/attachment
  • [ ] Receive real-time notifications
  • [ ] Close/resolve conversation
  • [ ] Retrieve conversation history

Admin Portal Testing ​

  • [ ] Login as admin
  • [ ] View dashboard statistics
  • [ ] Manage conversations
  • [ ] Manage widgets
  • [ ] Manage users/team
  • [ ] View analytics

User Portal Testing ​

  • [ ] Chat widget loads
  • [ ] Send messages as visitor
  • [ ] Receive agent responses
  • [ ] Rate conversation
  • [ ] View conversation history

Integration Testing ​

  • [ ] Auth + Chat integration
  • [ ] Chat + AI integration
  • [ ] Real-time sync between portals
  • [ ] File upload to Cloudflare R2
  • [ ] Redis Streams message processing

🎯 Success Criteria ​

βœ… Platform is Production-Ready When:

  1. All services start and pass health checks
  2. Users can register and login successfully
  3. Conversations can be created and managed
  4. Real-time messaging works bidirectionally
  5. AI responses are generated correctly
  6. Admin portal displays all data correctly
  7. User portal provides smooth customer experience
  8. No critical errors in logs
  9. Performance metrics meet targets
  10. All integration tests pass

πŸ“ž Support & Feedback ​

Documentation: See /docs folder for detailed guides
Architecture: See ARCHITECTURE.md for system design
API Reference: Check OpenAPI specs at /openapi/v1.json endpoints

Test Results: Document your findings and report any issues


Happy Testing! πŸš€

Embed AI-powered live chat into any product.