Multi-Browser Sync Testing Guide
Step-by-step guide to test and verify multi-browser synchronization
Multi-Browser Sync Testing Guide
π― Objective
Verify that the intelligent sync with conflict resolution is working correctly across multiple browsers.
π Prerequisites
- β
Backend API is running (
http://localhost:3000) - β
useMockApi: falsein environment configuration - β Corrupted queue cleared in ALL browsers
- β Two or more browsers available for testing
π§ͺ Test Scenarios
Test 1: Basic Cross-Browser Sync β
Goal: Verify data syncs from one browser to another
Steps:
Browser A (Chrome):
- Open app:
http://localhost:5200 - Login/continue as guest
- Note space ID in dashboard
- Create a universe called "test-universe-1"
- Wait 5 seconds (auto-sync)
- Open app:
Browser B (Firefox):
- Open app:
http://localhost:5200 - Login with same user credentials
- Reload page
- Expected: Should see "test-universe-1" β
- Open app:
Verify:
- Same space ID in both browsers
- "test-universe-1" visible in Browser B
- No console errors in either browser
Status: β¬ Not Tested | β Passed | β Failed
Test 2: Simultaneous Creation (Online) β
Goal: Verify concurrent operations merge correctly
Steps:
Browser A:
- Create "universe-A"
- Wait 5 seconds
Browser B (while A is syncing):
- Create "universe-B"
- Wait 5 seconds
Both Browsers:
- Reload pages
- Expected: Both should show universe-A AND universe-B β
Verify:
- Browser A shows both universes
- Browser B shows both universes
- Backend has both (check network tab or backend logs)
Status: β¬ Not Tested | β Passed | β Failed
Test 3: Offline Conflict Resolution π₯
Goal: Verify intelligent merging when working offline
Steps:
Browser A:
- Open DevTools β Network β Offline
- Create "offline-universe-A"
- Keep page open
Browser B:
- Open DevTools β Network β Offline
- Create "offline-universe-B"
- Keep page open
Browser A:
- Network β Online
- Wait 10 seconds (allow sync)
- Check: Backend should have "offline-universe-A"
Browser B:
- Network β Online
- Wait 10 seconds (allow sync)
- Check: Backend should have BOTH universes
Browser A:
- Reload page
- Expected: Should show offline-universe-A AND offline-universe-B β
Verify:
- No data loss (both universes present)
- Console shows merge logs
- Both browsers synchronized
Status: β¬ Not Tested | β Passed | β Failed
Test 4: Pull Before Push β
Goal: Verify sync pulls backend data before pushing
Steps:
Browser A:
- Create "universe-1", "universe-2", "universe-3"
- Wait for sync
Browser B:
- Clear local storage (but NOT IndexedDB)
- Reload page
- Expected: Should fetch all 3 universes from backend β
Browser B:
- Create "universe-4"
- Wait for sync
Browser A:
- Reload page
- Expected: Should show all 4 universes β
Verify:
- Browser B pulled existing data before pushing
- New data merged correctly
- No duplicates
Status: β¬ Not Tested | β Passed | β Failed
Test 5: Space Name Conflict Resolution β
Goal: Verify timestamp-based conflict resolution for scalars
Steps:
Browser A (offline):
- Change space name to "Space-A-Name"
Browser B (offline):
- Wait 2 seconds (ensure later timestamp)
- Change space name to "Space-B-Name"
Browser A (online):
- Sync β Backend has "Space-A-Name"
Browser B (online):
- Sync β Backend should update to "Space-B-Name" (newer timestamp)
Browser A:
- Reload
- Expected: Should show "Space-B-Name" (newer wins) β
Verify:
- Newer timestamp wins
- Both browsers show same name
- Console shows merge decision logs
Status: β¬ Not Tested | β Passed | β Failed
Test 6: Array Deduplication β
Goal: Verify union merge doesn't create duplicates
Steps:
Setup:
- Browser A has universe with ID "12345"
- Backend has universe with ID "12345"
Browser A (offline):
- Create another universe "67890"
- Local now has ["12345", "67890"]
Browser A (online):
- Sync
- Expected: Backend should have ["12345", "67890"] (no duplicate "12345")
Verify:
- No duplicate universe IDs
- Console shows array merge with correct count
- Backend has unique IDs only
Status: β¬ Not Tested | β Passed | β Failed
π Monitoring During Tests
Console Logs to Watch For
β Good Signs:
[SyncEngine] π Starting sync...
[SyncEngine] π€ Pushing X operations to backend
[SyncEngine] π₯ Pulling changes from backend
[SyncEngine] β
Pulled and merged space from backend
[SyncEngine] Array merge: local: 2, remote: 1, merged: 3, added: 1
[SyncEngine] β
Sync complete
β Bad Signs:
β οΈ Unknown entity type: undefined
β Failed to sync operation
Sync failed: Network error
Network Tab
Watch for these API calls:
GET /api/spaces/:idβ PullPUT /api/spaces/:idβ PushPOST /api/spaces/initializeβ Initial setup
Backend Logs
Should show:
[SpacesService] Updating space: 69067c087ebb621cd9ff8e3f
[SpacesService] β
Space updated with X universes
π Debugging Failed Tests
Test Failed: Data Not Syncing
Check:
- Is backend running? (
http://localhost:3000/api/health) - Is
useMockApi: false? - Are JWT tokens valid? (check Application β Cookies)
- Is sync enabled? (check console for "Sync enabled: true")
Fix:
- Restart backend
- Clear cookies and re-authenticate
- Check environment configuration
Test Failed: Merge Not Working
Check:
- Console shows "Pull from backend not implemented yet"? (old code!)
- Console shows "Array merge" logs? (should!)
- Backend data matches what you expect? (check via network tab)
Fix:
- Verify code changes were applied
- Hard reload (Ctrl+Shift+R)
- Check git status for uncommitted changes
Test Failed: Console Errors
Check:
- Still seeing "undefined entity" errors? (corrupted queue!)
- Authentication errors? (JWT expired)
- Network errors? (backend down)
Fix:
- Run clear queue script again
- Re-authenticate (logout/login)
- Restart backend
β Success Criteria
All tests should pass with:
- No console errors
- Data syncs across browsers
- No data loss in conflict scenarios
- Arrays merge correctly (no duplicates)
- Timestamp-based resolution works
- OfflineβOnline sync works
- Backend matches all clients
π Test Results Template
Copy this template to track your results:
## Test Results - [Date]
### Test 1: Basic Cross-Browser Sync
- Status: β¬ Not Tested | β
Passed | β Failed
- Notes:
### Test 2: Simultaneous Creation
- Status: β¬ Not Tested | β
Passed | β Failed
- Notes:
### Test 3: Offline Conflict Resolution
- Status: β¬ Not Tested | β
Passed | β Failed
- Notes:
### Test 4: Pull Before Push
- Status: β¬ Not Tested | β
Passed | β Failed
- Notes:
### Test 5: Space Name Conflict
- Status: β¬ Not Tested | β
Passed | β Failed
- Notes:
### Test 6: Array Deduplication
- Status: β¬ Not Tested | β
Passed | β Failed
- Notes:
### Overall Result
- All tests passed: β
| β
- Issues found:
- Next steps:
π After Testing
If All Tests Pass β
Commit changes with message:
fix: implement intelligent multi-browser sync with conflict resolution - Implement pullFromBackend with intelligent merging - Add union merge for universeIds arrays - Add timestamp-based conflict resolution for scalars - Add getSpace(id) API method - Create comprehensive documentation Fixes multi-browser synchronization issuesUpdate status in related documents
Share with team for review
If Tests Fail β
- Document the failure (what happened, expected vs actual)
- Check debugging section above
- Review console logs for clues
- Test in isolation (single browser first)
π Related Documentation
- Multi-Browser Sync Fix Complete
- Offline-First Conflict Resolution
- Clear Corrupted Queue Script
- Final Architecture Summary
Last Updated: November 17, 2025
Status: Ready for Testing
Estimated Time: 30-45 minutes for all tests