OTP Feature - Test Cases & Scenarios
This document contains comprehensive test cases for the OTP authentication system.
OTP Feature - Test Cases & Scenarios
Overview
This document contains comprehensive test cases for the OTP authentication system.
1. OTP Generation & Email Sending Tests
TC1.1: Valid OTP Send Request
Objective: Verify OTP is generated and sent for valid email and name Steps:
- Navigate to
/otp-verification - Enter Full Name: "John Doe"
- Enter Email: "test@example.com"
- Click "Send OTP"
Expected Results:
- ✅ Success message appears: "OTP sent to your email!"
- ✅ UI moves to Step 2
- ✅ Email received with 6-digit OTP
- ✅ OTP is valid for 5 minutes
Status: ✅ Pass / ❌ Fail
TC1.2: Missing Email Field
Objective: Verify error when email is not provided Steps:
- Navigate to
/otp-verification - Enter Full Name: "John Doe"
- Leave Email empty
- Click "Send OTP"
Expected Results:
- ✅ Error message: "Please enter all fields"
- ✅ No email sent
- ✅ UI remains on Step 1
Status: ✅ Pass / ❌ Fail
TC1.3: Missing Full Name Field
Objective: Verify error when full name is not provided Steps:
- Navigate to
/otp-verification - Leave Full Name empty
- Enter Email: "test@example.com"
- Click "Send OTP"
Expected Results:
- ✅ Error message: "Please enter all fields"
- ✅ No email sent
- ✅ UI remains on Step 1
Status: ✅ Pass / ❌ Fail
TC1.4: Invalid Email Format
Objective: Verify validation of email format Steps:
- Navigate to
/otp-verification - Enter Full Name: "John Doe"
- Enter Email: "invalid-email"
- Try to send OTP
Expected Results:
- ✅ Either browser validation prevents submission
- ✅ Or server returns error about invalid email
- ✅ No email sent
Status: ✅ Pass / ❌ Fail
TC1.5: Already Verified User
Objective: Verify error when trying to register verified user Steps:
- Register and verify a user with "existing@example.com"
- Go to
/otp-verification - Enter same email
- Click "Send OTP"
Expected Results:
- ✅ Error message: "User already registered and verified"
- ✅ No new OTP sent
Status: ✅ Pass / ❌ Fail
2. OTP Verification & Registration Tests
TC2.1: Valid OTP Verification
Objective: Verify successful registration with valid OTP Steps:
- Send OTP to "test@example.com"
- Receive 6-digit OTP in email
- Enter OTP: "123456" (actual OTP)
- Enter Password: "SecurePass123"
- Confirm Password: "SecurePass123"
- Click "Verify & Register"
Expected Results:
- ✅ Success message: "Registration successful! Redirecting..."
- ✅ User created in database with isVerified=true
- ✅ JWT token saved in localStorage
- ✅ User auto-logged in
- ✅ Redirected to
/home
Status: ✅ Pass / ❌ Fail
TC2.2: Wrong OTP
Objective: Verify error with incorrect OTP Steps:
- Send OTP to "test@example.com"
- Receive OTP in email
- Enter wrong OTP: "000000"
- Enter Password: "SecurePass123"
- Confirm Password: "SecurePass123"
- Click "Verify & Register"
Expected Results:
- ✅ Error message: "Invalid or expired OTP"
- ✅ User not created
- ✅ UI remains on Step 2
Status: ✅ Pass / ❌ Fail
TC2.3: Expired OTP (5+ minutes old)
Objective: Verify error when OTP is expired Steps:
- Send OTP to "test@example.com"
- Wait more than 5 minutes
- Enter OTP (even if correct)
- Click "Verify & Register"
Expected Results:
- ✅ Error message: "Invalid or expired OTP"
- ✅ User not created
- ✅ UI remains on Step 2
Status: ✅ Pass / ❌ Fail
TC2.4: Password Mismatch
Objective: Verify error when passwords don't match Steps:
- Send OTP and receive it
- Enter valid OTP
- Enter Password: "SecurePass123"
- Enter Confirm Password: "DifferentPass123"
- Click "Verify & Register"
Expected Results:
- ✅ Error message: "Passwords do not match"
- ✅ User not created
- ✅ UI remains on Step 2
Status: ✅ Pass / ❌ Fail
TC2.5: Password Too Short
Objective: Verify error when password is less than 6 characters Steps:
- Send OTP and receive it
- Enter valid OTP
- Enter Password: "Pass1"
- Enter Confirm Password: "Pass1"
- Click "Verify & Register"
Expected Results:
- ✅ Error message: "Password must be at least 6 characters"
- ✅ User not created
Status: ✅ Pass / ❌ Fail
TC2.6: Missing OTP Field
Objective: Verify error when OTP is not entered Steps:
- On Step 2
- Leave OTP empty
- Enter Password & Confirm Password
- Click "Verify & Register"
Expected Results:
- ✅ Error message: "Please fill all fields"
- ✅ User not created
Status: ✅ Pass / ❌ Fail
3. Resend OTP Tests
TC3.1: Resend OTP Success
Objective: Verify OTP can be resent successfully Steps:
- Send OTP to "test@example.com"
- Go to Step 2
- Click "Resend OTP" button
- Receive new OTP in email
Expected Results:
- ✅ Success message: "OTP resent to your email!"
- ✅ New OTP sent to email
- ✅ Previous OTP invalidated
- ✅ Button disabled for 60 seconds
Status: ✅ Pass / ❌ Fail
TC3.2: Resend Cooldown Timer
Objective: Verify 60-second cooldown after resend Steps:
- Send OTP
- Go to Step 2
- Click "Resend OTP"
- Observe countdown
Expected Results:
- ✅ Button shows "Resend (60s)" and counts down
- ✅ Button is disabled for 60 seconds
- ✅ After 60s, button becomes active again
- ✅ Button text changes to "Resend OTP"
Status: ✅ Pass / ❌ Fail
TC3.3: Old OTP Invalid After Resend
Objective: Verify old OTP doesn't work after resend Steps:
- Send OTP to "test@example.com"
- Note the OTP received
- Click "Resend OTP"
- Receive new OTP
- Try to verify with old OTP
Expected Results:
- ✅ Error message: "Invalid or expired OTP"
- ✅ Registration fails
- ✅ New OTP works instead
Status: ✅ Pass / ❌ Fail
4. Login Tests
TC4.1: Successful Login
Objective: Verify verified user can login Steps:
- Complete registration with "user@example.com" and password "Pass123"
- Go to
/login - Enter Email: "user@example.com"
- Enter Password: "Pass123"
- Click "Login"
Expected Results:
- ✅ Success message: "Login Successful"
- ✅ JWT token saved in localStorage
- ✅ User redirected to
/home - ✅ Can access protected pages
Status: ✅ Pass / ❌ Fail
TC4.2: Unverified User Cannot Login
Objective: Verify unverified user cannot login Steps:
- Have a user record with isVerified=false
- Try to login with that email and password
Expected Results:
- ✅ Error message: "Please verify your email first"
- ✅ User not logged in
- ✅ No token generated
Status: ✅ Pass / ❌ Fail
TC4.3: Wrong Password
Objective: Verify login fails with wrong password Steps:
- Go to
/login - Enter Email: "user@example.com" (existing verified user)
- Enter Password: "WrongPassword"
- Click "Login"
Expected Results:
- ✅ Error message: "Invalid credentials"
- ✅ User not logged in
Status: ✅ Pass / ❌ Fail
TC4.4: Non-existent User
Objective: Verify login fails for non-existent user Steps:
- Go to
/login - Enter Email: "nonexistent@example.com"
- Enter Password: "SomePassword"
- Click "Login"
Expected Results:
- ✅ Error message: "User does not exist"
- ✅ User not logged in
Status: ✅ Pass / ❌ Fail
TC4.5: Missing Email Field
Objective: Verify validation when email is missing Steps:
- Go to
/login - Leave Email empty
- Enter Password: "SomePassword"
- Click "Login"
Expected Results:
- ✅ Error message or validation error
- ✅ Login not attempted
Status: ✅ Pass / ❌ Fail
TC4.6: Missing Password Field
Objective: Verify validation when password is missing Steps:
- Go to
/login - Enter Email: "user@example.com"
- Leave Password empty
- Click "Login"
Expected Results:
- ✅ Error message or validation error
- ✅ Login not attempted
Status: ✅ Pass / ❌ Fail
5. Navigation & UI Tests
TC5.1: Navigation to OTP Page
Objective: Verify link navigation to OTP verification Steps:
- Go to
/login - Click "Register" link
Expected Results:
- ✅ Navigated to
/otp-verification - ✅ Page loads successfully
Status: ✅ Pass / ❌ Fail
TC5.2: Back Button on OTP Page
Objective: Verify back button returns to Step 1 Steps:
- Go to
/otp-verification - Send OTP (move to Step 2)
- Click "Back" button
Expected Results:
- ✅ Return to Step 1
- ✅ Form fields cleared
- ✅ Errors cleared
Status: ✅ Pass / ❌ Fail
TC5.3: Loading States
Objective: Verify UI shows loading state during processing Steps:
- Go to
/otp-verification - Click "Send OTP" and observe button
Expected Results:
- ✅ Button text changes to "Sending OTP..."
- ✅ Button is disabled
- ✅ Button text reverts after completion
Status: ✅ Pass / ❌ Fail
TC5.4: Error Message Display
Objective: Verify error messages display correctly Steps:
- Try invalid action (e.g., send OTP without email)
- Observe error display
Expected Results:
- ✅ Red error alert appears
- ✅ Error message is clear
- ✅ Error clears on next action
Status: ✅ Pass / ❌ Fail
6. Database Tests
TC6.1: User Created with Correct Fields
Objective: Verify user document structure in database Steps:
- Complete registration
- Query MongoDB:
db.users.findOne({email: "test@example.com"})
Expected Results:
- ✅ User document exists
- ✅ fullName field present
- ✅ email field present
- ✅ password field contains hash (not plain text)
- ✅ isVerified = true
- ✅ otp = null
- ✅ otpExpiry = null
- ✅ createdAt timestamp present
Status: ✅ Pass / ❌ Fail
TC6.2: OTP Stored During Registration
Objective: Verify OTP is temporarily stored in database Steps:
- Send OTP to "test@example.com"
- Immediately query:
db.users.findOne({email: "test@example.com"})
Expected Results:
- ✅ otp field contains 6-digit code
- ✅ otpExpiry contains future timestamp
- ✅ isVerified = false
Status: ✅ Pass / ❌ Fail
TC6.3: OTP Cleared After Verification
Objective: Verify OTP is cleared after successful verification Steps:
- Send OTP and verify successfully
- Query:
db.users.findOne({email: "test@example.com"})
Expected Results:
- ✅ otp = null
- ✅ otpExpiry = null
- ✅ isVerified = true
Status: ✅ Pass / ❌ Fail
7. Security Tests
TC7.1: Password Hashing
Objective: Verify passwords are hashed, not stored in plain text Steps:
- Register user with password "TestPass123"
- Query database
Expected Results:
- ✅ Password field contains hash
- ✅ Hash doesn't contain "TestPass123"
- ✅ Hash starts with "$2a$" or "$2b$" (bcryptjs format)
Status: ✅ Pass / ❌ Fail
TC7.2: OTP Not in Plain Text
Objective: Verify OTP stored securely (if hashed) Steps:
- Send OTP
- Check database
- Check email
Expected Results:
- ✅ Email contains readable OTP
- ✅ Database may store securely (depending on implementation)
Status: ✅ Pass / ❌ Fail
TC7.3: JWT Token in localStorage
Objective: Verify JWT token is stored correctly Steps:
- Login successfully
- Open browser DevTools → Application → localStorage
Expected Results:
- ✅ "access_token" or "token" key present
- ✅ Contains JWT format (3 parts separated by dots)
- ✅ Token not empty
Status: ✅ Pass / ❌ Fail
8. Integration Tests
TC8.1: Complete User Journey
Objective: Verify entire user flow from registration to accessing app Steps:
- Navigate to
/otp-verification - Register with name and email
- Receive OTP
- Verify OTP and create account
- Auto-logged in
- Access protected pages (songs, playlists)
- Logout
- Login again
Expected Results:
- ✅ All steps successful
- ✅ Can access protected resources after login
- ✅ Cannot access protected resources after logout
Status: ✅ Pass / ❌ Fail
TC8.2: Multiple Simultaneous OTPs
Objective: Verify different users can have OTPs simultaneously Steps:
- Send OTP to "user1@example.com"
- Send OTP to "user2@example.com"
- Verify both users receive different OTPs
- Verify with user1's OTP
- Try to verify user2 with user1's OTP
Expected Results:
- ✅ Both users receive different OTPs
- ✅ User1 verification succeeds
- ✅ User2 cannot verify with user1's OTP
Status: ✅ Pass / ❌ Fail
9. Email Delivery Tests
TC9.1: Email Delivery Time
Objective: Verify OTP email arrives within reasonable time Steps:
- Send OTP
- Check email arrival time
Expected Results:
- ✅ Email arrives within 1-2 minutes
- ✅ Contains correct 6-digit OTP
- ✅ Contains user's name
- ✅ Contains validity duration (5 minutes)
Status: ✅ Pass / ❌ Fail
TC9.2: Email Content Verification
Objective: Verify email contains correct information Steps:
- Send OTP to "test@example.com"
- Check email content
Expected Results:
- ✅ Subject contains "OTP" and "Verification"
- ✅ Body contains 6-digit OTP
- ✅ Body contains greeting with name
- ✅ Body mentions 5-minute validity
- ✅ Formatted nicely
Status: ✅ Pass / ❌ Fail
10. Performance Tests
TC10.1: Response Time - Send OTP
Objective: Verify acceptable response time for sending OTP Steps:
- Note time
- Click "Send OTP"
- Note time when success message appears
Expected Results:
- ✅ Response time < 5 seconds
- ✅ Typically 1-3 seconds
Status: ✅ Pass / ❌ Fail
TC10.2: Response Time - Verify OTP
Objective: Verify acceptable response time for verification Steps:
- Note time
- Click "Verify & Register"
- Note time when success message appears
Expected Results:
- ✅ Response time < 3 seconds
- ✅ Typically 1-2 seconds
Status: ✅ Pass / ❌ Fail
11. Error Recovery Tests
TC11.1: Recover from Invalid OTP
Objective: Verify user can recover after entering wrong OTP Steps:
- Send OTP
- Enter wrong OTP
- Get error message
- Click "Resend OTP"
- Enter new OTP correctly
Expected Results:
- ✅ Can resend OTP
- ✅ New OTP works
- ✅ Registration completes
Status: ✅ Pass / ❌ Fail
TC11.2: Recover from Expired OTP
Objective: Verify user can recover from expired OTP Steps:
- Send OTP
- Wait 5+ minutes
- Try to verify (fails with expired message)
- Click "Resend OTP"
- Enter new OTP
Expected Results:
- ✅ Can resend OTP
- ✅ New OTP works
- ✅ Registration completes
Status: ✅ Pass / ❌ Fail
Test Summary
| Category | Total Tests | Passed | Failed | Status |
|---|---|---|---|---|
| OTP Generation | 5 | __ | __ | ○ |
| OTP Verification | 6 | __ | __ | ○ |
| Resend OTP | 3 | __ | __ | ○ |
| Login | 6 | __ | __ | ○ |
| Navigation & UI | 4 | __ | __ | ○ |
| Database | 3 | __ | __ | ○ |
| Security | 3 | __ | __ | ○ |
| Integration | 2 | __ | __ | ○ |
| Email Delivery | 2 | __ | __ | ○ |
| Performance | 2 | __ | __ | ○ |
| Error Recovery | 2 | __ | __ | ○ |
| TOTAL | 40 | __ | __ | ○ |
Test Report: _______________ Tester Name: ________________ Date: ______________________ Notes: _____________________
Generated: November 17, 2025 Version: 1.0
Related Documents
Comprehensive AI Assistant Tools Reference
title: Comprehensive AI Assistant Tools Reference
iOS Deployment Guide
**Introduction:** Deploying the Krome app to iOS (iPhone/iPad) is a bit more involved due to Apple’s ecosystem requirements. This guide will cover setting up an iOS development environment, building the Tauri app for iOS, publishing on Apple’s App Store, alternative distribution options like TestFlight or Enterprise, the App Store review process, common pitfalls, and CI/CD for iOS. As before, we assume you know general development concepts but are new to iOS specifics.
How to Add Resources to Your FastMCP Server
In the Model Context Protocol (MCP), there are three main capabilities:
Continue.dev MCP Integration Setup Guide
Edit your Continue.dev configuration file: