Skip to content

test: Platform Super-Admin Console — tenants, platform billing/plans, referrals #310

Description

@guillermoscript

Part of the Full App QA Pass (#281). Covers the platform operator tier — the super-admin surface that sits above school admins and is not touched by any existing sub-issue (those all test the per-tenant school admin).

Scope

The /platform/* console and /dashboard/admin/tenants, gated by isSuperAdmin() (queries the super_admins table directly — does NOT trust JWT).

Persona

Who Email Note
Super Admin owner@e2etest.com seeded in super_admins (also Default School admin)
Normal admin creator@codeacademy.com NOT a super admin — used for negative guard test

Routes Under Test

Route Description
/platform Platform operator landing/overview
/platform/tenants · /platform/tenants/[tenantId] All tenants across the platform; drill-in
/platform/billing Platform-wide billing/MRR
/platform/plans Platform plan catalog (free/starter/pro/business/enterprise)
/platform/referrals Referral codes + redemptions
/dashboard/admin/tenants Super-admin tenant switcher (in the school admin shell)

Test Cases

Access Control (P0)

  • owner@e2etest.com (super admin) can load every /platform/* route
  • creator@codeacademy.com (non-super) → /platform/* and /dashboard/admin/tenants redirect away (no leak)
  • Unauthenticated → /auth/login
  • Guard uses super_admins table, not JWT claims (can't be spoofed)

Tenants Console

  • /platform/tenants lists all tenants (currently 2: Default School, Code Academy Pro) with plan, status, counts
  • /platform/tenants/[tenantId] shows tenant detail (users, courses, billing)
  • No cross-tenant data corruption when drilling between tenants

Platform Billing & Plans

  • /platform/billing shows platform-wide revenue/MRR; figures reconcile with platform_subscriptions (1 active)
  • /platform/plans lists all 5 plans with correct prices ($0/$9/$29/$79/$199) and limits

Referrals

  • /platform/referrals loads without error
  • ⚠️ Known risk: the page queries referral_codes / referral_redemptions, which do not exist in the DB — verify the page degrades gracefully (empty state) rather than crashing, or fix the missing tables/feature

Tenant Switcher

  • /dashboard/admin/tenants lets a super admin switch active tenant; after switch supabase.auth.refreshSession() updates JWT claims (per CLAUDE.md)

Definition of Done

  • All /platform/* routes load for super admins, redirect for everyone else
  • Tenant list/detail figures reconcile with DB
  • Referrals page does not crash on the missing tables
  • No cross-tenant leakage in the operator console

Found during the post-#281 gap analysis: this whole privilege tier had zero QA coverage.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions