How to fix Playwright APIRequestContext cookie mismatch between API and UI tests?

Playwright

API requests and browser pages may run in separate contexts, so auth cookies do not automatically sync.

Share auth via storageState or perform login in the same browser context used by UI steps.

const requestContext = await request.newContext({ storageState: 'playwright/.auth/user.json' });

Common mistake: assuming request fixture state always matches page state.