Skip to content

test: add Playwright E2E mock wallet test suite - #30

Merged
JamesEjembi merged 1 commit into
Lumina-etwork:mainfrom
KarenZita01:main
Jun 19, 2026
Merged

test: add Playwright E2E mock wallet test suite#30
JamesEjembi merged 1 commit into
Lumina-etwork:mainfrom
KarenZita01:main

Conversation

@KarenZita01

Copy link
Copy Markdown
Contributor

Summary

Adds Playwright E2E tests with a configurable mock Freighter wallet implementation, fulfilling issue #16.

Changes

New files

  • tests/mocks/mockFreighter.ts — Configurable mock Freighter implementation exposing \isConnected, \getUserInfo, \signTransaction, \signAuthEntry\ with configurable success/error responses and optional network delay simulation
  • tests/fixtures/walletFixtures.ts — Pre-funded wallet identities (Alice, Bob, Carol) with deterministic public keys and known balances
  • tests/e2e/walletFlows.spec.ts — 7 tests covering: connect, disconnect, account switch, re-connect, generation counter, connection refused, getUserInfo error handling
  • tests/e2e/billingFlows.spec.ts — 6 tests covering: dashboard render with wallet, generation increments, transitioning state, connection refused, sign transaction, session disconnect

Modified files

  • playwright.config.ts — Updated \ estDir\ to ./tests/e2e, dev server command uses --webpack\
  • tsconfig.json — Excluded ./tests/**/*\ from Next.js TypeScript compilation
  • .gitignore — Added /test-results/\ and /playwright-report/\
  • .github/workflows/test.yml — Added Playwright install and test steps to CI

Test Results

All 13 tests pass in headless Chromium:

\
13 passed (1.1m)
\\

Testing Approach

  • Mock injected via \page.addInitScript\ before app code executes
  • Wallet connection triggered by dispatching \�ccountChange\ event after React hydration
  • Assertions use DOM attribute matching, not visual snapshots
  • Wallet state changes via __switchWallet\ helper and direct mock replacement

Closes #16

- Create mockFreighter.ts with configurable FreighterApi mock

- Create walletFixtures.ts with pre-funded wallet identities

- Add walletFlows.spec.ts covering connect/disconnect/switch/reconnect

- Add billingFlows.spec.ts covering billing flows, error states, session watch

- Update playwright.config.ts for test directory and webpack dev server

- Update CI workflow to run Playwright tests

- Exclude tests/ from Next.js TypeScript compilation

Closes Lumina-etwork#16

@JamesEjembi JamesEjembi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@JamesEjembi
JamesEjembi merged commit f4b57f8 into Lumina-etwork:main Jun 19, 2026
1 check passed
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.

Playwright Automated Regression E2E Tests Using Hardened Mock Wallets

2 participants