# Explorer Frontend Testing

## Summary

Path-based URLs (e.g. `/address/0x99b3511a2d315a497c8112c1fdd8d508d4b1e506`) now work on the explorer. The fix includes:

1. **SPA path-based routing** – `applyHashRoute()` in `frontend/public/index.html` reads both `pathname` and `hash`, so `/address/0x...`, `/tx/0x...`, `/block/123`, etc. load correctly.
2. **Nginx SPA paths** – Nginx serves `index.html` for `/address`, `/tx`, `/block`, `/token`, `/blocks`, `/transactions`, `/bridge`, `/weth`, `/watchlist`, and `/nft`.
3. **HTTP + HTTPS** – Both HTTP (for internal tests) and HTTPS serve the SPA for these paths.

## Test Commands

### Shell E2E (curl-based)

```bash
./explorer-monorepo/scripts/e2e-test-explorer.sh
```

Requires network access to `192.168.11.140` (VMID 5000).

### Playwright E2E

```bash
cd explorer-monorepo
EXPLORER_URL="http://192.168.11.140" npx playwright test e2e-explorer-frontend.spec.ts --project=chromium
```

## Links Verified

| Link | Example |
|------|---------|
| Address | `/address/0x99b3511a2d315a497c8112c1fdd8d508d4b1e506` |
| Tx | `/tx/<hash>` |
| Block | `/block/<number>` |
| Blocks | `/blocks` |
| Transactions | `/transactions` |
| Bridge | `/bridge` |
| WETH | `/weth` |
| Watchlist | `/watchlist` |
| MetaMask Snap | `/snap/` |

## Proxy 301 Note

If `https://explorer.d-bis.org/address/0x...` returns 301, the proxy (NPMplus/Cloudflare) may need configuration. The VM nginx serves the SPA correctly. Workaround: use `#/address/0x...` or access via LAN.
