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


πŸ§ͺ Test Scenarios

Test 1: Basic Cross-Browser Sync βœ…

Goal: Verify data syncs from one browser to another

Steps:

  1. 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)
  2. Browser B (Firefox):

    • Open app: http://localhost:5200
    • Login with same user credentials
    • Reload page
    • Expected: Should see "test-universe-1" βœ…
  3. 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:

  1. Browser A:

    • Create "universe-A"
    • Wait 5 seconds
  2. Browser B (while A is syncing):

    • Create "universe-B"
    • Wait 5 seconds
  3. Both Browsers:

    • Reload pages
    • Expected: Both should show universe-A AND universe-B βœ…
  4. 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:

  1. Browser A:

    • Open DevTools β†’ Network β†’ Offline
    • Create "offline-universe-A"
    • Keep page open
  2. Browser B:

    • Open DevTools β†’ Network β†’ Offline
    • Create "offline-universe-B"
    • Keep page open
  3. Browser A:

    • Network β†’ Online
    • Wait 10 seconds (allow sync)
    • Check: Backend should have "offline-universe-A"
  4. Browser B:

    • Network β†’ Online
    • Wait 10 seconds (allow sync)
    • Check: Backend should have BOTH universes
  5. Browser A:

    • Reload page
    • Expected: Should show offline-universe-A AND offline-universe-B βœ…
  6. 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:

  1. Browser A:

    • Create "universe-1", "universe-2", "universe-3"
    • Wait for sync
  2. Browser B:

    • Clear local storage (but NOT IndexedDB)
    • Reload page
    • Expected: Should fetch all 3 universes from backend βœ…
  3. Browser B:

    • Create "universe-4"
    • Wait for sync
  4. Browser A:

    • Reload page
    • Expected: Should show all 4 universes βœ…
  5. 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:

  1. Browser A (offline):

    • Change space name to "Space-A-Name"
  2. Browser B (offline):

    • Wait 2 seconds (ensure later timestamp)
    • Change space name to "Space-B-Name"
  3. Browser A (online):

    • Sync β†’ Backend has "Space-A-Name"
  4. Browser B (online):

    • Sync β†’ Backend should update to "Space-B-Name" (newer timestamp)
  5. Browser A:

    • Reload
    • Expected: Should show "Space-B-Name" (newer wins) βœ…
  6. 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:

  1. Setup:

    • Browser A has universe with ID "12345"
    • Backend has universe with ID "12345"
  2. Browser A (offline):

    • Create another universe "67890"
    • Local now has ["12345", "67890"]
  3. Browser A (online):

    • Sync
    • Expected: Backend should have ["12345", "67890"] (no duplicate "12345")
  4. 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:

Backend Logs

Should show:

[SpacesService] Updating space: 69067c087ebb621cd9ff8e3f
[SpacesService] βœ… Space updated with X universes

πŸ› Debugging Failed Tests

Test Failed: Data Not Syncing

Check:

  1. Is backend running? (http://localhost:3000/api/health)
  2. Is useMockApi: false?
  3. Are JWT tokens valid? (check Application β†’ Cookies)
  4. Is sync enabled? (check console for "Sync enabled: true")

Fix:

Test Failed: Merge Not Working

Check:

  1. Console shows "Pull from backend not implemented yet"? (old code!)
  2. Console shows "Array merge" logs? (should!)
  3. Backend data matches what you expect? (check via network tab)

Fix:

Test Failed: Console Errors

Check:

  1. Still seeing "undefined entity" errors? (corrupted queue!)
  2. Authentication errors? (JWT expired)
  3. Network errors? (backend down)

Fix:


βœ… Success Criteria

All tests should pass with:


πŸ“Š 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 βœ…

  1. 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 issues
    
  2. Update status in related documents

  3. Share with team for review

If Tests Fail ❌

  1. Document the failure (what happened, expected vs actual)
  2. Check debugging section above
  3. Review console logs for clues
  4. Test in isolation (single browser first)

πŸ“š Related Documentation


Last Updated: November 17, 2025
Status: Ready for Testing
Estimated Time: 30-45 minutes for all tests