E2E Bypass Implementation Tasks
Quick Reference
Purpose: Remove hard stops (external API dependencies) from E2E test flows
Current OTP Bypass: ✅ Already implemented
Remaining Work: Document verification bypasses
Estimated Effort: 10 hours
Task Breakdown
✅ Task 0: OTP Bypass (DONE)
Status: Already implemented in users/views.py:859
Code: Uses E2E_TESTING_MODE and E2E_OTP_BYPASS_CODE=000000
❌ Task 1: Create E2E Utility Module (1 hour)
File: nemesis/utils/e2e_utils.py (NEW)
Functions to create:
is_e2e_mode()- Check if E2E mode enabledbypass_ekyc_verification(...)- Auto-approve document verificationbypass_face_match(...)- Auto-approve face matchget_e2e_mock_response(...)- Return mock API responses
Implementation: See testing-bypass-mechanisms.md Step 1
❌ Task 2: Bank Verification Bypass (1 hour)
File: nemesis/ekyc_verification/views.py
Class: BankDetailsVerificationView.post()
Line: ~252
Add before SpringScan call:
if is_e2e_mode():
verification_detail.status = KYCVerificationStatus.SUCCESS
verification_detail.verified_at = timezone.now()
verification_detail.save()
return Response(...) # Success response
Test with:
curl -X POST http://localhost:8000/api/v1/ekyc/<company_id>/verify_bank_details/
❌ Task 3: PAN/Aadhaar Document Verification Bypass (1 hour)
File: nemesis/ekyc_verification/views.py
Class: GovernmentDocumentVerificationView.post()
Line: ~387
Add before SpringScan OCR call:
if is_e2e_mode():
mock_data = {
'extracted_pan_number': 'AAAAA9999A', # if PAN
'extracted_name': user.first_name,
}
bypass_ekyc_verification(verification_detail, 'pan', **mock_data)
return Response(...) # Success response
Test with:
curl -X POST http://localhost:8000/api/v1/ekyc/<company_id>/verify_government_document/
❌ Task 4: Face Match Bypass (1 hour)
File: nemesis/ekyc_verification/views.py
Class: FaceMatchVerificationView.post()
Line: ~708
Add before SpringScan face match call:
if is_e2e_mode():
bypass_face_match(face_match_detail)
company_employee.ekyc_status = KYCVerificationStatus.SUCCESS
company_employee.save()
return Response(...) # Success response
Test with:
curl -X POST http://localhost:8000/api/v1/ekyc/<company_id>/verify_face_match/
❌ Task 5: Aadhaar OTP Send Bypass (30 min)
File: nemesis/ekyc_verification/views.py
Class: AadharCardSendOTPView.post()
Line: ~1097
Add before SpringScan OTP send:
if is_e2e_mode():
mock_response = get_e2e_mock_response('aadhaar_otp')
return Response({
KEY_MESSAGE: "OTP sent successfully",
KEY_PAYLOAD: {"reference_id": mock_response['reference_id']}
})
❌ Task 6: Aadhaar OTP Verify Bypass (30 min)
File: nemesis/ekyc_verification/views.py
Class: AadharCardVerifyOTPView.post()
Line: ~1216
Add before SpringScan OTP verify:
if is_e2e_mode() and str(otp) == str(settings.E2E_OTP_BYPASS_CODE):
bypass_ekyc_verification(verification_detail, 'aadhaar', **mock_data)
return Response(...) # Success response
⚠️ Task 7: E-Signature Bypass (2 hours) - OPTIONAL
File: nemesis/e_signature/views.py
Status: To be verified if needed
Action: Check if e-signature blocks E2E tests, add bypass if needed
❌ Task 8: Production Safety Check (1 hour)
File: nemesis/config/settings.py
After: E2E_TESTING_MODE setting
Add:
# CRITICAL: Prevent E2E mode in production
if ENVIRONMENT == "production" and E2E_TESTING_MODE:
raise ImproperlyConfigured(
"E2E_TESTING_MODE cannot be enabled in production!"
)
❌ Task 9: Testing & Validation (2 hours)
Actions:
- Test each bypass with cURL
- Run Playwright E2E tests
- Verify no external API calls in logs
- Check all verification flows complete successfully
Verification:
# Watch logs for bypass messages
tail -f nemesis/logs/app.log | grep "E2E Mode"
# Expected:
# E2E Mode: Bypassing bank verification
# E2E Mode: Bypassing PAN verification
# E2E Mode: Bypassing face match verification
Implementation Order
Phase 1: Core Setup (2 hours)
- Task 1: Create
e2e_utils.py - Task 8: Add production safety check
Phase 2: Document Verification (4 hours)
- Task 2: Bank verification bypass
- Task 3: PAN/Aadhaar bypass
- Task 4: Face match bypass
- Task 5-6: Aadhaar OTP bypasses
Phase 3: Validation (3 hours)
- Task 9: Testing all bypasses
- Task 7: E-signature (if needed)
Environment Configuration
Backend .env
E2E_TESTING_MODE=True
E2E_OTP_BYPASS_CODE=000000
E2E .env.test
E2E_OTP_BYPASS_CODE=000000
FRONTEND_URL=http://localhost:5173
API_URL=http://localhost:8000
Success Criteria
- All 10 tasks completed
- E2E tests run without external API calls
- All verifications auto-succeed in E2E mode
- Production safety check prevents E2E mode in prod
- Documentation updated
- Team trained on E2E setup
Quick Start for Developers
1. Enable E2E Mode
# In nemesis/.env
echo "E2E_TESTING_MODE=True" >> .env
echo "E2E_OTP_BYPASS_CODE=000000" >> .env
2. Start Backend
cd nemesis
python manage.py runserver
3. Run E2E Tests
cd e2e
npm test
4. Watch for Bypass Logs
# In another terminal
tail -f nemesis/logs/app.log | grep "E2E"
Notes
- OTP bypass already works ✅
- Document verification bypasses are CRITICAL for E2E tests
- All bypasses log "E2E Mode: Bypassing..." for debugging
- Production deployment will fail if E2E mode enabled
- Total implementation time: ~10 hours
Status: 6 bypasses remaining to implement