mirror of
https://github.com/supabase/supabase.git
synced 2026-10-12 12:55:06 +03:00
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>
29 lines
854 B
TypeScript
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)
|
|
},
|
|
})
|