feat: implement E2E testing suite with Playwright#207
Hidden character warning
Conversation
…wallet session mocking
|
Fixes applied Playwright crashes at test discovery — before any test runs — when test.use({ ...devices["iPhone 13"] }) appears inside a describe block, because device overrides force a new worker and Playwright requires that to be top-level. Removed the inline mobile describe block from vault-deposit.spec.ts process.env in api-helpers.ts and Playwright's own type definitions (which reference Buffer, child_process, etc.) all require Node types and a tsconfig. Without them tsc --noEmit failed with ~50 errors. Added tsconfig.json with "types": ["node", "@playwright/test"] The background install completed successfully (exit code 0) — nothing to action there, it's consistent with what we already verified. The fixes are complete. To summarize what was wrong and what's now in place: Root cause: test.use({ ...devices["iPhone 13"] }) inside a test.describe() block caused Playwright to crash at test discovery — Total: 0 tests in 0 files — before a single test ran. This was the primary CI failure. Secondary issue: No tsconfig.json and no @types/node, causing process.env and Playwright's own Node-dependent types to fail type-checking. |
|
@githoboman Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
…te-covering-frontend-→-API-→-contract-flow
…and error handling scenarios
… and test pipelines
- Remove `if: false` from e2e-tests CI job so tests actually run - Guard window.__e2e_wallet__ bypass behind NODE_ENV !== "production" to prevent auth bypass in prod bundle - Add tests/e2e/.gitignore to exclude playwright-report/ and test-results/ - Remove committed playwright-report/index.html from tracking
0xDeon
left a comment
There was a problem hiding this comment.
Thanks for your contribution
tests/e2e/
├── package.json # @playwright/test + wait-on deps
├── playwright.config.ts # Chromium + iPhone 13 projects, webServer for local dev
├── fixtures/
│ ├── test-wallet.ts # injectWalletSession, seedVaultPosition, clearWalletSession
│ └── api-helpers.ts # simulateApiDown, simulateSlowNetwork, mockHealthCheck, mockUsersEndpoint
├── pages/
│ ├── dashboard.page.ts # Page object: stat cards, positions, activity, withdraw trigger
│ ├── vaults.page.ts # Page object: vault cards, deposit modal, fee breakdown
│ └── settlements.page.ts # Page object: send/receive form, LP quotes, submit button
└── specs/
├── onboarding.spec.ts # 6 tests: unauthenticated UI, wallet list, session restore, address display, empty states, auth guards
├── vault-deposit.spec.ts # 10 tests: vault list, APY/lock info, modal open, fee breakdown, full flow, balance update, history, Max button, cancel, transaction steps; + mobile viewport test
├── vault-withdraw.spec.ts # 9 tests: modal open, early-exit penalty, maturity label, Max, disabled states, full flow, balance update, history, cancel; + matured-position suite
├── settlement-flow.spec.ts # 10 tests: page load, form state hints, LP scan, quote list, Best badge, rate display, node selection, successful submit notification, receive amount update, currency/asset switcher
└── error-handling.spec.ts # 9 tests: API down, wallet disconnect, over-balance deposit, incomplete account number, auth guards, no-amount withdrawal, over-value withdrawal, slow network, mock health check
scripts/
localStorage key, so withdrawal tests skip the deposit flow entirely.└── wait-for-services.sh # Polls frontend + backend health-check before E2E run
Key design decisions
No real wallet extension needed — injectWalletSession writes nester_wallet_id / nester_wallet_addr to localStorage via page.addInitScript, exactly what WalletProvider reads on mount. Tests run without Freighter installed.
Position seeding — seedVaultPosition writes a StoredPosition directly into the nester_portfolio_v1:
Mock API mode — Playwright's page.route() intercepts backend calls; simulateApiDown aborts all backend routes. The frontend remains functional since portfolio state is localStorage-backed.
CI runs Chromium only (fast); the mobile project (iPhone 13) is scoped to vault-deposit.spec.ts only to stay under 5 minutes.
Artifacts on failure — HTML report + traces uploaded as GitHub Actions artifacts with 7-day retention.
Closes #155