28 lines
1.7 KiB
Markdown
28 lines
1.7 KiB
Markdown
|
|
# E2E: Portal → Phoenix API → Railing
|
||
|
|
|
||
|
|
**Purpose:** How to run and extend E2E tests for the flow: Portal (browser) → Sankofa Phoenix API → Phoenix Deploy API (railing).
|
||
|
|
|
||
|
|
## Flow
|
||
|
|
|
||
|
|
1. User signs in to Portal (NextAuth / Keycloak).
|
||
|
|
2. Portal calls Sankofa API with `Authorization: Bearer <accessToken>` (or session cookie).
|
||
|
|
3. Sankofa API proxies `/api/v1/infra/*`, `/api/v1/ve/*`, `/api/v1/health/*` to `PHOENIX_RAILING_URL` when set.
|
||
|
|
4. Tenant-scoped routes (`/api/v1/tenants/me/resources`, `/api/v1/tenants/me/health`) use JWT or X-API-Key tenant context.
|
||
|
|
|
||
|
|
## Manual E2E
|
||
|
|
|
||
|
|
1. Start Phoenix Deploy API: `cd phoenix-deploy-api && npm start` (optional: set PROXMOX_* for live data).
|
||
|
|
2. Start Sankofa API: set `PHOENIX_RAILING_URL=http://localhost:4001`, then `npm run dev`.
|
||
|
|
3. Start Portal: set `NEXT_PUBLIC_GRAPHQL_ENDPOINT=http://localhost:4000/graphql` (or API URL), then `npm run dev`.
|
||
|
|
4. Sign in, open Infrastructure page (`/infrastructure`), verify nodes/storage load; open Dashboard and verify Phoenix Health tile; open VMs and verify list (if Crossplane or railing VMs are used).
|
||
|
|
|
||
|
|
## Automated E2E (optional)
|
||
|
|
|
||
|
|
- **Playwright/Cypress:** Add tests that sign in, navigate to `/infrastructure`, `/vms`, dashboard, and assert presence of data or “Loading”/error states.
|
||
|
|
- **API-only:** Use Sankofa API integration tests: start server with test config, `fetch('/api/v1/health/summary', { headers: { Authorization: 'Bearer <test-jwt>' } })` and assert 200 and body shape. See `api/src/__tests__/integration/phoenix-railing.test.ts` for tenant-me routes.
|
||
|
|
|
||
|
|
## References
|
||
|
|
|
||
|
|
- [PORTAL_RAILING_WIRING.md](../../Sankofa/docs/phoenix/PORTAL_RAILING_WIRING.md) (in Sankofa repo)
|
||
|
|
- [PHOENIX_API_RAILING_SPEC.md](PHOENIX_API_RAILING_SPEC.md)
|