Files
explorer-monorepo/docs/EXPLORER_FRONTEND_TESTING.md

50 lines
1.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Explorer Frontend Testing
> Historical note: this testing note captures legacy static-SPA routing
> behavior during the explorer transition. The canonical live frontend is now
> the Next standalone app deployed with
> `./scripts/deploy-next-frontend-to-vmid5000.sh`.
## Summary
Path-based URLs (e.g. `/address/0x99b3511a2d315a497c8112c1fdd8d508d4b1e506`) now work on the explorer. The fix includes:
1. **SPA path-based routing** historically, `applyHashRoute()` in `frontend/public/index.html` read both `pathname` and `hash`, so `/address/0x...`, `/tx/0x...`, `/block/123`, etc. loaded 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.