— Alexander Aptus
"It's not done until it's tested AS DEPLOYED!"
- ❌ "Works on my machine" = NOT DONE
- ❌ "Tests pass in dev environment" = NOT DONE
- ✅ "Tests pass against PRODUCTION/STAGING URL" = DONE
- Deploy first - Push to target environment (AWS, Vercel, etc.)
- Test deployed - Run E2E tests against actual deployed URLs
- Real browser - Use Playwright with real Chrome/DevTools
- User perspective - Test what actual users will experience
"localhost is ONLY for local_test - NEVER in demo, staging, or production!"
Frontend was built with http://localhost:3000 hardcoded. Deployed to AWS CloudFront.
E2E tests passed locally. But USERS couldn't login because frontend called localhost
instead of AWS API. Wasted hours debugging "Invalid email/password" that was actually
a wrong URL.
- Environment variables ONLY - Never hardcode URLs in source code
- Build-time injection - Use
VITE_API_URL,NEXT_PUBLIC_API_URL, etc. - Test configs - E2E tests MUST read URLs from environment variables
- Three tiers:
local_test→ localhost allowed (ONLY here)demo/staging→ MUST use real URLsproduction→ MUST use production URLs
# Fail build if localhost found in production artifacts
if grep -r "localhost" dist/ 2>/dev/null; then
echo "❌ FAIL: localhost contamination detected in build!"
exit 1
fi# Test against AWS (production) - THE REAL TEST
PATIENT_PWA_URL=https://d2wowd7dw25och.cloudfront.net \
DOCTOR_PWA_URL=https://d24gl9ln0vt8cq.cloudfront.net \
API_URL=https://nmpjiqngaz.us-east-1.awsapprunner.com \
pytest tests/e2e/ --headed
# Test against local (development ONLY - not Definition of Done!)
pytest tests/e2e/The user doesn't run your dev environment. Test what they'll actually use.
Silent failures where app "works" but calls wrong backend are the worst bugs.