Skip to content

Venue & Lantern Testing Guide โ€‹

Overview โ€‹

This guide walks you through testing the new venue and lantern lighting functionality across multiple devices.


Quick Setup โ€‹

1. Seed Test Venues (One-Time Setup) โ€‹

Make sure dev server is running first: npm run dev

Open your browser's developer console (F12) and run:

javascript
// The seed function is automatically available in dev mode
await window.seedVenues()

You should see output like:

๐ŸŒฑ Seeding test venues...
โœ… Created: Brew & Co Coffee
โœ… Created: Sunset Yoga Studio
... (8 venues total)
๐ŸŽ‰ Seeding complete! Created 8/8 venues.

Verify in Firestore Console:

  1. Go to Firebase Console โ†’ Firestore Database
  2. You should see a venues collection with 8 documents
  3. Each document has: name, address, lat, lng, category, activeLanternCount, etc.

If you don't see venues in Firestore:

  • Check browser console for errors
  • Verify you're logged in (auth required to create venues)
  • Check Firebase project: Should be lantern-app-dev
  • Deploy Firestore rules if needed: firebase deploy --only firestore:rules

This will create 8 test venues in downtown San Diego.


2. Set Location Spoofing โ€‹

In .env.local:

bash
# San Diego coordinates (downtown Gaslamp Quarter)
VITE_DEV_TEST_LOCATION="32.7157,-117.1611"

Restart dev server: npm run dev


Testing Workflow โ€‹

Single Device Test โ€‹

  1. Login to the app with a test account

  2. Open Dashboard (should be default view)

  3. Click the Fire icon (bottom nav)

  4. Lantern Hub opens โ†’ Click "Light Lantern"

  5. Select a venue from the nearby list (should show all 8 test venues)

  6. Lantern lights โ†’ You'll see:

    • Active lantern in Lantern Hub
    • Countdown timer (2 hours)
    • Venue name and details
  7. Extinguish โ†’ Click "Extinguish Lantern" in Lantern Hub


Multi-Device Test (Waves) โ€‹

Device A (User 1) โ€‹

  1. Login with user1@test.com
  2. Set location spoof to San Diego (32.7157,-117.1611)
  3. Light lantern at Brew & Co Coffee
  4. Leave Lantern Hub open

Device B (User 2) โ€‹

  1. Login with user2@test.com
  2. Set same location spoof
  3. Light lantern at Brew & Co Coffee (same venue)
  4. Both users now have active lanterns at the same venue

Test Wave Interaction (Coming Next) โ€‹

  • User 2 should see User 1's lantern in the venue
  • User 2 can send a "Wave" to User 1
  • User 1 receives wave notification
  • Both can start a chat

Test Venues โ€‹

All venues are clustered around downtown San Diego:

Venue NameCategoryMerchant?
Brew & Co CoffeeCoffee ShopNo
Sunset Yoga StudioYoga StudioNo
The Gaslamp TavernBarNo
Pacific Bites RestaurantRestaurantNo
Zen Wellness SpaWellnessNo
Harbor Fitness GymGymNo
Pages & Prose BookstoreBookstoreNo
Urban BowlsRestaurantYes (demo merchant)

Firestore Security Rules โ€‹

Before testing, ensure these rules are deployed:

javascript
rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    // Venues - read-only for all authenticated users
    match /venues/{venueId} {
      allow read: if request.auth != null;
      allow write: if false; // Admin only (manual seed)
    }
    
    // Lanterns - users can only manage their own
    match /lanterns/{lanternId} {
      allow read: if request.auth != null;
      allow create: if request.auth != null 
        && request.resource.data.userId == request.auth.uid;
      allow update, delete: if request.auth != null 
        && resource.data.userId == request.auth.uid;
    }
  }
}

Deploy with:

bash
firebase deploy --only firestore:rules

Troubleshooting โ€‹

"No venues found nearby" โ€‹

  • Check .env.local has VITE_DEV_TEST_LOCATION set
  • Restart dev server
  • Open ProfileSettings โ†’ Location Spoofing panel โ†’ Verify coordinates
  • Ensure venues were seeded successfully

"Unable to get your location" โ€‹

  • Browser location permission may be blocked
  • Use the debug panel in ProfileSettings to manually set location
  • Check console for geolocation errors

"Lantern not appearing in Hub" โ€‹

  • Check Firestore console โ†’ lanterns collection
  • Verify user is authenticated (check localStorage for auth token)
  • Check browser console for errors
  • Try refreshing the page

"Lantern expired immediately" โ€‹

  • Check system clock (ensure it's accurate)
  • Lanterns expire after 2 hours by default
  • Check expiresAt field in Firestore document

Next Steps โ€‹

Once basic venue/lantern functionality works:

  1. Build Wave System

    • Query active lanterns at same venue
    • Send/receive wave notifications
    • Accept/reject wave UI
  2. Add Real-time Sync

    • Live lantern count updates
    • Wave notifications via Firestore listeners
    • Chat message sync
  3. Add Merchant Offers

    • Wire Urban Bowls (demo merchant) to offer system
    • Show offers when checking in at merchant venues
    • Redemption flow

Clean Up Test Data โ€‹

To remove all test venues:

javascript
// In browser console
import { db } from './src/firebase'
import { collection, getDocs, deleteDoc } from 'firebase/firestore'

const venuesRef = collection(db, 'venues')
const snapshot = await getDocs(venuesRef)
for (const doc of snapshot.docs) {
  await deleteDoc(doc.ref)
  console.log('Deleted:', doc.id)
}

To remove all test lanterns:

javascript
const lanternsRef = collection(db, 'lanterns')
const snapshot = await getDocs(lanternsRef)
for (const doc of snapshot.docs) {
  await deleteDoc(doc.ref)
  console.log('Deleted:', doc.id)
}

Built with VitePress