Skip to content

Commit e0fd01e

Browse files
eunjae-leedevin-ai-integration[bot]keithwillcode
authored
feat: add lightweight E2E session warmup page (calcom#26451)
* feat: add lightweight E2E session warmup endpoint - Add /api/__e2e__/session-warmup endpoint that triggers NextAuth session loading - Update apiLogin fixture to use the new endpoint instead of navigating to /settings/my-account/profile - The endpoint is gated by NEXT_PUBLIC_IS_E2E=1 (already set in playwright.config.ts) - This reduces overhead in E2E tests by avoiding loading a full UI page just to warm up the session Co-Authored-By: eunjae@cal.com <hey@eunjae.dev> * refactor: move session warmup endpoint to App Router - Move /api/__e2e__/session-warmup from pages/api to app/api - Use App Router patterns (NextResponse, buildLegacyRequest) - Maintains same functionality for E2E session warming Co-Authored-By: eunjae@cal.com <hey@eunjae.dev> * rename path * refactor: switch from API route to minimal SSR page (Option 2) - Replace /api/e2e/session-warmup API route with /e2e/session-warmup page - Use App Router page pattern with getServerSession for session warmup - Update apiLogin fixture to navigate to the page instead of API request Co-Authored-By: eunjae@cal.com <hey@eunjae.dev> * revert users fixture but with a new url * render nothing on success * clean up * trying something * Revert "trying something" This reverts commit 2ae2f7d. --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Keith Williams <keithwillcode@gmail.com>
1 parent 23848e7 commit e0fd01e

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import process from "node:process";
2+
3+
import { notFound } from "next/navigation";
4+
5+
/**
6+
* E2E-only page for warming up the NextAuth session.
7+
* This triggers the jwt and session callbacks that populate the session
8+
* with profile, org, and other important data.
9+
*
10+
* Only available when NEXT_PUBLIC_IS_E2E=1 is set (automatically set by playwright.config.ts)
11+
* or in development mode.
12+
*/
13+
const Page = (): JSX.Element => {
14+
// Gate this page to E2E test mode or dev only
15+
if (
16+
process.env.NEXT_PUBLIC_IS_E2E !== "1" &&
17+
process.env.NODE_ENV !== "development"
18+
) {
19+
notFound();
20+
}
21+
22+
return <div></div>;
23+
};
24+
25+
export default Page;

apps/web/playwright/fixtures/users.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,10 +1172,8 @@ export async function apiLogin(
11721172
* Critical: Navigate to a protected page to trigger NextAuth session loading
11731173
* This forces NextAuth to run the jwt and session callbacks that populate
11741174
* the session with profile, org, and other important data
1175-
* We picked /settings/my-account/profile due to it being one of
1176-
* our lighest protected pages and doesnt do anything other than load the user profile
11771175
*/
1178-
await page.goto(navigateToUrl || "/settings/my-account/profile");
1176+
await page.goto(navigateToUrl || "/e2e/session-warmup");
11791177

11801178
// Wait for the session API call to complete to ensure session is fully established
11811179
// Only wait if we're on a protected page that would trigger the session API call

0 commit comments

Comments
 (0)