harb/tests/e2e/usertest
johba db9e99f4c0 fix: fix: wallet connector panel not rendering at standard viewports — blocks all user funnels (#1156)
Root cause: the test wallet provider's eth_accounts and getProviderState
always returned the account address regardless of connection state. This
caused wagmi to auto-connect via EIP-6963 provider discovery, skipping
the 'disconnected' status entirely. As a result, .connect-button--disconnected
never rendered and .connectors-element was never shown.

Changes:
- wallet-provider: eth_accounts returns [] when not connected (EIP-1193 compliant)
- wallet-provider: getProviderState returns empty accounts when not connected
- All wallet connection helpers: handle auto-reconnect case, increase timeout
  for wagmi to settle into disconnected state (5s → 10s)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-25 09:29:53 +00:00
..
alex-newcomer.spec.ts fix: E2E test files use file-level eslint-disable for no-restricted-syntax, suppressing all future rules in that group (#451) 2026-03-06 01:12:26 +00:00
all-personas.spec.ts fix: E2E test files use file-level eslint-disable for no-restricted-syntax, suppressing all future rules in that group (#451) 2026-03-06 01:12:26 +00:00
generate-feedback.mjs feat/ponder-lm-indexing (#142) 2026-02-18 00:19:05 +01:00
helpers.ts fix: fix: wallet connector panel not rendering at standard viewports — blocks all user funnels (#1156) 2026-03-25 09:29:53 +00:00
marcus-degen.spec.ts fix: E2E test files use file-level eslint-disable for no-restricted-syntax, suppressing all future rules in that group (#451) 2026-03-06 01:12:26 +00:00
playwright.config.ts feat/ponder-lm-indexing (#142) 2026-02-18 00:19:05 +01:00
priya-institutional.spec.ts fix: E2E test files use file-level eslint-disable for no-restricted-syntax, suppressing all future rules in that group (#451) 2026-03-06 01:12:26 +00:00
README.md feat/ponder-lm-indexing (#142) 2026-02-18 00:19:05 +01:00
sarah-yield-farmer.spec.ts fix: E2E test files use file-level eslint-disable for no-restricted-syntax, suppressing all future rules in that group (#451) 2026-03-06 01:12:26 +00:00
setup-chain-state.ts Replace UBI with ETH reserve in ring buffer, fix Dockerfile HEALTHCHECK, enhance LiveStats (#154) 2026-02-19 14:47:15 +01:00
test-a-passive-holder.spec.ts fix: E2E test files use file-level eslint-disable for no-restricted-syntax, suppressing all future rules in that group (#451) 2026-03-06 01:12:26 +00:00
test-b-staker-v2.spec.ts fix: E2E test files use file-level eslint-disable for no-restricted-syntax, suppressing all future rules in that group (#451) 2026-03-06 01:12:26 +00:00
test-b-staker.spec.ts fix: E2E test files use file-level eslint-disable for no-restricted-syntax, suppressing all future rules in that group (#451) 2026-03-06 01:12:26 +00:00
test-landing-variants.spec.ts fix: lint: Ban waitForTimeout, setTimeout-as-delay, and fixed sleep patterns (#442) 2026-03-03 20:58:01 +00:00
tyler-retail-degen.spec.ts fix: E2E test files use file-level eslint-disable for no-restricted-syntax, suppressing all future rules in that group (#451) 2026-03-06 01:12:26 +00:00

User Testing Scripts

This directory contains 5 Playwright test scripts simulating different user personas interacting with the Kraiken DeFi protocol.

Personas

  1. Marcus "Flash" Chen (marcus-degen.spec.ts) - Degen/MEV Hunter

    • Anvil account #1
    • Tests edge cases, probes snatching mechanics, looks for exploits
    • Skeptical, technical, profit-driven
  2. Sarah Park (sarah-yield-farmer.spec.ts) - Cautious Yield Farmer

    • Anvil account #2
    • Researches thoroughly, seeks sustainable returns
    • Conservative, reads everything, compares to Aave
  3. Tyler "Bags" Morrison (tyler-retail-degen.spec.ts) - Retail Degen

    • Anvil account #3
    • YOLOs in without reading, gets confused easily
    • Impulsive, mobile-first, community-driven
  4. Dr. Priya Malhotra (priya-institutional.spec.ts) - Institutional/Analytical Investor

    • Anvil account #4
    • Analyzes mechanism design with academic rigor
    • Methodical, game-theory focused, large capital allocator
  5. Alex Rivera (alex-newcomer.spec.ts) - Crypto-Curious Newcomer

    • Anvil account #0
    • First time in DeFi, intimidated but willing to learn
    • Needs hand-holding, compares to Coinbase

Prerequisites

  1. Running stack (required before tests):

    cd /home/debian/harb
    ./scripts/dev.sh start
    
  2. Wait for stack health:

    • Anvil on port 8545
    • Ponder/GraphQL on port 42069
    • Web-app on port 5173 (proxied on 8081)
    • Contracts deployed (deployments-local.json populated)

Running Tests

All personas:

cd /home/debian/harb
npx playwright test tests/e2e/usertest/

Individual persona:

npx playwright test tests/e2e/usertest/marcus-degen.spec.ts
npx playwright test tests/e2e/usertest/sarah-yield-farmer.spec.ts
npx playwright test tests/e2e/usertest/tyler-retail-degen.spec.ts
npx playwright test tests/e2e/usertest/priya-institutional.spec.ts
npx playwright test tests/e2e/usertest/alex-newcomer.spec.ts

With UI (headed mode):

npx playwright test tests/e2e/usertest/marcus-degen.spec.ts --headed

Debug mode:

npx playwright test tests/e2e/usertest/marcus-degen.spec.ts --debug

Output

Screenshots

Saved to test-results/usertest/<persona-name>/:

  • Landing page
  • Wallet connection
  • Swap transactions
  • Stake forms
  • Error states
  • Final dashboard

JSON Reports

Saved to /home/debian/harb/tmp/usertest-results/<persona-name>.json:

{
  "personaName": "Marcus Flash Chen",
  "testDate": "2026-02-13T21:45:00.000Z",
  "pagesVisited": [
    {
      "page": "Landing",
      "url": "http://localhost:8081/app/",
      "timeSpent": 2000,
      "timestamp": "2026-02-13T21:45:02.000Z"
    }
  ],
  "actionsAttempted": [
    {
      "action": "Connect wallet",
      "success": true,
      "timestamp": "2026-02-13T21:45:05.000Z"
    }
  ],
  "screenshots": ["test-results/usertest/marcus-flash-chen/..."],
  "uiObservations": [
    "Lands on app, immediately skeptical - what's the catch?"
  ],
  "copyFeedback": [
    "Landing page needs 'Audited by X' badge prominently displayed"
  ],
  "tokenomicsQuestions": [
    "What prevents someone from flash-loaning to manipulate VWAP?"
  ],
  "overallSentiment": "Intrigued but cautious. Mechanics are novel..."
}

Console Logs

Each test logs observations in real-time:

[Marcus] Lands on app, immediately skeptical - what's the catch?
[Marcus - COPY] Landing page needs "Audited by X" badge prominently displayed
[Marcus - TOKENOMICS] What prevents someone from flash-loaning to manipulate VWAP?
[SCREENSHOT] landing-page: test-results/usertest/marcus-flash-chen/...

What Each Test Does

Marcus (Degen)

  1. Lands on app, looks for audit/docs
  2. Connects wallet immediately
  3. Tests small swap (0.01 ETH) then large swap (1.5 ETH)
  4. Stakes at low tax rate (2%) to test snatching
  5. Looks for snatch targets among other positions
  6. Examines statistics for meta trends

Sarah (Yield Farmer)

  1. Reads landing page thoroughly
  2. Looks for About/Docs/Team FIRST
  3. Checks for audit badge
  4. Connects wallet hesitantly
  5. Studies statistics and tax rates
  6. Small test purchase (0.1 ETH)
  7. Conservative stake at 15% tax
  8. Compares to Aave mentally

Tyler (Retail)

  1. Glances at landing, immediately connects wallet
  2. Looks for buy button (gets confused)
  3. Finds cheats page randomly
  4. Buys $150 worth without research
  5. Stakes at random tax rate (5%)
  6. Checks for immediate gains
  7. Gets confused about tax/snatching
  8. Looks for Discord to ask questions

Priya (Institutional)

  1. Looks for whitepaper/technical docs
  2. Checks for audit and governance info
  3. Analyzes liquidity snapshot
  4. Tests large swap (5 ETH) to measure slippage
  5. Reviews tax rate distribution for Nash equilibrium
  6. Stakes at calculated optimal rate (12%)
  7. Evaluates risk, composability, exit liquidity
  8. Writes detailed assessment

Alex (Newcomer)

  1. Reads landing page carefully but confused
  2. Looks for tutorial/getting started
  3. Nervous about connecting wallet (scam fears)
  4. Reads info tooltips, still confused
  5. Looks for FAQ (risk disclosures)
  6. Tiny test purchase (0.05 ETH)
  7. Overwhelmed by tax rate choices
  8. Stakes conservatively at 15%, worried about snatching
  9. Compares to Coinbase staking

Analyzing Results

Key Metrics:

  • Time spent per page - Which pages confuse users? Where do they linger?
  • Failed actions - What breaks? What error messages are unclear?
  • UI observations - What's confusing, missing, or broken?
  • Copy feedback - What messaging needs improvement?
  • Tokenomics questions - What concepts aren't explained?

Common Themes to Look For:

  • Onboarding friction - Do newcomers understand what to do?
  • Trust signals - Are audit/security concerns addressed?
  • Tax rate confusion - Can users choose optimal rates?
  • Snatching fear - Is the mechanism explained clearly?
  • Return visibility - Can users see earnings potential?

Extending Tests

To add a new persona:

  1. Copy an existing spec file
  2. Update persona details and behaviors
  3. Use a different Anvil account (keys in wallet-provider.ts)
  4. Implement persona-specific journey
  5. Add to this README

Troubleshooting

Tests fail immediately:

  • Check stack is running: ./scripts/dev.sh status
  • Check deployments exist: cat onchain/deployments-local.json

Wallet connection fails:

  • Check wallet-provider.ts is creating correct context
  • Verify RPC URL is accessible

Screenshots missing:

  • Check test-results/usertest/ directory exists
  • Verify filesystem permissions

JSON reports empty:

  • Check tmp/usertest-results/ directory exists
  • Verify writeReport() is called in finally block