feat: build end-to-end integration test infrastructure with Soroban t… - #37
Merged
KarenZita01 merged 1 commit intoJul 30, 2026
Merged
Conversation
…estnet and Playwright Closes EquipChain#30 ## What this PR does Implements the complete end-to-end integration test infrastructure requested in issue EquipChain#30, covering all seven gap areas identified: ### New files added **Test infrastructure (src/test/integration/)** - estConfig.ts - Full typed config: base URL, Soroban RPC URL, network passphrase, test account secret, contract IDs (meterRegistry, streamManager, billingLedger), tx confirmation timeout, and per-operation gas cost benchmarks (registerMeter, createStream, submitReading, processBilling). - setupTestEnvironment.ts - isSorobanRpcHealthy() health probe, captureContractSnapshot() / snapshotsAreDifferent() for snapshot testing, deployTestContracts() placeholder wired to CONTRACT_ID_* env vars, and a LIFO cleanup registry (registerCleanup / runTestCleanup). - TestWallet.ts - Mock wallet class that simulates Freighter/Stellar wallet connect/disconnect, signTransaction with gas tracking, getTotalGasUsed(), getLastTransactionGas(), and reset(). Throws on signTransaction when not connected. Includes static fromTestConfig() factory. **Test data factories (src/test/factories/)** - meterFactory.ts - Typed Meter records (Electric/Water/Gas, Active/ Inactive/Maintenance) with unit-aware reading and consumption values, meterBatch() helper. - eadingFactory.ts - Typed Reading records with txHash, readingTimeSeries() helper that generates an ascending-timestamp series for a given meter. - streamFactory.ts - Typed Stream records (Real-time/Batch, Streaming/ Paused/Stopped) with uptime percentages, streamBatch() helper. **E2E specs (src/test/integration/specs/)** - egisterMeter.spec.ts - 11 tests covering: page heading, subtitle, Export button, all 8 column headers, meter-001/002/003 rows, Active/ Inactive badges, TestWallet gas benchmark, and Soroban RPC snapshot (skipped when RPC unavailable). - createStream.spec.ts - 11 tests covering: page heading, subtitle, Export button, all 7 column headers, stream-001/002/003 rows, Streaming/Paused badges, uptime display, TestWallet gas + disconnect error + reset, and Soroban RPC snapshot. - submitReading.spec.ts - 14 tests covering: Dashboard heading, subtitle, Export button, all 6 summary cards (Active Meters, Total Consumption, Active Streams, Pending Bills, Gas Buffer, Monthly Spend), numeric values, trend indicators, readingFactory unit tests, readingTimeSeries ordering, gas benchmark, and Soroban RPC snapshot. - �illingFlow.spec.ts - 14 tests covering: Billing heading, subtitle, Export button, View Invoice toggle (show/hide), all 8 column headers, INV-2024-001/002/003 rows, Paid/Pending/Overdue badges, multi-tx gas tracking, wallet transaction history, and Soroban RPC snapshot. **Playwright config (playwright.integration.config.ts)** - testDir points to specs/, 90s test timeout, 15s expect timeout, chromium only, webServer auto-starts Next.js dev server, trace on failure, output to test-results/playwright-integration/. **Docker test environment (docker-compose.test.yml)** - stellar/quickstart:testing with --local --enable-stellar-rpc, health-checked on port 8000/rpc. **CI workflow (.github/workflows/integration.yml)** - Triggers on pull_request to main and workflow_dispatch. - Spins up stellar service container, installs deps, installs Playwright chromium, runs npm run test:integration with correct env vars. **Supporting changes** - package.json - Added @playwright/test ^1.52.0 devDependency and test:integration script. - .gitignore - Added /test-results and /playwright-report. - README.md - Added Integration Testing section with docker + npm run commands for local usage (bash and PowerShell). ## Verification - All TypeScript files pass tsc with zero diagnostics (verified via IDE language server). - All Soroban-dependent test blocks are gated behind isSorobanRpcHealthy() and self-skip when the RPC is unavailable, so the standard CI lint/build job is not affected. - UI-only tests (heading, table headers, badge text, toggle interactions) run against the live Next.js dev server and assert on real DOM output from the existing page components. - Gas benchmark assertions use configurable thresholds from testConfig.ts, injectable via environment variables.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…estnet and Playwright
Closes #30
What this PR does
Implements the complete end-to-end integration test infrastructure requested in issue #30, covering all seven gap areas identified:
New files added
Test infrastructure (src/test/integration/)
Test data factories (src/test/factories/)
eadingFactory.ts - Typed Reading records with txHash, readingTimeSeries() helper that generates an ascending-timestamp series for a given meter.
E2E specs (src/test/integration/specs/)
egisterMeter.spec.ts - 11 tests covering: page heading, subtitle, Export button, all 8 column headers, meter-001/002/003 rows, Active/ Inactive badges, TestWallet gas benchmark, and Soroban RPC snapshot (skipped when RPC unavailable).
Playwright config (playwright.integration.config.ts)
Docker test environment (docker-compose.test.yml)
CI workflow (.github/workflows/integration.yml)
Supporting changes
Verification
closes #30