Files
supabase/e2e/shared/test.ts
Miranda LimonczenkoandCursor a9b7cc9789 test(e2e): keep the Vercel bypass secret on Supabase origins
extraHTTPHeaders sent it with every request. Playwright also collects every
--project, so an explicit flag now replaces the suite default instead of
stacking on it.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-18 09:46:46 -07:00

29 lines
854 B
TypeScript

import { test as base } from '@playwright/test'
import { isSupabaseHost } from './hosts.ts'
export { expect } from '@playwright/test'
// extraHTTPHeaders would send the secret on every request, including third-party ones.
export const test = base.extend({
context: async ({ context, baseURL }, use) => {
const secret = process.env.VERCEL_AUTOMATION_BYPASS_SECRET
if (secret && baseURL && isSupabaseHost(baseURL)) {
const origin = new URL(baseURL).origin
await context.route(
(url) => url.origin === origin,
async (route) => {
await route.continue({
headers: {
...route.request().headers(),
'x-vercel-protection-bypass': secret,
'x-vercel-set-bypass-cookie': 'true',
},
})
}
)
}
await use(context)
},
})