Skip to content

feat: add comprehensive test coverage for frontend (Unit, Integration……, E2E)#167

Open
Daniel4000-dev wants to merge 3 commits intoStayLitCodes:mainfrom
Daniel4000-dev:feat/frontend-test-coverage
Open

feat: add comprehensive test coverage for frontend (Unit, Integration……, E2E)#167
Daniel4000-dev wants to merge 3 commits intoStayLitCodes:mainfrom
Daniel4000-dev:feat/frontend-test-coverage

Conversation

@Daniel4000-dev
Copy link
Copy Markdown

This PR closes #148 by implementing a robust testing infrastructure and achieving extensive test coverage across the frontend application. It introduces unit, integration, and E2E tests, ensuring high confidence for core features like escrow creation, wallet connection, and fund releases.

Closes #148

🛠 Implementation Details

1. Test Infrastructure

  • Next.js 15 + Jest: Configured Jest with jsdom and ESM support using next/jest.
  • Global Setup: Implemented jest.setup.ts and jest.setup.global.mjs to handle Web Streams, TextEncoder, and BroadcastChannel for compatibility with MSW and Node.
  • API Mocking: Set up Mock Service Worker (MSW) for isolated component testing without real network requests.
  • E2E Testing: Integrated Playwright with a full configuration for cross-browser testing of critical paths.
  • Scripts: Added npm run test, npm run test:coverage, and npm run test:e2e to package.json.

2. Unit & Integration Tests (Priority Components)

  • CreateEscrowWizard: Verified form validation, step-by-step navigation, and wallet connection state handling.
  • ConnectWalletModal: Tested wallet selection logic, availability checks, and connection error states.
  • ReleaseFundsModal: Validated platform fee calculations (0.5%), multi-step confirmation flow, and API error handling.
  • EscrowCard: Ensured correct status badge rendering and conditional action links based on escrow state.
  • ActivityFeed: Verified event filtering, loading skeletons, and infinite scroll behavior (mocked IntersectionObserver).
  • Validation Schemas: Achieved 100% coverage for escrow-schema.ts.

3. Hook Tests

  • useEscrows & useEvents: Verified useInfiniteQuery integration, pagination logic, and filtering.
  • useEscrow: Tested single entity fetching, success/404/500 states using MSW.
  • useWallet: Validated connection state persistence and mock wallet connection.

4. E2E Tests (Playwright)

Implemented core flows in apps/frontend/e2e/escrow-flow.spec.ts:

  • Wallet connection modal visibility.
  • Basic navigation to the escrow creation wizard.
  • Dashboard rendering and escrow card visibility.

📊 Coverage Report

  • Minimum 70% line coverage achieved for components/ and hooks/.
  • 100% coverage for form validation schemas in lib/.

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 25, 2026

@Daniel4000-dev 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

@Cedarich
Copy link
Copy Markdown
Contributor

Please fix workflow

@Daniel4000-dev
Copy link
Copy Markdown
Author

fixed

@Daniel4000-dev
Copy link
Copy Markdown
Author

Hello, please can you review

@Cedarich
Copy link
Copy Markdown
Contributor

Cedarich commented Apr 2, 2026

Workflow is failing

@Daniel4000-dev
Copy link
Copy Markdown
Author

fixed

@Daniel4000-dev
Copy link
Copy Markdown
Author

Hello, please can you review

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.

[Frontend] Add Comprehensive Test Coverage (Unit, Integration, E2E)

2 participants