Last updated: Aug 12, 2025, 01:09 PM UTC

Organization Setup Testing Guide

Purpose: Complete guide for testing the Organization Setup feature repeatedly
Created: 2025-08-08
Status: Complete

Overview

This guide provides comprehensive instructions for testing the Organization Setup feature, including reset procedures, test user management, and various testing scenarios.

Quick Start

Fastest Test Reset (30 seconds)

# Reset current user's onboarding status
./scripts/reset-onboarding.sh --soft

# Open browser to test
open http://localhost:3005

# Login with your existing credentials

Using Pre-Created Test Users

Three test users are available (password: test123 for all):

Username Purpose Test Scenario
test-skip Test skip functionality Click "Skip for now" β†’ Verify workspace creation
test-upload Test document upload Upload docs β†’ Verify conversion & Claude launch
test-complete Test full completion Complete all steps β†’ Verify knowledge base

Test Scripts

1. Reset Script (scripts/reset-onboarding.sh)

Reset onboarding status without creating new users:

# Soft Reset - Keep user, reset onboarding only
./scripts/reset-onboarding.sh --soft
# βœ… Keeps user account
# βœ… Resets onboarding_completed to 0
# βœ… Clears workspace directory

# Hard Reset - Delete all user data
./scripts/reset-onboarding.sh --hard
# ⚠️ Deletes all users
# ⚠️ Clears all documents
# ⚠️ Requires new registration

# Workspace Reset - Clear workspace only
./scripts/reset-onboarding.sh --workspace
# βœ… Keeps user and profile
# βœ… Only clears workspace files
# βœ… Triggers setup on next login

2. Test User Manager (scripts/test-users.js)

Manage multiple test users for different scenarios:

# Create test users quickly
node scripts/test-users.js quick
# Creates: test-skip, test-upload, test-complete

# Create individual test user
node scripts/test-users.js create testuser1 mypassword

# Reset specific user's onboarding
node scripts/test-users.js reset testuser1

# List all test users and their status
node scripts/test-users.js list

Docker Testing

If running in Docker container:

# Reset onboarding in container
docker exec sasha-test ./scripts/reset-onboarding.sh --soft

# Create test users in container
docker exec sasha-test node scripts/test-users.js quick

# Check container logs
docker logs -f sasha-test

Test Documents

Sample documents are provided in /test-docs/:

test-docs/
β”œβ”€β”€ acme-company-overview.md   # Company information
β”œβ”€β”€ employee-handbook.md       # HR policies & benefits
└── product-pitch-deck.md      # Investor presentation

Creating Additional Test Documents

# Create more test documents
cd test-docs

# Create a financial report
echo "# Q4 2024 Financial Report
Revenue: $120M
Growth: 85% YoY
Profit Margin: 82%" > financial-report.md

# Create a technical specification
echo "# Technical Architecture
- Microservices on Kubernetes
- PostgreSQL + Redis
- React + Node.js" > tech-spec.md

Testing Scenarios

Scenario 1: Skip Functionality

User: test-skip
Steps:

  1. Login with test-skip / test123
  2. Organization Setup screen appears
  3. Click "Skip for now β†’" button
  4. Verify redirected to main workspace
  5. Check workspace created: ls ~/.claude/projects/default-workspace
  6. Go to Settings β†’ Organization tab
  7. Click "Launch Organization Setup"
  8. Verify setup screen reappears

Expected Results:

  • Workspace created even when skipped
  • Can re-access from Settings
  • Database shows onboarding_completed = 1

Scenario 2: Document Upload & Processing

User: test-upload
Steps:

  1. Login with test-upload / test123
  2. Drag & drop files from /test-docs/
  3. Watch file upload confirmation
  4. Click "Process Documents & Launch Sasha"
  5. Monitor processing animation
  6. Verify Claude auto-launches with research prompt
  7. Check converted files in workspace

Verification Commands:

# Check converted documents
ls -la ~/.claude/projects/default-workspace/docs/local/

# View document index
cat ~/.claude/projects/default-workspace/docs/local/index.md

