Files
PowderCoatingLogix/QUICK_CSV_IMPORT_TEST.md
2026-04-23 21:38:24 -04:00

207 lines
7.0 KiB
Markdown

# Quick CSV Import Test Guide
## Starting the Application
```bash
cd src/PowderCoating.Web
dotnet run
```
Access at: https://localhost:58461
## Login Credentials
- **SuperAdmin**: `superadmin@powdercoating.com` / `SuperAdmin123!`
- **Company Admin**: `admin@demo.com` / `CompanyAdmin123!`
## Test Steps
### 1. Navigate to CSV Import
1. Login to the application
2. Click **Tools** in the navigation menu
3. Scroll down to the **CSV Bulk Import** card (yellow border)
4. You'll see 3 tabs: Customers, Catalog Items, Inventory
### 2. Test Customer Import
#### Download Template
1. Click on **Customers** tab
2. Click **Download Customer Template** button
3. Open the downloaded CSV file in Excel or text editor
4. You'll see headers and one example row
#### Modify Template
Add a few test customers:
```csv
CompanyName,ContactName,Email,Phone,Address,City,State,ZipCode,CustomerType,PricingTierCode,CreditLimit,PaymentTerms,TaxExempt,Notes
Test Company 1,Alice Smith,alice@test1.com,555-0001,100 Test St,Chicago,IL,60601,Commercial,Gold,10000,Net 30,false,Test customer 1
Test Company 2,Bob Jones,bob@test2.com,555-0002,200 Test Ave,Chicago,IL,60602,Commercial,Silver,5000,Net 15,false,Test customer 2
Home User,John Doe,john@home.com,555-0003,300 Home Ln,Chicago,IL,60603,Individual,,0,Cash,true,Individual customer
```
#### Import
1. Save the CSV file
2. Click **Choose File** in the Upload section
3. Select your modified CSV file
4. Click **Import Customers** button
5. Watch for:
- Loading spinner appears
- After processing, results card appears showing:
- Number of records imported (green)
- Number of errors (red)
- Total rows processed (blue)
- Toast notification in bottom-right corner
6. Verify by going to **Customers** page - you should see your new customers
### 3. Test Catalog Item Import
#### Download Template
1. Click on **Catalog Items** tab
2. Click **Download Catalog Template** button
3. Open the downloaded CSV file
#### Modify Template
Add items with hierarchical categories:
```csv
CategoryPath,ItemName,SKU,Description,BasePrice,UnitOfMeasure,EstimatedWeight,EstimatedSurfaceArea,RequiresSandblasting,RequiresMasking,IsActive
Automotive/Wheels/Standard,Car Wheel 17",WHL-17-STD,Standard 17 inch wheel,85.00,each,18.0,5.0,true,true,true
Automotive/Wheels/Performance,Car Wheel 18" Sport,WHL-18-SPORT,Performance 18 inch wheel,120.00,each,20.0,5.5,true,true,true
Industrial/Railings/Commercial,Stair Handrail 6ft,RAIL-6FT-STR,6 foot stair handrail,95.00,section,15.0,8.0,true,false,true
Furniture/Outdoor/Patio,Patio Chair Frame,FURN-CHAIR-PAT,Patio chair metal frame,45.00,each,12.0,6.0,true,false,true
```
#### Import
1. Save and import the CSV file
2. Check results - you should see 4 items imported
3. **Important**: The categories will be auto-created!
- "Automotive" → "Wheels" → "Standard"
- "Automotive" → "Wheels" → "Performance"
- "Industrial" → "Railings" → "Commercial"
- "Furniture" → "Outdoor" → "Patio"
4. Verify by going to **Catalog** page - browse the category tree
### 4. Test Inventory Item Import
#### Download Template
1. Click on **Inventory** tab
2. Click **Download Inventory Template** button
#### Modify Template
Add powder coating inventory:
```csv
SKU,ItemName,CategoryName,Manufacturer,ColorName,ColorCode,QuantityInStock,UnitOfMeasure,UnitCost,ReorderPoint,ReorderQuantity,Notes
PWD-RED-001,Red Powder Coating,Powder Coatings,Tiger Drylac,Red,RAL 3020,400,lbs,3.85,80,150,Traffic red
PWD-BLU-001,Blue Powder Coating,Powder Coatings,Tiger Drylac,Blue,RAL 5005,300,lbs,3.95,60,120,Signal blue
PWD-GRN-001,Green Powder Coating,Powder Coatings,Axalta,Green,RAL 6018,250,lbs,4.10,50,100,Yellow green
SAND-MEDIA-001,Sandblasting Media,Consumables,Generic,Brown,,500,lbs,1.25,100,300,Aluminum oxide
```
#### Import
1. Save and import the CSV file
2. Check results - should show 4 items imported
3. Verify by going to **Inventory** page
### 5. Test Error Handling
#### Duplicate Detection
1. Try importing the same CSV file again
2. You should see:
- 0 records imported
- Warnings about duplicate emails/SKUs
- Detailed list of skipped rows
#### Missing Required Fields
Create a CSV with missing CompanyName:
```csv
CompanyName,ContactName,Email,Phone,Address,City,State,ZipCode,CustomerType,PricingTierCode,CreditLimit,PaymentTerms,TaxExempt,Notes
,Missing Company,missing@test.com,555-9999,,,,,,,,,
```
Expected: Error message "Row 2: CompanyName is required."
#### Invalid Pricing Tier
```csv
CompanyName,ContactName,Email,Phone,Address,City,State,ZipCode,CustomerType,PricingTierCode,CreditLimit,PaymentTerms,TaxExempt,Notes
Test Company,Jane Doe,jane@test.com,555-8888,400 Test St,Chicago,IL,60604,Commercial,Diamond,15000,Net 30,false,Invalid tier
```
Expected: Warning "Pricing tier 'Diamond' not found. Customer will have no pricing tier." but customer still imported.
### 6. Verify Results
After all imports:
1. **Customers Page**:
- Should see all imported customers
- Check that pricing tiers are assigned correctly
- Verify contact information is accurate
2. **Catalog Page**:
- Expand category tree to see hierarchical structure
- Verify all items are under correct categories
- Check that prices and SKUs are correct
3. **Inventory Page**:
- See all powder coatings and consumables
- Verify quantities, costs, and reorder points
- Check color codes and manufacturer info
## Common Issues
### Issue: "No file provided or file is empty"
**Solution**: Make sure you selected a file before clicking Import
### Issue: "Only CSV files are allowed"
**Solution**: Save file as .csv (not .xlsx or .txt)
### Issue: "Pricing tier 'XXX' not found"
**Solution**: Use Standard, Silver, Gold, or Platinum (case-insensitive)
### Issue: Categories not showing up
**Solution**:
- Check CategoryPath format: "Parent/Child/GrandChild"
- No leading/trailing slashes
- Use forward slashes only
### Issue: Build errors
**Solution**: Make sure CsvHelper is installed:
```bash
cd src/PowderCoating.Infrastructure
dotnet add package CsvHelper
cd ../PowderCoating.Application
dotnet add package CsvHelper
```
## Success Indicators
✅ Templates download successfully
✅ CSV files import without errors
✅ Success counts match expected numbers
✅ Data appears in respective pages (Customers, Catalog, Inventory)
✅ Categories auto-created for catalog items
✅ Duplicates are detected and skipped
✅ Error messages are clear and actionable
✅ Toast notifications appear
✅ Results card shows detailed summary
## Next Steps
Once basic import is working:
1. Try importing larger files (50+ rows)
2. Test with deep category hierarchies (4-5 levels)
3. Verify multi-tenancy (different companies can't see each other's imports)
4. Export QuickBooks data and re-import via CSV
5. Use CSV import for initial data seeding instead of manual entry
## Performance Benchmarks
Expected import times (approximate):
- 10 rows: < 1 second
- 50 rows: < 3 seconds
- 100 rows: < 5 seconds
- 500 rows: < 15 seconds
- 1000 rows: < 30 seconds
Times will vary based on:
- Number of categories to create
- Database size
- Server performance