Phase 3 Testing Plan
Pre-Testing Requirements
Before running tests, ensure:
Environment variables are set:
VITE_FOUNDATION_URL=https://aethex.foundation # or staging/localhost FOUNDATION_OAUTH_CLIENT_SECRET=<received-from-foundation> VITE_API_BASE=https://aethex.dev # or http://localhost:5173Foundation is operational:
aethex.foundation is running
OAuth endpoints are accessible
Test user accounts exist
App is running:
npm run dev # or equivalent for your setup
Test Scenarios
Test 1: Login Page Loads Correctly
Objective: Verify the login page displays Foundation OAuth button
Steps:
Navigate to
http://localhost:5173/login(or prod URL)Look for "Login with Foundation" button
Verify button is visible and clickable
Expected Result:
Success Criteria: ✅ Button visible and no console errors
Test 2: Foundation Redirect
Objective: Verify clicking the button redirects to Foundation
Steps:
On login page, click "Login with Foundation" button
Observe browser URL change
Check redirect parameters
Expected Result:
Success Criteria: ✅ Redirected to Foundation OAuth authorize endpoint
Test 3: Foundation Authentication (Manual)
Objective: User authenticates on Foundation
Steps:
You're now on Foundation login page
Enter test credentials
If prompted, grant aethex.dev permissions
Click "Authorize" or similar
Expected Result:
Success Criteria: ✅ Authentication succeeds, no Foundation-side errors
Test 4: Callback Reception
Objective: Verify Foundation redirects back with authorization code
Steps:
After Foundation authentication completes
Observe browser URL change
Look for authorization code in URL
Expected Result:
Success Criteria: ✅ Callback endpoint receives authorization code
Test 5: Token Exchange
Objective: Backend exchanges code for access token
Steps:
Monitor network requests in browser Dev Tools
Look for POST to
/api/auth/exchange-tokenCheck response status
Expected Result:
Success Criteria: ✅ Token received, cookies set, no 401/403 errors
Test 6: User Profile Sync
Objective: Verify user profile created/updated in local database
Steps:
After successful login, check database
Query user_profiles table
Verify user exists with correct data
Database Query:
Success Criteria: ✅ User profile exists in local database with correct data
Test 7: Dashboard Redirect
Objective: User redirected to dashboard after authentication
Steps:
After token exchange and profile sync
Browser should automatically redirect
Check final URL
Expected Result:
Success Criteria: ✅ Dashboard loads, user is authenticated
Test 8: Authenticated API Requests
Objective: User can make authenticated API calls
Steps:
On authenticated dashboard
Use browser console to test:
Expected Result:
Success Criteria: ✅ API returns 200, user data correct
Test 9: Logout
Objective: Verify logout clears Foundation auth
Steps:
On authenticated dashboard
Click logout/settings
Trigger logout action
Verify redirect to login
Expected Result:
**Test command (if logout has UI):
Success Criteria: ✅ Cookies cleared, session terminated
Test 10: Redirect Destination (Optional)
Objective: Verify redirect works when accessing protected page first
Steps:
Logout (or clear cookies)
Visit protected page:
http://localhost:5173/dashboard?next=/adminGet redirected to login
Click "Login with Foundation"
After auth, should redirect to
/admininstead of/dashboard
Expected Result:
Success Criteria: ✅ Redirect destination preserved through auth flow
Error Testing
Error 1: Invalid Authorization Code
How to trigger:
Manually modify URL code parameter:
?code=invalid_codeLet callback process
Expected Result:
Success Criteria: ✅ Graceful error handling, user redirected to login
Error 2: Missing Client Secret
How to trigger:
Unset
FOUNDATION_OAUTH_CLIENT_SECRETenv varAttempt login
Expected Result:
Success Criteria: ✅ Clear error, server doesn't crash
Error 3: Foundation Unavailable
How to trigger:
Stop Foundation service
Attempt login
Foundation authorize redirects back
Expected Result:
Success Criteria: ✅ Handles offline Foundation gracefully
Error 4: Expired Authorization Code
How to trigger:
Wait >10 minutes after Foundation redirect
Complete the callback
Expected Result:
Success Criteria: ✅ Clear error, user redirected to login
Browser Compatibility Testing
Test on multiple browsers:
Checklist for each browser:
Performance Testing
Page Load Time
Token Exchange Time
Time from receiving auth code to dashboard redirect:
Target: < 2 seconds Acceptable: 2-5 seconds Problematic: > 5 seconds
User Flow Testing
Real User Journey
Step-by-step test with actual user:
Visit login page - Fresh browser tab
Click "Login with Foundation" - No pre-existing auth
Enter test credentials - On Foundation
Authorize app - If permission prompt appears
Check redirect - Should arrive at dashboard
Verify profile - Data should display
Test API - Make authenticated request
Logout - Clear session
Re-login - Ensure can login again
Success: All steps complete without errors
Deployment Testing
Staging Environment
Before deploying to production:
Production Deployment
Test Report Template
Monitoring After Deployment
Key Metrics to Monitor
Authentication Success Rate
Should be >99%
Track failed logins
Error Categories
Code exchange failures
Token validation failures
Profile sync failures
Performance
Token exchange time (target <2s)
Dashboard load time after auth
API request latency
User Feedback
Support tickets about login
Issues reported by users
Accessibility issues
Alert Thresholds
Set alerts for:
Auth failure rate > 5%
Token exchange time > 5 seconds
Foundation connectivity issues
Database sync failures
Rollback Triggers
Immediately rollback if:
Auth failure rate > 25%
Unable to authenticate any new users
Data corruption in user_profiles
Foundation connection completely down
Security vulnerability discovered
Testing Status: ⏳ Ready to Test
Once Foundation OAuth credentials are obtained and staging environment is ready, proceed with testing according to this plan.
Last updated
