Skip to content

feat: implement E2E testing suite with Playwright#207

Open
githoboman wants to merge 11 commits intoSuncrest-Labs:mainfrom
githoboman:feat(integration)--build-end-to-end-test-suite-covering-frontend-→-API-→-contract-flow

Hidden character warning

The head ref may contain hidden characters: "feat(integration)--build-end-to-end-test-suite-covering-frontend-\u2192-API-\u2192-contract-flow"
Open

feat: implement E2E testing suite with Playwright#207
githoboman wants to merge 11 commits intoSuncrest-Labs:mainfrom
githoboman:feat(integration)--build-end-to-end-test-suite-covering-frontend-→-API-→-contract-flow

Conversation

@githoboman
Copy link
Copy Markdown
Contributor

@githoboman githoboman commented Mar 30, 2026

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/
└── 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:

localStorage key, so withdrawal tests skip the deposit flow entirely.
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

@githoboman githoboman requested a review from 0xDeon as a code owner March 30, 2026 03:12
@githoboman
Copy link
Copy Markdown
Contributor Author

githoboman commented Mar 30, 2026

Fixes applied
Bug 1 — test.use() inside describe (the fatal one)
Closes #155

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
Created vault-deposit-mobile.spec.ts where test.use() is top-level (the only valid placement)
Updated playwright.config.ts mobile project's testMatch to point to the new file
Bug 2 — Missing tsconfig.json and @types/node

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"]
Added @types/node: "^20" to package.json
Pinned typescript back to ^5 (the background install had pulled TypeScript 6 which isn't needed)
Verified: npx playwright test --list now discovers all 55 tests across 6 files with zero errors, and npx tsc --noEmit exits cleanly.

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 githoboman changed the title feat: implement E2E testing suite with Playwright, page objects, and … feat: implement E2E testing suite with Playwright, page objects Mar 30, 2026
@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 30, 2026

@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! 🚀

Learn more about application limits

githoboman and others added 9 commits March 30, 2026 18:00
…te-covering-frontend-→-API-→-contract-flow
- 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
Copy link
Copy Markdown
Contributor

@0xDeon 0xDeon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution

@githoboman githoboman changed the title feat: implement E2E testing suite with Playwright, page objects feat: implement E2E testing suite with Playwright Apr 3, 2026
@githoboman githoboman requested a review from 0xDeon April 3, 2026 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(integration): build end-to-end test suite covering frontend → API → contract flow

2 participants