# Check CLAUDE.md was created
cat ~/.claude/projects/default-workspace/CLAUDE.md

Scenario 3: Complete Flow with Company Details

User: test-complete
Steps:

  1. Login with test-complete / test123
  2. Upload multiple documents
  3. Wait for processing
  4. On review screen, enter:
  5. Click "Complete Setup & Enter Workspace"
  6. Verify Claude launches with detailed prompt
  7. Check knowledge base creation

Scenario 4: Re-Access from Settings

Prerequisites: User has already completed/skipped setup
Steps:

  1. Login to existing account
  2. Navigate to Settings (gear icon)
  3. Click "Organization" tab
  4. Review organization information
  5. Click "Launch Organization Setup"
  6. Verify setup screen appears
  7. Can upload new documents or skip again

Browser Testing Tools

Developer Console Commands

// Force show Organization Setup
sessionStorage.setItem('showOrganizationSetup', 'true');
location.reload();

// Check onboarding status
console.log(sessionStorage.getItem('organizationResearchPrompt'));

// Clear all session data
sessionStorage.clear();
localStorage.removeItem('auth-token');
location.reload();

// Simulate document upload completion
sessionStorage.setItem('organizationResearchPrompt', 
  'Research Acme Corporation using uploaded documents...');

Network Monitoring

  1. Open Chrome DevTools β†’ Network tab
  2. Filter by "Fetch/XHR"
  3. Monitor these endpoints:
    • POST /api/profile/organization/skip
    • POST /api/profile/organization/complete
    • GET /api/profile/onboarding/status/:jobId

Database Verification

Check User Status

# View all users and onboarding status
sqlite3 server/database/auth.db "
SELECT 
    u.id,
    u.username, 
    cp.onboarding_completed,
    cp.company_name,
    cp.onboarding_method
FROM users u
LEFT JOIN company_profiles cp ON u.id = cp.user_id
ORDER BY u.id DESC;"

# Check uploaded documents
sqlite3 server/database/auth.db "
SELECT 
    original_name,
    document_category,
    file_size,
    upload_date
FROM onboarding_documents
ORDER BY upload_date DESC;"

Reset Specific User

-- Reset onboarding for specific user
UPDATE company_profiles 
SET onboarding_completed = 0,
    onboarding_method = NULL
WHERE user_id = (SELECT id FROM users WHERE username = 'testuser');

-- Clear user's documents
DELETE FROM onboarding_documents 
WHERE user_id = (SELECT id FROM users WHERE username = 'testuser');

Workspace Verification

Check Workspace Structure

# View workspace tree
tree ~/.claude/projects/default-workspace/

# Expected structure:
# default-workspace/
# β”œβ”€β”€ CLAUDE.md
# └── docs/
#     β”œβ”€β”€ guides/
#     β”‚   └── organization-research-guide.md
#     β”œβ”€β”€ local/
#     β”‚   β”œβ”€β”€ README.md
#     β”‚   β”œβ”€β”€ index.md
#     β”‚   └── [converted documents]
#     └── organization/
#         └── [AI-generated docs]

Verify Document Conversion

# List converted documents
find ~/.claude/projects/default-workspace/docs/local -name "*.md" -type f

