Skip to content

Latest commit

 

History

History
282 lines (229 loc) · 8.09 KB

File metadata and controls

282 lines (229 loc) · 8.09 KB

Green-Time App - Quick Start Testing Guide

Prerequisites

✅ All done in implementation:

  • Firebase Firestore enabled
  • Firebase Storage enabled
  • Firebase Authentication (Email/Password) enabled
  • TinyDB/SharedPreferences configured
  • Provider state management ready
  • Dependencies in pubspec.yaml

Step 1: Run the App

cd c:\Users\ajays\Downloads\hi
flutter clean
flutter pub get
flutter run

Step 2: Parent Account Setup

First Time Parent

  1. App shows Parent Login Screen
  2. Click "Don't have an account? Sign up"
  3. Enter:
    • Username: testparent
    • Email: parent@example.com
    • Password: Password123! (6+ chars)
  4. Click Create Account
  5. Redirects to Parent Dashboard

Existing Parent

  1. Enter email and password
  2. Click Login
  3. Redirects to Parent Dashboard

Step 3: Link Child Account

From Parent Dashboard

  1. Click "Link Children" button (top right)
  2. Enter child username: testchild
  3. Click Connect
  4. Child appears in linked children list

Step 4: Create Task

From Parent Dashboard

  1. Click "Add Task" button
  2. Fill form:
    • Title: Plant a Tree
    • Description: Plant one tree in your area
    • Points: 50
    • Child: Select testchild
    • Requires Proof: Toggle ON
  3. Click Add Task
  4. Task appears in Pending Approvals tab

Step 5: Test Child User Flow

Switch to Child Account

  1. In Parent Dashboard, click Logout (top right)
  2. App returns to Child Login Screen
  3. Click "Are you a child? Login here" if not already there

Create/Select Child Account

  1. Existing child: Tap testchild from list
  2. New child: Click "Create New Account"
    • Enter: testchild2
    • Click Create Account
  3. Tap to login as that child
  4. Redirected to Child Dashboard

Step 6: Test Proof Photo Upload

Submit Proof Photo

  1. From Child Dashboard, find task "Plant a Tree"
  2. Click camera icon or task card
  3. ProofPhotoCaptureScreen opens
  4. Click "Take a Photo" or "Pick from Gallery"
  5. Capture/select photo
  6. Click "Submit Proof"
  7. Watch upload progress bar
  8. Success message: "Proof photo uploaded successfully!"

Verify in Firebase

  • Firebase ConsoleStorage
    • Path: parents/{parentId}/tasks/{taskId}/proof_*.jpg
    • Photo should be visible
  • Firestoreparents/{parentId}/tasks/{taskId}
    • proofPhotoURL should contain Firebase Storage URL
    • status should be submitted

Step 7: Test Parent Approval

Return to Parent Account

  1. Logout as child (Child Dashboard → My Account → Logout)
  2. Login again as parent
  3. Parent DashboardPending Approvals tab
  4. Should see task with proof photo

View Proof

  1. Task card shows proof photo thumbnail
  2. Click photo to view full image
  3. Should load from Firebase Storage

Approve Task

  1. Click "Approve" button
  2. Task moves to Approved Tasks tab
  3. Child's eco points +50

Reject Task (Alternative)

  1. Click "Reject" button
  2. Enter rejection reason: "Photo is blurry"
  3. Click Reject in dialog
  4. Task rejected without logout (BUG FIX VERIFIED)

Step 8: Test Real-Time Sync

Family Eco Points Update

  1. From Parent Dashboard, view top card
  2. Shows: Your Family's Green Impact with eco points
  3. Approve multiple tasks
  4. Total updates in real-time

Multiple Devices (Optional)

  1. Open app on 2 devices (both logged in as parent)
  2. Approve task on device 1
  3. Device 2's dashboard auto-updates
  4. Total eco points reflect immediately

Step 9: Test Child Account Settings

View Account Page

  1. Logout as parent
  2. Select child account: testchild
  3. From Child Dashboard, click top-right icon/settings
  4. Opens Child Account Screen

Verify Information

  • ✅ Username displayed
  • ✅ Avatar with first letter
  • ✅ Eco points total
  • ✅ Parent name connected
  • ✅ Recent completed tasks list
  • ✅ Dark mode toggle
  • ✅ Logout button

