Skip to content

Latest commit

 

History

History
139 lines (96 loc) · 2.8 KB

File metadata and controls

139 lines (96 loc) · 2.8 KB

E2E Testing Quick Start Guide

🚀 5-Minute Setup

1. Install Dependencies

pnpm install

2. Start Test Services

# In one terminal, start the test environment
docker-compose -f apps/api-service/docker-compose.e2e.yml up -d

# Wait for services to be ready (30-60 seconds)

3. Run Tests

# Run all E2E tests
pnpm run test:e2e

# Or run from api-service directory
cd apps/api-service
pnpm run test:e2e

🎯 Quick Test Examples

Run Specific Test Suites

# Test basic API functionality
pnpm run test:e2e --testNamePattern="Basic API"

# Test gasless transactions
pnpm run test:e2e --testNamePattern="Gasless Transaction"

# Test failure scenarios
pnpm run test:e2e --testNamePattern="Failure"

Watch Mode for Development

# Run tests in watch mode
pnpm run test:e2e --watch

# Run only failed tests
pnpm run test:e2e --onlyFailures

🛠️ Common Tasks

Reset Test Environment

# Stop all services
docker-compose -f apps/api-service/docker-compose.e2e.yml down -v

# Start fresh
docker-compose -f apps/api-service/docker-compose.e2e.yml up -d

Check Service Status

# View running containers
docker-compose -f apps/api-service/docker-compose.e2e.yml ps

# View logs
docker-compose -f apps/api-service/docker-compose.e2e.yml logs api-service

Debug Test Issues

# Run with verbose output
pnpm run test:e2e --verbose

# Enable debug logging
LOG_LEVEL=debug pnpm run test:e2e

# Run single test file
pnpm run test:e2e apps/api-service/test/e2e/basic-api.e2e-spec.ts

📋 Prerequisites Checklist

Before running E2E tests, ensure you have:

  • Node.js 18+ installed
  • Docker and Docker Compose installed
  • pnpm package manager installed
  • Dependencies installed (pnpm install)
  • Test services running (docker-compose up -d)
  • Environment variables configured

🆘 Quick Troubleshooting

"Connection refused" errors

# Check if services are running
docker-compose -f apps/api-service/docker-compose.e2e.yml ps

# Restart services if needed
docker-compose -f apps/api-service/docker-compose.e2e.yml restart

"Database connection failed"

# Check PostgreSQL logs
docker-compose -f apps/api-service/docker-compose.e2e.yml logs postgres

# Restart database
docker-compose -f apps/api-service/docker-compose.e2e.yml restart postgres

Tests timing out

# Increase Jest timeout
pnpm run test:e2e --testTimeout=30000

📚 Next Steps

  1. Read the full E2E Testing Documentation
  2. Explore test implementation examples
  3. Review CI/CD integration
  4. Check test utilities

Need help? Check the full documentation or create an issue