Bypass Supabase Auth for Playwright E2E Testing Without Login
· 4 min read
Encountered this issue while building an AI Agent SaaS platform for a client. Here's the root cause and solution.
TL;DR
E2E tests shouldn't depend on real OAuth login flows. By detecting localStorage test markers in the useAuth hook, you can inject mock auth state directly and skip Supabase initialization. Also change the Zustand store's loading default to false to prevent AuthGuard from showing an infinite spinner.