Comprehensive testing guide for AstaVerde - covering automated tests, local QA, and webapp testing.
# Start the webapp against Sepolia (currently Arbitrum Sepolia)
npm run dev:sepolia
# Fast QA testing (~450ms)
npm run qa:fast
# Full test suite
npm run test
# Coverage analysis
npm run coverage173/173 tests passing covering:
- ✅ Contract logic: deposit, withdraw, redemption, access control
- ✅ Security: reentrancy, redeemed NFT rejection, role management
- ✅ Gas optimization: deposit <230k, withdraw <120k
- ✅ Edge cases: insufficient funds, zero amounts, invalid inputs
- ✅ Phase 1↔2 integration: marketplace + vault interactions
Provides a testnet-connected webapp for manual QA:
- Uses
webapp/.env.local(untracked) for addresses + RPC - Runs on
http://localhost:3002 - Wallet + UI flows test against the current Sepolia target (Arbitrum Sepolia)
Note: npm run dev:local (local Hardhat full stack) is considered legacy in the current workflow.
# Ultra-fast system health check (~400ms)
npm run qa:status
# Fast critical path testing (~450ms)
npm run qa:fast
# Comprehensive testing with reports
npm run qa:fullAccess these pages when running npm run dev:sepolia:
http://localhost:3002/- Main marketplacehttp://localhost:3002/mytokens- Token management & vaulthttp://localhost:3002/test-vault- Vault testing interfacehttp://localhost:3002/debug-approve- Approval debugginghttp://localhost:3002/admin- Admin functions
Since contracts are thoroughly tested (173 passing tests), focus webapp testing on:
- Wallet Connection: MetaMask, WalletConnect, Coinbase
- NFT Purchase: Browse → Select → Approve USDC → Buy → Confirm
- Vault Operations: Deposit NFT → Receive SCC → Withdraw
- Multi-tab Behavior: State sync across browser tabs
- Insufficient USDC balance
- Rejected transactions
- Network switching mid-flow
- Browser refresh during transactions
- Mobile responsiveness
- Loading states during transactions
- Error message clarity
- Transaction feedback
- Mobile layout
- Dark mode (if implemented)
- Wallet connects successfully
- Correct network displayed
- Balances update correctly
- Gas estimates shown
- Loading indicators appear
- Can't double-submit
- Clear status messages
- Transaction hash displayed
- Success confirmation
- Balances update
- UI reflects new state
- Can continue with next action
- User rejection handled gracefully
- Network errors show clear message
- Insufficient funds message helpful
- Recovery actions available
# Fund all test accounts with USDC and ETH
npm run task:fund-all
# Mint test NFT batches
npm run task:mint:local
# Setup vault test scenarios
node scripts/setup-vault-webapp.js// Available test accounts (all funded in dev mode)
const TEST_ACCOUNTS = [
"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266", // Account 0 (Admin)
"0x70997970C51812dc3A010C7d01b50e0d17dc79C8", // Account 1
"0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC", // Account 2
// ... up to Account 19
];When webapp is running, use browser console:
// Check wallet connection
await ethereum.request({ method: "eth_accounts" });
// Get current network
await ethereum.request({ method: "eth_chainId" });
// Check contract deployment
await ethereum.request({
method: "eth_getCode",
params: ["0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512", "latest"],
});# Verify contract state
node scripts/verify-vault.js
# Debug approval issues
node scripts/debug-approve.js
# Reset vault to clean state
node scripts/reset-vault-state.js- Mint Batch: ~450k gas
- Buy NFT: ~235k gas
- Deposit to Vault: ~215k gas
- Withdraw from Vault: ~110k gas
- Full Workflow: ~525k gas
- Initial Load: < 2s
- Wallet Connection: < 1s
- Transaction Confirmation: Network dependent (3-5s on local)
- State Updates: Immediate on local
Solution: Ensure wallet is connected and on correct network
Solution: Run npm run task:fund-all to fund test accounts
Solution: Check contract state with verify-vault.js, might need to unpause
Solution: Local dev uses mock data, no IPFS needed
Solution: Usually indicates the transaction will fail, check requirements
- Run on every PR
- Execute full test suite
- Check gas benchmarks
- Verify compilation
- Run lintingnpm run lint # Solidity + TypeScript linting
npm run prettier:check # Code formatting
npm run test # Full test suite
npm run build:all # Verify buildsPlace in test/ directory:
describe("Feature", function () {
it("should behave correctly", async function () {
// Test implementation
});
});Place in webapp/e2e/synpress/specs/:
describe("User Flow", () => {
it("completes purchase", () => {
// E2E test
});
});