Wave Integration Testing Guide โ
Overview โ
Waves are now fully integrated with Firebase! This guide helps you test the complete wave flow with real Firestore data.
Prerequisites โ
- Two test accounts (or two devices/browsers)
- Firestore rules deployed: Run
npm run deploy:rules(see DEPLOY_FIREBASE_RULES.md) - Firestore indexes created (see below)
Required Firestore Indexes โ
The wave system requires composite indexes for efficient querying. Create these in the Firebase Console:
Waves Collection โ
Index 1: Incoming waves query
- Collection:
waves - Fields:
recipientUserId(Ascending)status(Ascending)sentAt(Descending)
Index 2: Check existing waves
- Collection:
waves - Fields:
senderUserId(Ascending)recipientUserId(Ascending)status(Ascending)
Connections Collection โ
Index 1: User 1 connections
- Collection:
connections - Fields:
user1Id(Ascending)status(Ascending)
Index 2: User 2 connections
- Collection:
connections - Fields:
user2Id(Ascending)status(Ascending)
Lanterns Collection โ
Index 1: Venue lanterns
- Collection:
lanterns - Fields:
venueId(Ascending)status(Ascending)litAt(Descending)
Index 2: User lanterns at venue
- Collection:
lanterns - Fields:
userId(Ascending)venueId(Ascending)status(Ascending)
How to create indexes:
- Go to Firebase Console
- Select your project
- Go to Firestore Database > Indexes
- Click "Add Index"
- Add each index above
Or run the app and Firebase will show you the exact index creation links in the console when queries fail!
Testing Workflow โ
Setup (Both Users) โ
User 1: alice@test.com โ
- Log in with Alice account
- Go to Profile Settings
- Enable "Spoof location" toggle
- Enter San Diego coordinates:
32.7157,-117.1611 - Return to Dashboard
User 2: bob@test.com โ
- Log in with Bob account (different browser/device/incognito)
- Enable location spoof with same coordinates
- Return to Dashboard
Test Flow โ
Step 1: Both Users Light Lanterns at Same Venue โ
User 1 (Alice):
- On Dashboard home, find "Brew & Co Coffee" (should show 0.0 mi away)
- Click venue card
- Click "Light My Lantern"
- Enter interest: "Looking for React dev to pair program"
- Select mood: "Conversation"
- Confirm
- You should see success screen
User 2 (Bob):
- Find "Brew & Co Coffee"
- Click venue card
- You should now see Alice's lantern!
- Should show her interest: "Looking for React dev to pair program"
- Mood: "Conversation"
- Time: "Just now"
- Light your own lantern
- Interest: "Want to discuss TypeScript tips"
- Mood: "Conversation"
- Confirm
Expected:
- Both users have active lanterns at the same venue
- Venue counter shows "2" lanterns
- Each user can see the other's lantern when viewing the venue
Step 2: Send Wave โ
User 2 (Bob):
- Still in venue view, you should see Alice's lantern card
- Click the "Wave ๐" button
- Console should log:
๐ Wave sent successfully!
Expected:
- Wave document created in Firestore
- No error messages
Step 3: Receive & Accept Wave โ
User 1 (Alice):
- Within seconds, a wave notification should appear at the bottom of the screen
- Notification shows:
- "Someone waved!"
- Interest: "Want to discuss TypeScript tips"
- Mood: "Conversation"
- Venue: "Brew & Co Coffee"
- Click "Accept" button
- Chat window should open automatically
- Banner shows connection details and matching color
Expected:
- Wave notification appears in real-time (no page refresh needed)
- Accepting wave opens chat
- Both users get the same matching color (amber, purple, blue, green, or pink)
Step 4: Chat & Beacon โ
Both Users:
- In chat, type a message and send
- Other user should see message in real-time
- Click "Hold Up Lantern to Meet" button
- Full-screen color beacon appears
- Both users show the same color
Expected:
- Messages appear in real-time
- Beacon colors match between users
- Beacon stays open until user closes it
Step 5: Close and Verify Connection Persists โ
Both Users:
- Close beacon (X button)
- Close chat (X button)
- Check WaveManager at bottom - you should see "Open Chat" button
- Click it to reopen chat
Expected:
- Connection persists even after closing chat
- Can reopen chat anytime from WaveManager
Troubleshooting โ
Wave not appearing? โ
Check Firebase console logs:
- Go to Firestore Database > Data
- Look for
wavescollection - Verify wave document was created with correct recipientUserId
Check browser console:
- Look for errors about missing indexes
- Firebase will provide direct links to create missing indexes
Verify authentication:
- Both users must be logged in
- Check console for "No authenticated user" warnings
Lanterns not showing in venue? โ
Check venue coordinates:
- Both users must have same lat/lng
- Verify in Profile Settings location spoof
Check lantern status:
- In Firestore, verify lanterns have
status: 'active' - Check
expiresAttimestamp hasn't passed
- In Firestore, verify lanterns have
Verify venueId:
- Both lanterns must have same
venueId
- Both lanterns must have same
Chat not opening after accepting wave? โ
- Check browser console for errors
- Verify connection was created:
- In Firestore, look for
connectionscollection - Should have document with both user IDs
- In Firestore, look for
- Check activeConnections state in React DevTools
"Simulate Wave" button not showing? โ
This is expected in production. The simulate button only appears in development mode:
- Local:
localhost:5173 - Dev deployment:
dev.ourlantern.app
It will NOT show on ourlantern.app (production).
Data Model Reference โ
Wave Document (waves/{waveId}) โ
{
senderUserId: "user1_uid",
senderLanternId: "lantern1_id",
recipientUserId: "user2_uid",
recipientLanternId: "lantern2_id",
venueId: "venue_id",
venueName: "Brew & Co Coffee",
status: "pending" | "accepted" | "declined" | "expired",
interest: "Looking for React dev to pair program",
mood: "Conversation",
sentAt: Timestamp,
respondedAt?: Timestamp,
expiresAt: Timestamp, // 1 hour from sentAt
matchColor?: "amber" | "purple" | "blue" | "green" | "pink",
connectionId?: "conn_id" // set when accepted
}Connection Document (connections/{connectionId}) โ
{
waveId: "wave_id",
user1Id: "sender_uid",
user2Id: "recipient_uid",
venueId: "venue_id",
venueName: "Brew & Co Coffee",
matchColor: "purple",
interest: "Looking for React dev to pair program",
mood: "Conversation",
createdAt: Timestamp,
expiresAt: Timestamp, // 4 hours from createdAt
status: "active" | "met" | "expired"
}Next Steps โ
After verifying waves work:
- Test with different venues: Light lanterns at different venues and verify waves only work within same venue
- Test expiry: Wait 1 hour and verify waves auto-expire
- Test decline: Send wave and decline it - should remove from incoming waves
- Test multi-device sync: Have one user on phone, one on desktop
- Test connection expiry: Wait 4 hours and verify connection expires
Development Tips โ
Quick Test Without Two Devices โ
Use the "Simulate Wave" button (dev only):
- Light your lantern
- Click "Simulate wave" button at bottom
- Accept the mock wave
- Test chat and beacon
This creates a fake wave locally (not in Firebase) for quick UI testing.
Inspecting Real-Time Updates โ
Open React DevTools and watch these state variables:
incomingWaves- Should update when someone waves at youactiveConnections- Should update when you accept a waveactiveLanterns- Should update when you light/extinguish
Firebase Console Debugging โ
- Go to Firestore Database > Data
- Watch
wavescollection update in real-time - Watch
connectionscollection when waves are accepted - Check document timestamps to verify expiry logic
Security Notes โ
All wave interactions are:
- Authenticated: Must be logged in
- Authorized: Can only send/accept your own waves
- Rate-limited: One wave per user pair at a time
- Ephemeral: Waves expire after 1 hour, connections after 4 hours
- Private: Only sender and recipient can see wave details
See firestore.rules for complete security rules.
Success Criteria โ
โ
Two users can light lanterns at same venue
โ
Each user sees the other's lantern in venue view
โ
User can send wave to another user's lantern
โ
Recipient receives wave notification in real-time
โ
Accepting wave creates connection and opens chat
โ
Both users get matching color beacon
โ
Chat messages sync in real-time
โ
Connection persists across chat close/reopen
โ
Declining wave removes notification
โ
Waves expire after 1 hour if not responded
โ
Connections expire after 4 hours
Questions or issues? Check the Engineering docs or raise an issue in the repo!