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.
56 lines
2.0 KiB
TypeScript
56 lines
2.0 KiB
TypeScript
/**
|
|
* `pnpm e2e:shell` (scripts/db-sandbox.sh e2e-shell): the authenticated /app
|
|
* shell in Chromium against the isolated stack of `pnpm db:sandbox`, never DEV.
|
|
* The dev server is built with a Supabase URL that resolves nowhere and runs
|
|
* on a loopback port of its own; e2e/support/sandbox.ts replays its calls on
|
|
* the sandbox. No trace and no HTML report are kept: they would hold the
|
|
* 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(
|
|
'SANDBOX_ANON_KEY missing: run pnpm e2e:shell (the sandbox must be up)',
|
|
)
|
|
|
|
export default defineConfig<GuardOptions>({
|
|
testDir: './shell',
|
|
globalSetup: './support/warm-up.ts',
|
|
outputDir: './test-results/shell',
|
|
fullyParallel: true,
|
|
forbidOnly: true,
|
|
retries: 0,
|
|
// Eight workers share one sandbox stack: a read can take longer than the default 5 s.
|
|
expect: { timeout: 10_000 },
|
|
// No HTML report: its step titles would keep what the test typed, the
|
|
// fictitious accounts' passwords included. The terminal and the failure
|
|
// screenshots stay.
|
|
reporter: [['list']],
|
|
use: {
|
|
baseURL: ORIGIN,
|
|
allowedOrigins: [ORIGIN, FAKE_SUPABASE_ORIGIN],
|
|
trace: 'off',
|
|
screenshot: 'only-on-failure',
|
|
},
|
|
projects: PROJECTS,
|
|
webServer: {
|
|
command: 'node_modules/.bin/vite --host 127.0.0.1 --port 5192 --strictPort',
|
|
cwd: '..',
|
|
url: `${ORIGIN}/`,
|
|
reuseExistingServer: false,
|
|
timeout: 120_000,
|
|
env: {
|
|
VITE_SUPABASE_URL: FAKE_SUPABASE_ORIGIN,
|
|
VITE_SUPABASE_ANON_KEY: anonKey,
|
|
},
|
|
},
|
|
})
|