# End-to-End Retest Plan — SimTrade Integration

**Date:** 2026-04-07
**Owner:** 135-provision agent
**Evidence folder:** `.agent-status/retest-evidence/`

## Test Tracks

### Track A — Existing $50k account (RUN NOW)
Re-verify all endpoints with mapper fixes, mobile provision-on-login (PR #135), and numeric qty fix (PR #274).
Account: `mfathonin+ts1@nanostreet.ai` (already has $50k)

### Track B — Fresh $100k account (BLOCKED)
Blocked on Alpaca enabling `/v1/instant_funding` — see `BLOCKER_alpaca_instant_funding.md`.

## How to Run (Track A)

**Tool:** Headless browser (Playwright MCP) running the Expo web app on port 8083

**Required:** Backend PR #274 (numeric qty fix) deployed first. Verify with curl that backend accepts `qty` as a number.

## Test Steps

| # | Step | Expected |
|---|------|----------|
| 1 | Login as test account | JWT received, no errors |
| 2 | App calls `/provision` on login (PR #135) | Network shows `already_existed: true` |
| 3 | SimTrade tab loads | $50k visible immediately (prefetched cache) |
| 4 | Place market buy: 1 AAPL with `qty: 1` (NUMBER) | Order accepted, verifies PR #274 |
| 5 | Check positions | AAPL position appears |
| 6 | Place limit buy with `limit_price: 250.50` (NUMBER) | Order accepted |
| 7 | Check portfolio | Equity unchanged, cash decreased |
| 8 | Check orders list | Both orders, status filled |
| 9 | Cancel a pending order | 204, order disappears |
| 10 | Check insights tab | AI cards present |
| 11 | Check news tab | News for held tickers (or empty state) |
| 12 | Create a competition | Returns invite_code, navigates to competition detail |
| 13 | Join the competition | Joined state visible |
| 14 | Check competition leaderboard | Self appears |
| 15 | Logout, login as different account | Onboarding sheet shows for User B (verifies userId-scoped key) |

## Evidence Capture

For EVERY step, capture as evidence in `.agent-status/retest-evidence/`:

```
.agent-status/retest-evidence/
├── 01-login.png
├── 01-login-network.json
├── 02-provision-network.json
├── 03-simtrade-tab.png
├── 04-market-buy-aapl.png
├── 04-market-buy-aapl-network.json
├── 05-positions.png
├── ...
├── summary.md     ← final pass/fail report with screenshot references
```

**Required per step:**
1. **Screenshot** of the screen state after the action
2. **Network log** of relevant API calls (request body + response body) — especially for POST /orders to prove numeric qty works
3. **Console errors** if any

## Tooling

- Use `mcp__playwright__browser_navigate` to load `http://localhost:8083`
- Use `mcp__playwright__browser_snapshot` for accessibility tree
- Use `mcp__playwright__browser_take_screenshot` for visual evidence
- Use `mcp__playwright__browser_network_requests` for network logs
- Use `mcp__playwright__browser_console_messages` to catch errors

## Pass Criteria

- All 15 steps pass
- No regressions from earlier integration test
- Mobile UI shows real data (no mocks)
- POST /orders accepts qty as a number (PR #274 verified)
- Onboarding key is scoped per user (108's fix verified)

## Final Output

After running, write `.agent-status/retest-evidence/summary.md` with:
- Pass/fail per step
- Screenshot references
- Any bugs found
- Confirmation that PR #274 fix works
- Confirmation that PR #135 provision-on-login works

Then ping coordinator.
