e2e nextjs

Anyone got some working example how to login with login/pass to better auth in nextjs? Using playwright. Tried setting cookie manually but it apparently is not enough, auth.api.getSession still returns null thanks in advance
3 Replies
Azzani
Azzani4mo ago
I also have the same question.
MateuszDev
MateuszDevOP4mo ago
i dont know if its good solution but ended up with this: 1. seed db with test user login/pass only for e2e 2. create a nextjs route test-login which is only available in dev/test, it will do await auth.api.signInEmail({ login,pass }) on better-auth 3. in actual test i call this route before other operations i dont think it's perfect, but kinda works for now
MateuszDev
MateuszDevOP4mo ago
No description

Did you find this page helpful?