Skip to content

Commit 7288d21

Browse files
committed
ci(e2e): add vercel protection bypass for integration tests
Configure Playwright integration tests to bypass Vercel's deployment protection using the x-vercel-protection-bypass header. This enables automated tests to access protected Vercel deployments without manual intervention. Changes include: - Add extraHTTPHeaders to Playwright config with bypass secret - Whitelist VERCEL_AUTOMATION_BYPASS_SECRET in turbo.json for all integration test tasks - Pass bypass secret from GitHub secrets in CI workflow
1 parent b117ebc commit 7288d21

File tree

5 files changed

+68
-51
lines changed

5 files changed

+68
-51
lines changed

.github/workflows/ci.yml

Lines changed: 51 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -294,58 +294,59 @@ jobs:
294294
strategy:
295295
fail-fast: false
296296
matrix:
297-
test-name: [
298-
'generic',
299-
'express',
300-
'ap-flows',
301-
'elements',
302-
'localhost',
303-
'sessions',
304-
'sessions:staging',
305-
'handshake',
306-
'handshake:staging',
307-
'astro',
308-
'expo-web',
309-
'tanstack-react-start',
310-
'vue',
311-
'nuxt',
312-
'react-router',
313-
'custom',
297+
test-name:
298+
[
299+
"generic",
300+
"express",
301+
"ap-flows",
302+
"elements",
303+
"localhost",
304+
"sessions",
305+
"sessions:staging",
306+
"handshake",
307+
"handshake:staging",
308+
"astro",
309+
"expo-web",
310+
"tanstack-react-start",
311+
"vue",
312+
"nuxt",
313+
"react-router",
314+
"custom",
314315
]
315316
test-project: ["chrome"]
316317
include:
317-
- test-name: 'billing'
318-
test-project: 'chrome'
319-
clerk-use-rq: 'false'
320-
- test-name: 'billing'
321-
test-project: 'chrome'
322-
clerk-use-rq: 'true'
323-
- test-name: 'machine'
324-
test-project: 'chrome'
325-
clerk-use-rq: 'false'
326-
- test-name: 'machine'
327-
test-project: 'chrome'
328-
clerk-use-rq: 'true'
329-
- test-name: 'nextjs'
330-
test-project: 'chrome'
331-
next-version: '14'
332-
- test-name: 'nextjs'
333-
test-project: 'chrome'
334-
next-version: '15'
335-
clerk-use-rq: 'false'
336-
- test-name: 'nextjs'
337-
test-project: 'chrome'
338-
next-version: '15'
339-
clerk-use-rq: 'true'
340-
- test-name: 'nextjs'
341-
test-project: 'chrome'
342-
next-version: '16'
343-
- test-name: 'quickstart'
344-
test-project: 'chrome'
345-
next-version: '15'
346-
- test-name: 'quickstart'
347-
test-project: 'chrome'
348-
next-version: '16'
318+
- test-name: "billing"
319+
test-project: "chrome"
320+
clerk-use-rq: "false"
321+
- test-name: "billing"
322+
test-project: "chrome"
323+
clerk-use-rq: "true"
324+
- test-name: "machine"
325+
test-project: "chrome"
326+
clerk-use-rq: "false"
327+
- test-name: "machine"
328+
test-project: "chrome"
329+
clerk-use-rq: "true"
330+
- test-name: "nextjs"
331+
test-project: "chrome"
332+
next-version: "14"
333+
- test-name: "nextjs"
334+
test-project: "chrome"
335+
next-version: "15"
336+
clerk-use-rq: "false"
337+
- test-name: "nextjs"
338+
test-project: "chrome"
339+
next-version: "15"
340+
clerk-use-rq: "true"
341+
- test-name: "nextjs"
342+
test-project: "chrome"
343+
next-version: "16"
344+
- test-name: "quickstart"
345+
test-project: "chrome"
346+
next-version: "15"
347+
- test-name: "quickstart"
348+
test-project: "chrome"
349+
next-version: "16"
349350

350351
steps:
351352
- name: Checkout Repo
@@ -475,6 +476,7 @@ jobs:
475476
INTEGRATION_INSTANCE_KEYS: ${{ secrets.INTEGRATION_INSTANCE_KEYS }}
476477
MAILSAC_API_KEY: ${{ secrets.MAILSAC_API_KEY }}
477478
NODE_EXTRA_CA_CERTS: ${{ github.workspace }}/integration/certs/rootCA.pem
479+
VERCEL_AUTOMATION_BYPASS_SECRET: ${{ secrets.VERCEL_AUTOMATION_BYPASS_SECRET }}
478480

479481
- name: Upload test-results
480482
if: ${{ cancelled() || failure() }}

integration/tests/next-quickstart-keyless.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ const mockClaimedInstanceEnvironmentCall = async (page: Page) => {
2424

2525
test.describe('Keyless mode @quickstart', () => {
2626
test.describe.configure({ mode: 'serial' });
27+
28+
test.use({
29+
extraHTTPHeaders: {
30+
'x-vercel-protection-bypass': process.env.VERCEL_AUTOMATION_BYPASS_SECRET || '',
31+
},
32+
});
33+
2734
let app: Application;
2835
let dashboardUrl = 'https://dashboard.clerk.com/';
2936

integration/tests/react-router/library-mode.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { createTestUtils } from '../../testUtils';
77

88
test.describe('Library Mode basic tests for @react-router', () => {
99
test.describe.configure({ mode: 'parallel' });
10+
1011
let app: Application;
1112
let fakeUser: FakeUser;
1213
let fakeOrganization: FakeOrganization;

integration/tests/react-router/pre-middleware.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { createTestUtils } from '../../testUtils';
77

88
test.describe('basic tests for @react-router without middleware', () => {
99
test.describe.configure({ mode: 'parallel' });
10+
1011
let app: Application;
1112
let fakeUser: FakeUser;
1213

turbo.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,13 @@
3232
"VERCEL",
3333
"VITE_CLERK_*"
3434
],
35-
"globalPassThroughEnv": ["AWS_SECRET_KEY", "GITHUB_TOKEN", "ACTIONS_RUNNER_DEBUG", "ACTIONS_STEP_DEBUG"],
35+
"globalPassThroughEnv": [
36+
"AWS_SECRET_KEY",
37+
"GITHUB_TOKEN",
38+
"ACTIONS_RUNNER_DEBUG",
39+
"ACTIONS_STEP_DEBUG",
40+
"VERCEL_AUTOMATION_BYPASS_SECRET"
41+
],
3642
"tasks": {
3743
"build": {
3844
"dependsOn": ["^build"],
@@ -236,7 +242,7 @@
236242
},
237243
"//#test:integration:quickstart": {
238244
"dependsOn": ["@clerk/testing#build", "@clerk/clerk-js#build", "@clerk/backend#build", "@clerk/nextjs#build"],
239-
"env": ["CLEANUP", "DEBUG", "E2E_*", "INTEGRATION_INSTANCE_KEYS"],
245+
"env": ["CLEANUP", "DEBUG", "E2E_*", "INTEGRATION_INSTANCE_KEYS", "VERCEL_AUTOMATION_BYPASS_SECRET"],
240246
"inputs": ["integration/**"],
241247
"outputLogs": "new-only"
242248
},

0 commit comments

Comments
 (0)