Skip to main content

Source: ocean/docs/test-environment.md | ✏️ Edit on GitHub

Test Environment Setup

Overview

Ocean is a cloud-first application. We do NOT use local environments or local Supabase instances. All development and testing is done against remote cloud services.

Environment Variables

Where NOT to Store Credentials

  • .env.local - This file is NOT used. It contains deprecated credentials.
  • Hardcoded in test files - Never hardcode any credentials
  • Git repository - Never commit credentials

Where to Store Credentials

  1. GitHub Secrets - For CI/CD pipeline
  2. Supabase Secrets - For Edge Functions
  3. Vercel Environment Variables - For deployment
  4. .env.test - For local test runs only (never commit)

Setting Up Tests Locally

  1. Copy the example file:
cp .env.test.example .env.test
  1. Get the modern Supabase credentials from the dashboard:

    • Publishable Key: Starts with pk_ (safe for client-side)
    • Service Role Key: Modern JWT token (NOT the deprecated sb_secret_)
  2. Get Stripe test credentials:

    • Use test mode keys (sk_test_...)
    • Get webhook secret from Stripe dashboard
  3. Run tests:

./scripts/test-suite/run-all-tests.sh

Important Notes

  • We use Supabase's modern JWT security system
  • Legacy API keys (starting with sb_secret_) are deprecated and will not work
  • All tests run against the remote Supabase instance
  • Never use production credentials for testing

CI/CD Testing

Tests run automatically in GitHub Actions using secrets stored in the repository settings. No local setup required for CI/CD.

Troubleshooting

"Legacy API keys are disabled" Error

You're using an old Supabase key. Get the modern JWT keys from the Supabase dashboard.

"No .env.test file found" Warning

Create .env.test from .env.test.example with proper credentials.

Tests Can't Connect

Ensure you're using the correct modern Supabase keys and the remote URL.