7.7 KiB
Testing Fitness Profile Feature
Overview
This guide provides step-by-step instructions for manually testing the Fitness Profile feature in the FitAI mobile app.
Prerequisites
-
Admin API running:
cd apps/admin npm run devServer should be running at
http://localhost:3000 -
Mobile app running:
cd apps/mobile npx expo startChoose your platform (iOS/Android/Web)
-
User account: Have a Clerk user account created and verified
-
Database: Ensure the
fitness_profilestable existscd packages/database npm run db:push
Test Scenarios
Test 1: Create New Fitness Profile
Steps:
- Open the mobile app
- Sign in with your Clerk account
- Navigate to Home screen (should be automatic after sign-in)
- Locate the "Quick Actions" section
- Tap the "Fitness Profile" button (pink fitness icon)
- Verify the screen loads with empty form fields
Expected Result:
- Fitness Profile screen opens
- All fields are empty
- No errors displayed
Test 2: Fill Out Basic Information
Steps:
- In the "Basic Information" section, fill in:
- Height:
175(cm) - Weight:
70(kg) - Age:
25 - Gender: Select
Malefrom dropdown
- Height:
Expected Result:
- All fields accept input correctly
- Dropdowns open and allow selection
- No validation errors
Test 3: Set Fitness Goals
Steps:
- In the "Fitness Goals" section, fill in:
- Primary Goal: Select
Muscle Gain - Activity Level: Select
Moderately Active
- Primary Goal: Select
Expected Result:
- Dropdowns work correctly
- Selected values are displayed
Test 4: Add Health Information (Optional)
Steps:
- In the "Health Information" section, fill in:
- Medical Conditions:
None - Allergies:
Peanuts - Injuries:
Previous knee injury in 2023
- Medical Conditions:
Expected Result:
- Multi-line text areas accept input
- Text wraps properly
Test 5: Save Profile
Steps:
- Scroll to bottom of form
- Tap "Save Profile" button
- Wait for API response
Expected Result:
- Loading indicator appears on button
- Success alert: "Fitness profile saved successfully!"
- Alert has "OK" button
- Tapping "OK" returns to Home screen
Test 6: Verify Data Persistence
Steps:
- From Home screen, tap "Fitness Profile" again
- Wait for profile to load
Expected Result:
- Loading indicator shows briefly
- All previously entered data is displayed correctly:
- Height: 175
- Weight: 70
- Age: 25
- Gender: Male
- Primary Goal: Muscle Gain
- Activity Level: Moderately Active
- Medical Conditions: None
- Allergies: Peanuts
- Injuries: Previous knee injury in 2023
Test 7: Update Existing Profile
Steps:
- Change some values:
- Weight:
72 - Primary Goal: Change to
Weight Loss
- Weight:
- Tap "Save Profile"
Expected Result:
- Success alert: "Fitness profile saved successfully!"
- Data is updated in database
Test 8: Verify Update Persistence
Steps:
- Navigate back to Home
- Return to Fitness Profile
- Verify updated values are shown
Expected Result:
- Weight shows
72 - Primary Goal shows
Weight Loss - All other fields remain unchanged
Test 9: Back Button Navigation
Steps:
- On Fitness Profile screen
- Tap the back arrow (←) in top-left corner
Expected Result:
- Returns to Home screen
- No data loss (changes not saved unless "Save Profile" was tapped)
Test 10: Partial Data Entry
Steps:
- Create a new user or delete existing profile
- Fill in only Height:
180and Gender:Female - Leave all other fields empty
- Tap "Save Profile"
Expected Result:
- Profile saves successfully
- Only filled fields are stored
- Empty fields remain null/empty in database
Database Verification
Check Profile in Database
cd apps/admin
npm run db:studio
Then:
- Navigate to
fitness_profilestable - Find your user's profile (match
user_idwith Clerk user ID) - Verify all fields match what you entered
SQL Query (Alternative)
If you have SQLite CLI access:
cd apps/admin/data
sqlite3 fitai.db
-- View all fitness profiles
SELECT * FROM fitness_profiles;
-- View specific user's profile
SELECT * FROM fitness_profiles WHERE user_id = 'user_YOUR_CLERK_ID';
-- Check profile count
SELECT COUNT(*) FROM fitness_profiles;
API Testing
Test GET Endpoint
# Get your Clerk token first (from Clerk Dashboard or mobile app)
export CLERK_TOKEN="your_token_here"
curl -X GET http://localhost:3000/api/fitness-profile \
-H "Authorization: Bearer $CLERK_TOKEN"
Expected Response:
{
"profile": {
"id": "fp_...",
"user_id": "user_...",
"height": 175,
"weight": 70,
...
}
}
Test POST Endpoint
curl -X POST http://localhost:3000/api/fitness-profile \
-H "Authorization: Bearer $CLERK_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"height": 175,
"weight": 70,
"age": 25,
"gender": "male",
"fitnessGoal": "muscle_gain",
"activityLevel": "moderately_active"
}'
Expected Response:
{
"message": "Fitness profile created successfully",
"profileId": "fp_..."
}
Error Scenarios
Test 1: Unauthorized Access
Steps:
- Sign out from mobile app
- Attempt to access Fitness Profile (should not be possible)
Expected Result:
- User is redirected to sign-in screen
- Fitness Profile is not accessible without authentication
Test 2: Network Error
Steps:
- Stop the admin API server
- Try to save profile in mobile app
Expected Result:
- Error alert: "Failed to save fitness profile"
- User can retry after restarting server
Test 3: Invalid Data Types
Steps:
- Enter letters in Height field:
abc - Try to save
Expected Result:
- Numeric keyboard prevents letter entry (on mobile)
- Or validation error if somehow entered
Common Issues & Solutions
Issue: Profile doesn't load
Solution:
- Check admin API is running
- Verify
EXPO_PUBLIC_API_URLis set correctly - Check browser/app console for errors
Issue: Save button doesn't work
Solution:
- Check network connection
- Verify Clerk authentication token is valid
- Check admin API logs for errors
Issue: Data not persisting
Solution:
- Verify database migration ran successfully
- Check
fitness_profilestable exists - Verify write permissions on SQLite database
Issue: Picker dropdowns don't open
Solution:
- Ensure
@react-native-picker/pickeris installed - Run
npx expo start -cto clear cache - Restart app
Performance Testing
Test Loading Speed
-
Time from tapping "Fitness Profile" to screen fully loaded
- Target: < 500ms with existing profile
- Target: < 200ms for new profile (no data to load)
-
Time from tapping "Save" to success message
- Target: < 1 second
Test Responsiveness
- Scroll performance: Smooth scrolling on all devices
- Input lag: Immediate feedback when typing
- Picker responsiveness: Opens/closes without delay
Sign-off Checklist
- Can create new fitness profile
- Can update existing profile
- Data persists across app restarts
- All dropdowns work correctly
- All text inputs accept data
- Save button works and shows loading state
- Success message displays correctly
- Back button navigation works
- Data visible in database
- API endpoints respond correctly
- Authentication required and working
- Error handling works for network issues
- Optional fields can be left empty
- Profile unique per user (one profile per user)
Next Steps
After completing these tests:
- Document any bugs found in issue tracker
- Verify fixes for any issues
- Request code review
- Plan automated test implementation
- Deploy to staging environment for QA testing