# ContactImportView.vue Migration Testing Checklist

## Migration Details
- **Component**: src/views/ContactImportView.vue
- **Migration Date**: 2025-07-06
- **Migration Type**: Database Operations + Logging to PlatformServiceMixin
- **Priority**: Medium
- **Author**: Matthew Raymer

## Migration Changes
- ✅ Removed legacy imports: `logConsoleAndDb`, `databaseUtil`, `PlatformServiceFactory`
- ✅ Added PlatformServiceMixin integration
- ✅ Converted database operations to mixin methods
- ✅ Updated logging to use `this.$logAndConsole()`
- ✅ Removed unused helper functions and interfaces

## Platform Testing Requirements

### Web Platform Testing

#### Test URLs for Manual Testing
```
# Basic contact import page
http://localhost:3000/contact-import

# URL parameter import (single contact)
http://localhost:3000/contact-import?contacts=[{"did":"did:test:123","name":"Test User","notes":"Test contact via URL"}]

# URL parameter import (multiple contacts)
http://localhost:3000/contact-import?contacts=[{"did":"did:test:123","name":"Alice"},{"did":"did:test:456","name":"Bob"}]

# Manual JWT input testing (paste JWT into textarea)
http://localhost:3000/contact-import
```

#### Functional Test Cases

##### 1. Basic Page Load
- [ ] Navigate to `/contact-import`
- [ ] Page loads without errors
- [ ] No console errors displayed
- [ ] Manual JWT input textarea is visible
- [ ] "Check Import" button is present

##### 2. URL Parameter Import (Single Contact)
- [ ] Navigate to URL with single contact parameter
- [ ] Contact displays in import list
- [ ] Contact is pre-selected for import
- [ ] "Make my activity visible" checkbox is available
- [ ] "Import Selected Contacts" button is present

##### 3. URL Parameter Import (Multiple Contacts)
- [ ] Navigate to URL with multiple contacts parameter
- [ ] All contacts display in import list
- [ ] All contacts are pre-selected for import
- [ ] Individual contact selection works
- [ ] Bulk import functionality works

##### 4. Manual JWT Input
- [ ] Paste valid JWT into textarea
- [ ] Click "Check Import" button
- [ ] Valid JWT displays contacts for import
- [ ] Invalid JWT shows appropriate error message

##### 5. Duplicate Contact Detection
- [ ] Import contact that already exists
- [ ] System detects duplicate correctly
- [ ] Shows "Existing" label for duplicate
- [ ] Displays field differences (if any)
- [ ] Duplicate is not pre-selected for import

##### 6. Contact Import Process
- [ ] Select contacts for import
- [ ] Click "Import Selected Contacts"
- [ ] Loading indicator appears
- [ ] Success message displays
- [ ] Redirects to contacts page
- [ ] Imported contacts appear in contacts list

##### 7. Visibility Setting
- [ ] Check "Make my activity visible" checkbox
- [ ] Import contacts
- [ ] Verify visibility is set for imported contacts
- [ ] Test with visibility setting disabled

##### 8. Error Handling
- [ ] Test with malformed JWT
- [ ] Test with empty JWT
- [ ] Test network failure scenarios
- [ ] Test with invalid contact data format
- [ ] Verify error messages display appropriately

##### 9. Database Operations Testing
- [ ] Import new contacts - verify database insertion
- [ ] Update existing contacts - verify database update
- [ ] Check contact data persistence after app reload
- [ ] Verify contact relationships are maintained

##### 10. Logging Validation
- [ ] Open browser developer tools
- [ ] Trigger error scenarios
- [ ] Verify errors appear in console with proper formatting
- [ ] Check database logs table for stored errors
- [ ] Verify log entries include appropriate context

#### Technical Validation

##### Browser Developer Tools
- [ ] Console shows no errors during normal operation
- [ ] Console shows properly formatted error messages when errors occur
- [ ] Network tab shows appropriate API calls
- [ ] Application tab shows IndexedDB updates

##### Database Verification
- [ ] Open Application > IndexedDB > TimeSafari database
- [ ] Verify contacts table updates correctly
- [ ] Check logs table for error entries
- [ ] Verify data structure matches expected format

##### Performance Validation
- [ ] Page loads within reasonable time
- [ ] Import operations complete without freezing UI
- [ ] Large contact lists (10+) import efficiently
- [ ] No memory leaks during extended use

### Desktop Platform Testing
- [ ] Test Electron app functionality
- [ ] Verify database operations work in Electron context
- [ ] Test file system access (if applicable)
- [ ] Verify native desktop integrations

### Mobile Platform Testing
- [ ] Test iOS app via Capacitor
- [ ] Test Android app via Capacitor
- [ ] Verify mobile-specific features
- [ ] Test deep linking functionality

## Test Data Templates

### Single Contact JSON
```json
[{"did":"did:test:single","name":"Single Test User","notes":"Test contact for single import"}]
```

### Multiple Contacts JSON
```json
[
  {"did":"did:test:alice","name":"Alice Johnson","notes":"First test contact"},
  {"did":"did:test:bob","name":"Bob Smith","notes":"Second test contact"},
  {"did":"did:test:charlie","name":"Charlie Brown","notes":"Third test contact"}
]
```

### Malformed Data (Error Testing)
```json
[{"invalid":"data","missing":"did"}]
```

## Expected Outcomes

### Successful Import
- Contacts appear in main contacts list
- Database contains new contact entries
- Success notification displays
- Redirect to contacts page occurs

### Duplicate Handling
- Existing contacts show "Existing" label
- Field differences are highlighted
- User can choose to update or skip
- System prevents duplicate entries

### Error Scenarios
- Malformed data shows clear error messages
- Network failures are handled gracefully
- Invalid JWTs display appropriate warnings
- Console logs contain debugging information

## Sign-Off Checklist

### Web Platform ✅/❌
- [ ] Chrome: Tested by [Name] on [Date]
- [ ] Firefox: Tested by [Name] on [Date]
- [ ] Safari: Tested by [Name] on [Date]
- [ ] Notes: [Any platform-specific issues or observations]

### Desktop Platform ✅/❌
- [ ] Windows: Tested by [Name] on [Date]
- [ ] macOS: Tested by [Name] on [Date]
- [ ] Linux: Tested by [Name] on [Date]
- [ ] Notes: [Any platform-specific issues or observations]

### Mobile Platform ✅/❌
- [ ] iOS: Tested by [Name] on [Date]
- [ ] Android: Tested by [Name] on [Date]
- [ ] Notes: [Any platform-specific issues or observations]

### Final Sign-Off
- [ ] All platforms tested and working
- [ ] No regressions identified
- [ ] Performance is acceptable
- [ ] Migration completed by: [Name] on [Date]

## Known Issues/Limitations
- Document any known issues discovered during testing
- Note any platform-specific limitations
- Record any workarounds implemented

## Notes
- Include any additional observations
- Record performance metrics if applicable
- Note any suggestions for future improvements 