# 1. Set up environment variables
cp .env.example .env.e2e
# Edit .env.e2e with your testnet credentials
# 2. Start test database
docker run -d --name predictify-e2e-db \
-e POSTGRES_DB=predictify_e2e \
-e POSTGRES_USER=postgres \
-e POSTGRES_PASSWORD=postgres \
-p 5432:5432 \
postgres:16-alpine
# 3. Run migrations
npm run db:migrate
# 4. Run E2E tests
npm run test:e2eThe Prediction Lifecycle E2E test validates:
- ✅ User authentication with Stellar wallet signature
- ✅ Market creation on testnet
- ✅ Placing predictions with real amounts
- ✅ Market resolution with winning outcomes
- ✅ Claiming winnings
- ✅ Data consistency across the entire flow
| Variable | Description | Example |
|---|---|---|
E2E_TEST_SECRET_KEY |
Testnet account secret key | SXXXXX... |
PREDICTIFY_CONTRACT_ID |
Deployed contract on testnet | CXXXXX... |
DATABASE_URL |
Test database connection | postgres://... |
SOROBAN_RPC_URL |
Testnet RPC endpoint | https://soroban-testnet.stellar.org |
predictionLifecycle.test.ts- Main E2E test suitesetup.ts- Environment configuration and defaults
E2E tests run:
- Nightly at 2 AM UTC (scheduled)
- Manually via GitHub Actions workflow_dispatch
- On push when E2E files change
View workflow: .github/workflows/e2e.yml
Tests automatically clean up:
- Created markets
- Placed predictions
- Claims
- Test users
Cleanup runs in afterAll hook and won't fail the suite if it encounters errors.
curl "https://friendbot.stellar.org?addr=YOUR_PUBLIC_KEY"docker start predictify-e2e-db- Check https://status.stellar.org/
- Increase timeout in test file
- Retry the test
See docs/e2e-testing.md for:
- Detailed setup instructions
- Architecture overview
- Best practices
- Security considerations
- Monitoring and troubleshooting
Target minimum coverage for E2E tests:
- Lines: 90%
- Functions: 80%
- Branches: 80%
- Statements: 90%
Run with coverage:
npm run test:e2e:coverage