Skip to content

Add Playwright E2E test suite: deposit → countdown → unlock flow (closes #29)#54

Merged
prodbycorne merged 2 commits into
SmartDropLabs:mainfrom
joelpeace48-cell:main
Jun 24, 2026
Merged

Add Playwright E2E test suite: deposit → countdown → unlock flow (closes #29)#54
prodbycorne merged 2 commits into
SmartDropLabs:mainfrom
joelpeace48-cell:main

Conversation

@joelpeace48-cell

Copy link
Copy Markdown

Summary

Resolves #29.

  • e2e/playwright.config.ts — Playwright config targeting http://localhost:3000 with Chromium headless; starts next dev via webServer
  • e2e/mocks/freighter.ts — Deterministic Freighter stub: intercepts window.postMessage calls that @stellar/freighter-api v3 uses, returning a fixed test keypair (GA3C…EFRN) without any real extension or private key
  • e2e/farm.spec.ts — Five tests covering the full user journey:
    1. Connect wallet → header shows truncated address
    2. Deposit → modal accepts 10 XLM, submit completes, position row appears
    3. Countdown visible → Unlock button disabled before lock period elapses
    4. Fast-forward 8 days (page.clock.setFixedTime) → Unlock button becomes enabled
    5. Unlock → fill modal, sign (mock Freighter), submit (mock RPC), stake drops to 0
  • .github/workflows/e2e.yml — CI job running pnpm playwright test on push/PR to main
  • src/context/index.tsx — Exposes React Query client as window.__queryClient when NEXT_PUBLIC_E2E=true, so tests can seed pool/position data without a live Soroban node
  • package.json — Adds @playwright/test ^1.49.0 devDependency and playwright script

Test plan

  • pnpm install && pnpm playwright install chromium
  • NEXT_PUBLIC_E2E=true pnpm playwright test --config e2e/playwright.config.ts
  • All 5 tests pass in Chromium headless
  • CI workflow passes on GitHub Actions

- e2e/playwright.config.ts — Chromium config targeting localhost:3000
- e2e/mocks/freighter.ts — deterministic Freighter stub via postMessage interception
- e2e/farm.spec.ts — 5 tests: connect wallet, deposit, countdown, unlock available, unlock
- .github/workflows/e2e.yml — CI job running pnpm playwright test
- Expose QueryClient on window.__queryClient in E2E mode (NEXT_PUBLIC_E2E=true)
  so tests can seed React Query cache without needing live Soroban RPC
- Add @playwright/test devDependency
@prodbycorne prodbycorne merged commit c230131 into SmartDropLabs:main Jun 24, 2026
1 check failed
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.

Add Playwright end-to-end test for full deposit → countdown → unlock flow on testnet

3 participants