Description
The frontend has no infrastructure for end-to-end integration testing with the Soroban smart contracts and backend API. Submitting transactions to a testnet, waiting for confirmations, and verifying state changes requires a sophisticated testing infrastructure. Without this, integration bugs will reach production.
Integration test gaps:
- No test Stellar account management
- No test Soroban RPC configuration
- No automated testnet contract deployment for testing
- No fixture/seeds for test data
- No end-to-end flow tests (UI -> API -> Contract)
- No snapshot testing for contract state
- No CI integration for testnet testing
- No test data cleanup automation
- No wallet mocking for contract interactions
- No gas cost benchmarking in integration tests
Technical Context & Impact
- Affected Components/Files:
cypress/ or playwright/ (missing), test/ (missing), src/test/ (missing)
- Impact: Cannot validate full system integration; contract changes may break frontend silently
Step-by-Step Implementation Guide
- Create test infrastructure module:
src/test/integration/:
setupTestEnvironment.ts - Deploys test contracts, funds test accounts
testConfig.ts - Test constants (contract IDs, account keys, network RPC)
TestWallet.ts - Mock wallet or test Stellar account for automated interactions
- Write end-to-end integration tests:
registerMeter.spec.ts - Connect wallet -> Register meter -> Verify meter appears in list
createStream.spec.ts - Fund gas buffer -> Create stream -> Verify stream active
submitReading.spec.ts - Submit meter reading -> Verify reading stored
billingFlow.spec.ts - Full billing cycle: submit readings -> bill generated -> payment processed
- Set up test Soroban environment:
docker-compose.test.yml with:
- Stellar Quickstart container for local testnet
- Pre-configured test accounts with funding
- Contract deployment automation on container start
- Add Playwright configuration for integration:
playwright.integration.config.ts:
- Point to local testnet or testnet
- Configure test accounts with funded wallets
- Set timeouts longer for blockchain confirmations (30s)
- Create test data generators:
src/test/factories/:
meterFactory.ts - Generate realistic meter data
readingFactory.ts - Generate realistic consumption readings
streamFactory.ts - Generate stream configurations
- Add CI integration test workflow:
.github/workflows/integration.yml:
- Start local Stellar Quickstart
- Deploy contracts
- Run Playwright integration tests
- Tear down environment
- Create snapshot testing: Capture contract state after known operations and compare
Verification & Testing Steps
- Run
npm run test:integration -> verify end-to-end flows pass
- Test with local Soroban (docker): start Quickstart, deploy contracts, run tests
- Verify test accounts are properly funded before tests
- Test cleanup: verify test contracts are destroyed after test suite
- Run CI integration workflow -> verify all steps complete successfully
- Measure test coverage of user journeys -> >90% of critical paths covered
Description
The frontend has no infrastructure for end-to-end integration testing with the Soroban smart contracts and backend API. Submitting transactions to a testnet, waiting for confirmations, and verifying state changes requires a sophisticated testing infrastructure. Without this, integration bugs will reach production.
Integration test gaps:
Technical Context & Impact
cypress/orplaywright/(missing),test/(missing),src/test/(missing)Step-by-Step Implementation Guide
src/test/integration/:setupTestEnvironment.ts- Deploys test contracts, funds test accountstestConfig.ts- Test constants (contract IDs, account keys, network RPC)TestWallet.ts- Mock wallet or test Stellar account for automated interactionsregisterMeter.spec.ts- Connect wallet -> Register meter -> Verify meter appears in listcreateStream.spec.ts- Fund gas buffer -> Create stream -> Verify stream activesubmitReading.spec.ts- Submit meter reading -> Verify reading storedbillingFlow.spec.ts- Full billing cycle: submit readings -> bill generated -> payment processeddocker-compose.test.ymlwith:playwright.integration.config.ts:src/test/factories/:meterFactory.ts- Generate realistic meter datareadingFactory.ts- Generate realistic consumption readingsstreamFactory.ts- Generate stream configurations.github/workflows/integration.yml:Verification & Testing Steps
npm run test:integration-> verify end-to-end flows pass