This is a simple testing interface to verify that your Firebase Firestore leaderboard is working correctly. It helps you diagnose connection issues, test database operations, and ensure cross-player score syncing is functional.
npm start
# or
python3 -m http.server 8000Navigate to: http://localhost:8000/firebase-test.html
Click the "Run All Tests" button to:
- ✅ Verify Firebase SDK is loaded
- ✅ Check Firebase initialization
- ✅ Test Firestore database connection
- ✅ Read current leaderboard entries
- ✅ Submit a test score
- ✅ Verify the score was saved
The test results will show:
- Green ✅ checkmarks for successful operations
- Red ❌ errors if something fails
- Blue ℹ️ info messages with details
Click "📋 Copy Results" to copy the test output to your clipboard for sharing or debugging.
Confirms that:
- Firebase SDK loaded from CDN
- Configuration is correct
- Connection to your project succeeds
Verifies:
- Firestore database is accessible
- Project ID matches your config
- Network connectivity to Firebase servers
Tests:
- Fetching leaderboard entries
- Sorting by score (descending)
- Displaying entry details (name, score, date)
Validates:
- Creating new leaderboard entries
- Data structure is correct
- Firestore security rules allow writes
- Document ID is returned
✅ Firebase SDK loaded
✅ Firebase initialized successfully
✅ Firestore database connected
ℹ️ Project ID: js13k-2025
ℹ️ Found 5 leaderboard entries
ℹ️ Top scores:
1. PlayerName: 5000 (2025-10-06)
2. AnotherPlayer: 4500 (2025-10-05)
...
✅ Score saved successfully! Doc ID: abc123xyz
Firebase SDK not loaded
- Check internet connection (SDK loads from CDN)
- Verify
index.htmlhas Firebase script tags
Permission denied
- Check Firestore security rules
- Ensure rules allow
readandcreatefor leaderboard collection - See
FIRESTORE_RULES.mdfor correct configuration
Connection timeout
- Check Firebase project status
- Verify API key is correct
- Ensure project exists in Firebase Console
This file is for local testing only. The vercel.json build configuration excludes it from production deployments, so it won't be accessible on your live site.
- Check that
main.jshas the correct Firebase config - Verify the config matches your
.envfile - Ensure no typos in API key or project ID
- Check that Firebase config is embedded in deployed
main.js - Verify Vercel deployment succeeded
- Check browser console on live site for errors
- Verify both browsers show "Firebase connected" in console
- Check Firebase Console to see if scores are in database
- Ensure Firestore rules allow read access
QUICKSTART.md- Quick testing guideFIRESTORE_RULES.md- Security rules setupWHY_FIREBASE_KEYS_ARE_PUBLIC.md- Security explanationTESTING_NOW.md- Comprehensive testing walkthrough
Instead of using this tool, you can test directly in the browser console:
// Check Firebase status
typeof firebase // Should be "object"
window.db // Should be Firestore instance
firebaseEnabled // Should be true
// Test reading leaderboard
getLeaderboard().then(console.log)
// Test adding score (manual)
db.collection('leaderboard').add({
name: "Test Player",
score: 1000,
date: "2025-10-06",
streak: 5,
perfectShields: 2
}).then(() => console.log('Success!'))Questions or issues? Check the main README.md or open an issue on GitHub.