Skip to content

Commit dbec813

Browse files
nikosdouvliswobsoriano
authored andcommitted
fix(e2e): gate token assertion behind sessionMinter feature flag
Why: The resiliency e2e test asserts that `token=` is present in the /tokens POST body, but this param is only sent when sessionMinter is enabled in the instance's auth config. CI instances without the flag fail deterministically. What changed: Read sessionMinter from the Clerk environment at runtime and make the assertion bi-directional: assert token is present when enabled, absent when disabled. Uses URLSearchParams for proper form-body parsing.
1 parent 9454c4d commit dbec813

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

integration/tests/resiliency.test.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -548,12 +548,15 @@ testAgainstRunningApps({ withEnv: [appConfigs.envs.withEmailCodes] })('resilienc
548548
// Token refresh should succeed (backend ignores the param for now)
549549
expect(token).toBeTruthy();
550550

551-
// Verify token param is present in the POST body (form-urlencoded)
551+
// Verify token param is present in the POST body when sessionMinter is enabled.
552552
// fapiClient serializes body as form-urlencoded via qs.stringify(camelToSnake(body))
553553
// so "token" stays "token" (no case change) and the body looks like "organization_id=&token=<jwt>"
554+
const sessionMinterEnabled = await page.evaluate(() => {
555+
return !!(window as any).Clerk?.__internal_environment?.authConfig?.sessionMinter;
556+
});
554557
expect(tokenRequestBodies.length).toBeGreaterThanOrEqual(1);
555-
const lastBody = tokenRequestBodies[tokenRequestBodies.length - 1];
556-
expect(lastBody).toContain('token=');
558+
const lastBody = new URLSearchParams(tokenRequestBodies[tokenRequestBodies.length - 1]);
559+
expect(lastBody.has('token')).toBe(sessionMinterEnabled);
557560

558561
// User should still be signed in after refresh
559562
await u.po.expect.toBeSignedIn();

0 commit comments

Comments
 (0)