test(supabase): sandbox suites refuse every target but the sandbox

The sandbox suites (stack.ts and its importers, the shell Playwright
config) stop before their first request unless the container, the
four loopback URLs and the key issuer are exactly the db:sandbox
ones; the LAN config accepts the 5193 trial app only. Drift and
wiring tests tie the constants to scripts/db-sandbox.sh.
This commit is contained in:
bchanot committed 2026-11-10 13:36:08 +01:00
1 parent b215b89cf9
commit b682f78209
5 files changed
+207 -1

No files matched your search

+6
View File
@@ -9,6 +9,12 @@ import { defineConfig } from '@playwright/test'
import type { GuardOptions } from './support/browser'
const ORIGIN = process.env.TRIAL_ORIGIN ?? 'http://192.168.1.100:5193'
// Port check only: 5193 is the app of pnpm db:sandbox trial; the db:trial app (5194) is never
// a test target.
if (new URL(ORIGIN).port !== '5193')
throw new Error(
'Refused: TRIAL_ORIGIN must be the app of pnpm db:sandbox trial (port 5193)',
)
export default defineConfig<GuardOptions>({
testDir: './lan',
+3
View File
@@ -7,11 +7,14 @@
* session tokens and the typed passwords.
*/
import { defineConfig } from '@playwright/test'
import { assertSandboxTarget } from '../../../packages/supabase/tests/sandbox/target'
import type { GuardOptions } from './support/browser'
import { PROJECTS } from './support/browser'
const ORIGIN = 'http://127.0.0.1:5192'
const FAKE_SUPABASE_ORIGIN = 'http://sandbox.faunosteo.invalid'
// The sandbox's exact values or nothing starts (the db:trial stack, DEV, look-alikes are refused).
assertSandboxTarget(process.env)
const anonKey = process.env.SANDBOX_ANON_KEY
if (!anonKey)
throw new Error(