I am starting to do e2e tests with playwright. Most of the application requires to be authenticated. Automating this with a username/password mechanism is quite easy. The problem is that the app I want to test has only two authentication mechanisms: Github OAuth and email authentication links. Specifically I am using next-auth in a NextJS project.
I don't know how should I e2e test this with Playwright, the options I have considered are:
The first option is much easier to implement but then it's not e2e testing anymore. The second option looks difficult to implement and I don't know if it is recommended. I don't know if there are smarter or more standarized ways to proceed with this.
The keynote here is that you don't need to write e2e test to test the authentication flow because you're using next-auth ( which I think is a well-tested library). So I think you should go for the first option .
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With