Toggle Dark Mode

  1. Click Dark Mode switch
  2. Entire UI changes to dark theme
  3. Switch back to light
  4. Verify theme persistence on close/reopen

Step 10: Test Edge Cases

Edge Case 1: No Proof When Required

  1. Create task with requiresProof = true
  2. Child tries to mark done without uploading proof
  3. Should require proof submission
  4. ❌ Show error: "Proof required"

Edge Case 2: Upload Failure

  1. Go to ProofPhotoCaptureScreen
  2. Disable internet temporarily
  3. Try to upload
  4. ❌ Show error: "Failed to upload"
  5. Re-enable internet and retry ✅

Edge Case 3: Delete Task

  1. Parent Dashboard → pending task
  2. Click delete icon (trash)
  3. Confirm deletion dialog
  4. Task removed from list
  5. Verify in Firestore: document deleted
  6. Verify in Storage: folder empty/deleted

Edge Case 4: Multiple Children

  1. Parent links 2nd child: testchild2
  2. Create tasks for both children
  3. Parent Dashboard shows tasks for all children
  4. Family eco points = sum of both children
  5. ✅ Verify real-time update when either child's points change

Debugging Checklist

If Photos Not Uploading

  • ✅ Firebase Storage rules allow writes
  • ✅ parentId passed correctly to service
  • ✅ File exists at path before upload
  • ✅ Internet connection active
  • ✅ Check Firebase console for storage errors

If Eco Points Not Syncing

  • ✅ Firestore path correct: parents/{parentId}/children/{childId}
  • ecoPoints field exists in Firestore
  • ✅ Increment operation completed
  • ✅ StreamBuilder subscribed to updates
  • ✅ Check Firestore for data presence

If Tasks Not Appearing in Dashboard

  • ✅ Task created in correct Firestore path
  • ✅ parentId/childId match between documents
  • ✅ Status is correct (pending/submitted)
  • ✅ StreamBuilder connected to TaskService
  • ✅ Check Firestore rules allow reads

If Logout Issues

  • ✅ Dialog close button uses: Navigator.pop(ctx) (not Navigator.pop(context))
  • ✅ Only dialog dismissed, not entire page
  • ✅ Logout button separate from rejection flow
  • ✅ App state reset before navigation

Performance Testing

Load Testing

  1. Create 20+ tasks
  2. Parent Dashboard should load in <2 seconds
  3. Real-time updates should be smooth
  4. No noticeable lag when scrolling

Image Upload

  1. Photo size: ~2-5 MB typical
  2. Upload should complete in <10 seconds on 4G
  3. Progress bar should update smoothly
  4. Display loading spinner during upload

Memory

  1. No memory leaks on repeated login/logout cycles
  2. App should not consume >200MB RAM
  3. Photos cached properly (not re-downloading)

Success Criteria

Criterion Status
Parent can create account (Firebase)
Parent can login with email/password
Child can create local account
Child can select and login
Parent can link children
Parent can create tasks
Child can upload proof photo to Firebase
Proof URL saved in Firestore
Parent can view proof in dashboard
Parent can approve task
Eco points awarded on approval
Family total syncs in real-time
Parent can reject task
Rejection doesn't cause logout
Child can view account settings
Dark mode toggles and persists
Logout returns to login screen

Troubleshooting Quick Links

Issue: "Firebase not configured"

  • Solution: Verify google-services.json in /android/app/

Issue: "Proof photo not uploading"

  • Solution: Check Firebase Storage rules, verify parentId is set

Issue: "Eco points not updating"

  • Solution: Verify Firestore path parents/{parentId}/children/{childId}

Issue: "Real-time data not syncing"

  • Solution: Check internet connection, verify Firestore rules

Issue: "Logout causes crash"

  • Solution: Check that Navigator.pop() is called only for dialog

Generated: Quick Start Testing Guide Version: 1.0 Estimated Testing Time: 30-45 minutes

Next Steps After Testing:

  1. ✅ Verify all success criteria pass
  2. ✅ Document any issues found
  3. ✅ Proceed to Phase 2 (per-task camera buttons, history, settings)
  4. ✅ Deploy to Firebase projects