forked from doubtfire-lms/doubtfire-deploy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-password-management.sh
More file actions
98 lines (85 loc) · 2.95 KB
/
test-password-management.sh
File metadata and controls
98 lines (85 loc) · 2.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/bin/bash
# Password Management Testing Script
# This script helps test the password management functionality
echo "🔐 Password Management Testing Script"
echo "====================================="
# Check if we're in the right directory
if [ ! -d "doubtfire-api" ] || [ ! -d "doubtfire-web" ]; then
echo "❌ Error: Please run this script from the doubtfire-deploy root directory"
exit 1
fi
echo "✅ Found doubtfire-api and doubtfire-web directories"
# Test Backend
echo ""
echo "🧪 Testing Backend..."
cd doubtfire-api
# Check if Rails is available
if command -v rails &> /dev/null; then
echo "✅ Rails found, running tests..."
rails test test/api/password_management_test.rb
if [ $? -eq 0 ]; then
echo "✅ Backend tests passed!"
else
echo "❌ Backend tests failed!"
fi
else
echo "⚠️ Rails not found, skipping backend tests"
echo " To test manually: cd doubtfire-api && rails test test/api/password_management_test.rb"
fi
# Test Frontend
echo ""
echo "🧪 Testing Frontend..."
cd ../doubtfire-web
# Check if npm is available
if command -v npm &> /dev/null; then
echo "✅ npm found, checking dependencies..."
if [ -d "node_modules" ]; then
echo "✅ Dependencies installed"
else
echo "⚠️ Dependencies not installed, running npm install..."
npm install
fi
# Check for linting errors
echo "🔍 Checking for linting errors..."
if npm run lint &> /dev/null; then
echo "✅ No linting errors found"
else
echo "⚠️ Linting errors found, run 'npm run lint' for details"
fi
# Try to build
echo "🔨 Testing build process..."
if npm run build &> /dev/null; then
echo "✅ Frontend builds successfully"
else
echo "❌ Frontend build failed"
fi
else
echo "⚠️ npm not found, skipping frontend tests"
echo " To test manually: cd doubtfire-web && npm install && npm run build"
fi
cd ..
echo ""
echo "📋 Manual Testing Checklist"
echo "=========================="
echo ""
echo "1. Start the development servers:"
echo " Backend: cd doubtfire-api && rails server"
echo " Frontend: cd doubtfire-web && ng serve"
echo ""
echo "2. Test the following URLs:"
echo " • http://localhost:4200/register - User registration"
echo " • http://localhost:4200/forgot-password - Password reset request"
echo " • http://localhost:4200/sign_in - Enhanced sign-in page"
echo ""
echo "3. Test the complete flow:"
echo " • Register a new user"
echo " • Log in with the new account"
echo " • Go to profile and change password"
echo " • Request password reset via forgot password"
echo " • Check email for reset link (in development, check log files)"
echo ""
echo "4. Check email configuration:"
echo " • Development: Emails saved to doubtfire-api/tmp/mails"
echo " • Production: Configure SMTP settings"
echo ""
echo "🎉 Password management system is ready for testing!"