Skip to content

Commit 5528717

Browse files
authored
docs: add swapper execution testing requirements (#11523)
1 parent be6c5f8 commit 5528717

File tree

1 file changed

+136
-1
lines changed

1 file changed

+136
-1
lines changed

docs/testing.md

Lines changed: 136 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,139 @@ act -s GITHUB_TOKEN=$GITHUB_TOKEN -j <job-name> --reuse
8787

8888
Two important flags that can be passed to the `act` command:
8989
- `--reuse` - persist state across runs
90-
- `--rm` - remove container on failure
90+
- `--rm` - remove container on failure
91+
92+
## Swapper Integration Testing
93+
94+
For PRs related to swapper integrations, swapper behavior changes, or quote aggregation, **actual swap execution testing is required** to ensure production readiness.
95+
96+
### When Swap Execution Testing is Required
97+
98+
Execute actual swaps when the PR involves:
99+
100+
1. **New Swapper Integration**: Adding support for a new DEX aggregator, bridge, or swapper
101+
- Examples: Integrating Bebop, Portals, Jupiter, 0x, 1inch, Relay, Cetus, etc.
102+
103+
2. **Swapper Behavior Changes**: Modifying existing swapper logic
104+
- Fee calculation changes
105+
- Quote fetching modifications
106+
- Route optimization updates
107+
- Slippage tolerance adjustments
108+
109+
3. **Chain Adapter Modifications**: Changes to chain adapters affecting swap flows
110+
- New chain support for swaps
111+
- Gas estimation changes
112+
- Transaction building modifications
113+
114+
4. **Quote Aggregation Changes**: Updates to how quotes are fetched, sorted, or presented
115+
- Multi-swapper aggregation logic
116+
- Quote filtering/sorting algorithms
117+
- Rate calculation modifications
118+
119+
### Testing Requirements
120+
121+
#### Minimum Testing Scope
122+
123+
For each swapper-related PR, execute **at least 2 successful swaps**:
124+
125+
1. **Primary swap direction**: Test the main use case
126+
- Example: ETH → USDC on the new swapper
127+
128+
2. **Secondary swap direction**: Test reverse or alternative route
129+
- Example: USDC → ETH or ETH → BTC
130+
131+
3. **Cross-chain swap (if applicable)**: Test bridge/cross-chain functionality
132+
- Example: USDC on Arbitrum → New Chain (Plasma, SUI, HyperEVM, Monad, etc.)
133+
- Example: ETH on Ethereum → Asset on new chain
134+
- Verify cross-chain route aggregation and bridge selection
135+
136+
#### Comprehensive Testing Checklist
137+
138+
- [ ] **Quote Accuracy**: Verify quoted rates match executed rates (within acceptable slippage)
139+
- [ ] **Balance Updates**: Confirm source and destination balances update correctly post-swap
140+
- [ ] **Fee Estimation**: Validate transaction fees match estimates
141+
- [ ] **Transaction Completion**: Ensure swaps complete successfully with proper notifications
142+
- [ ] **Error Handling**: Test edge cases (insufficient balance, no routes, etc.)
143+
- [ ] **Multi-chain Support**: For cross-chain swappers, test bridge functionality
144+
- [ ] **Price Impact**: Verify price impact calculations are accurate
145+
- [ ] **Slippage Tolerance**: Test swaps near slippage limits
146+
- [ ] **Transaction History Parsing**: Verify TX history displays correctly for new chains/swappers
147+
- Navigate to asset page and verify TX appears in history
148+
- Click on TX row to open details drawer
149+
- Verify all TX details are correct (amount, fee, timestamp, addresses, status)
150+
- Check that TX type is correctly identified (swap, send, receive, etc.)
151+
- [ ] **Cross-chain TX Tracking**: For bridge swaps, verify both source and destination TX appear
152+
153+
### Testing Methodology
154+
155+
#### Local Development Testing
156+
157+
```bash
158+
# 1. Start local development environment
159+
yarn dev
160+
161+
# 2. Use browser automation (Playwright) or manual testing
162+
# Connect wallet and execute test swaps
163+
164+
# 3. Document results in PR comment
165+
```
166+
167+
#### Required Test Documentation
168+
169+
Include the following in your PR:
170+
171+
```markdown
172+
## Swap Execution Test Results
173+
174+
### Test 1: [Asset A] → [Asset B]
175+
176+
**Setup**:
177+
- Direction: [Asset A] → [Asset B]
178+
- Amount: [amount]
179+
- Protocol: [swapper name]
180+
181+
**Pre-Swap Balances**:
182+
- [Asset A]: [balance]
183+
- [Asset B]: [balance]
184+
185+
**Quote Details**:
186+
- Expected output: [amount]
187+
- Exchange rate: [rate]
188+
- Fee: [fee]
189+
- Price impact: [%]
190+
191+
**Execution**: ✅ Success / ❌ Failed
192+
- Transaction hash: [hash]
193+
- Block explorer: [link]
194+
195+
**Post-Swap Balances**:
196+
- [Asset A]: [balance] (change: [delta])
197+
- [Asset B]: [balance] (change: [delta])
198+
199+
**Verification**:
200+
- ✅/❌ Quote accuracy
201+
- ✅/❌ Balance updates
202+
- ✅/❌ Fee estimation
203+
- ✅/❌ Transaction notification
204+
205+
**Notes**: [any observations]
206+
```
207+
208+
### Testing Best Practices
209+
210+
1. **Use Testnet When Possible**: Prefer testnets for initial validation, but include at least 1 mainnet swap for production verification
211+
2. **Document Edge Cases**: Note any limitations, directional liquidity issues, or unsupported routes
212+
3. **Test Multiple Amounts**: Small, medium, and large swaps may have different behaviors
213+
4. **Monitor Console Errors**: Document any errors or warnings during swap execution
214+
5. **Verify UI/UX**: Ensure loading states, notifications, and error messages display correctly
215+
216+
### Example Test Reports
217+
218+
See `.playwright-mcp/swap-execution-test-report.md` for comprehensive testing examples.
219+
220+
### Automated Testing (Future)
221+
222+
While manual swap execution is currently required, we aim to automate this with:
223+
- Playwright end-to-end tests
224+
- Mock swapper responses for unit tests
225+
- Testnet automation for CI/CD pipelines

0 commit comments

Comments
 (0)