- Migrate Suite4-10, SmokeTests, NavigationCriticalPathTests to AuthenticatedTestCase with seeded admin account and real backend login - Add 34 accessibility identifiers across 11 app views (task completion, profile, notifications, theme, join residence, manage users, forms) - Create FeatureCoverageTests (14 tests) covering previously untested features: profile edit, theme selection, notification prefs, task completion, manage users, join residence, task templates - Create MultiUserSharingTests (18 API tests) and MultiUserSharingUITests (8 XCUI tests) for full cross-user residence sharing lifecycle - Add cleanup infrastructure: SuiteZZ_CleanupTests auto-wipes test data after runs, cleanup_test_data.sh script for manual reset via admin API - Add share code API methods to TestAccountAPIClient (generateShareCode, joinWithCode, getShareCode, listResidenceUsers, removeUser) - Fix app bugs found by tests: - ResidencesListView join callback now uses forceRefresh:true - APILayer invalidates task cache when residence count changes - AllTasksView auto-reloads tasks when residence list changes - Fix test quality: keyboard focus waits, Save/Add button label matching, Documents tab label (Docs), remove API verification from UI tests - DataLayerTests and PasswordResetTests now verify through UI, not API calls Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
46 lines
1.9 KiB
Bash
Executable File
46 lines
1.9 KiB
Bash
Executable File
#!/bin/bash
|
|
# Clears ALL test data from the local API server.
|
|
# Preserves superadmin accounts only.
|
|
#
|
|
# Uses the admin panel auth (separate from regular user auth).
|
|
# Default credentials: admin@honeydue.com / password123
|
|
#
|
|
# Usage:
|
|
# ./cleanup_test_data.sh # uses default admin creds
|
|
# ./cleanup_test_data.sh email password # custom creds
|
|
|
|
set -euo pipefail
|
|
|
|
API_BASE="http://127.0.0.1:8000/api"
|
|
ADMIN_EMAIL="${1:-admin@honeydue.com}"
|
|
ADMIN_PASSWORD="${2:-password123}"
|
|
|
|
echo "==> Logging into admin panel as '$ADMIN_EMAIL'..."
|
|
LOGIN_RESPONSE=$(curl -sf -X POST "$API_BASE/admin/auth/login" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{\"email\": \"$ADMIN_EMAIL\", \"password\": \"$ADMIN_PASSWORD\"}" 2>/dev/null) || {
|
|
echo "ERROR: Could not login to admin panel. Is the backend running at $API_BASE?"
|
|
echo " Has the admin seed been run? (./dev.sh seed-admin)"
|
|
exit 1
|
|
}
|
|
|
|
TOKEN=$(echo "$LOGIN_RESPONSE" | python3 -c "import sys,json; print(json.load(sys.stdin)['token'])")
|
|
|
|
echo "==> Clearing all test data..."
|
|
CLEAR_RESPONSE=$(curl -sf -X POST "$API_BASE/admin/settings/clear-all-data" \
|
|
-H "Authorization: Bearer $TOKEN" \
|
|
-H "Content-Type: application/json" 2>/dev/null) || {
|
|
echo "ERROR: Clear-all-data failed."
|
|
exit 1
|
|
}
|
|
|
|
USERS_DELETED=$(echo "$CLEAR_RESPONSE" | python3 -c "import sys,json; print(json.load(sys.stdin).get('users_deleted', '?'))")
|
|
PRESERVED=$(echo "$CLEAR_RESPONSE" | python3 -c "import sys,json; print(json.load(sys.stdin).get('preserved_users', '?'))")
|
|
|
|
echo "==> Done! Deleted $USERS_DELETED users, preserved $PRESERVED superadmins."
|
|
echo ""
|
|
echo "To re-seed test data, run Suite00_SeedTests:"
|
|
echo " xcodebuild test -project honeyDue.xcodeproj -scheme HoneyDueUITests \\"
|
|
echo " -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 17 Pro' \\"
|
|
echo " -only-testing:HoneyDueUITests/Suite00_SeedTests"
|