# Check document content
head -20 ~/.claude/projects/default-workspace/docs/local/*/*.md

# Verify categories
ls ~/.claude/projects/default-workspace/docs/local/
# Should show: pitch_deck, employee_handbook, general, etc.

Automated Testing

Continuous Test Script

Create test-cycle.sh:

#!/bin/bash
# Automated test cycle

echo "πŸ”„ Starting automated test cycle..."

# Test 1: Skip flow
echo "Test 1: Skip functionality"
./scripts/reset-onboarding.sh --soft
echo "Login as test-skip and click Skip"
read -p "Press enter when complete..."

# Test 2: Upload flow
echo "Test 2: Document upload"
node scripts/test-users.js reset test-upload
echo "Login as test-upload and upload docs"
read -p "Press enter when complete..."

# Test 3: Complete flow
echo "Test 3: Full completion"
node scripts/test-users.js reset test-complete
echo "Login as test-complete and complete all steps"
read -p "Press enter when complete..."

echo "βœ… Test cycle complete!"

Watch for Changes

# Monitor workspace creation in real-time
watch -n 1 'ls -la ~/.claude/projects/default-workspace/docs/local/ 2>/dev/null || echo "No workspace yet"'

# Monitor database changes
watch -n 2 'sqlite3 server/database/auth.db "SELECT username, onboarding_completed FROM users u LEFT JOIN company_profiles cp ON u.id = cp.user_id"'

Troubleshooting

Common Issues

Issue Solution
Onboarding doesn't show Run ./scripts/reset-onboarding.sh --soft
Documents won't upload Check uploads/onboarding/ permissions: chmod 755 uploads/onboarding
Claude doesn't auto-launch Clear sessionStorage in browser console
Processing stuck Check server logs: docker logs sasha-test
Workspace not created Verify disk space and permissions in ~/.claude/projects/
Settings shows wrong state Hard refresh browser: Cmd+Shift+R (Mac)

Debug Commands

# Check server logs
docker logs -f sasha-test --tail 100

# Monitor file uploads
ls -la uploads/onboarding/

# Check WebSocket connection
curl -i -N -H "Connection: Upgrade" -H "Upgrade: websocket" http://localhost:3005/ws

# Verify API endpoints
curl -X POST http://localhost:3005/api/profile/organization/skip \
  -H "Authorization: Bearer YOUR_TOKEN"

Testing Checklist

Pre-Setup

  • Server running (docker ps or npm run dev)
  • Test users created (node scripts/test-users.js list)
  • Test documents available (ls test-docs/)
  • Database accessible (sqlite3 server/database/auth.db .tables)

Organization Setup Screen

  • Displays for new users
  • Skip button visible and functional
  • Drag & drop zone accepts files
  • Multiple file upload works
  • File type validation works
  • Privacy messaging displays
  • Document categories show correctly

Processing

  • Upload progress shows
  • Processing animation displays
  • Status updates work
  • Error handling for failed uploads
  • Successful completion message

Post-Setup

  • Workspace created at correct path
  • Documents converted to Markdown
  • CLAUDE.md generated with context
  • Document index created
  • Claude auto-launches with prompt
  • Database updated correctly

Settings Integration

  • Organization tab appears in Settings
  • Shows current organization info
  • "Launch Organization Setup" button works
  • Returns to main app after completion

Edge Cases

  • Empty file upload handling
  • Very large file handling (>50MB)
  • Unsupported file type rejection
  • Network interruption recovery
  • Concurrent user setup

Performance Testing

Load Testing

# Upload multiple files simultaneously
for i in {1..10}; do
  cp test-docs/acme-company-overview.md test-docs/test-$i.md
done

# Monitor processing
time curl -X POST http://localhost:3005/api/profile/organization/complete \
  -H "Authorization: Bearer TOKEN" \
  -F "documents=@test-docs/test-1.md" \
  -F "documents=@test-docs/test-2.md" \
  -F "documents=@test-docs/test-3.md"

Memory Usage

# Monitor Node.js memory usage
docker stats sasha-test

# Check workspace size
du -sh ~/.claude/projects/default-workspace/

Best Practices

  1. Always reset between tests to ensure clean state
  2. Use different test users for different scenarios
  3. Monitor server logs during testing
  4. Verify database state after each test
  5. Check workspace structure for proper file organization
  6. Test with various file types and sizes
  7. Document any issues found during testing

Quick Reference

# Most common test commands
./scripts/reset-onboarding.sh --soft     # Reset current user
node scripts/test-users.js quick          # Create test users
node scripts/test-users.js list           # List test users
docker logs -f sasha-test                 # Watch server logs
open http://localhost:3005                # Open app

# One-liner test reset
./scripts/reset-onboarding.sh --soft && open http://localhost:3005

This testing guide ensures you can efficiently and repeatedly test the Organization Setup feature with confidence.