Verify email in playwright end-to-end tests
Hello, I have started playing with the playwright tests. I am seeing a problem during the signup process as it is not verifying the email. What is the recommended way to handle/skip the email verification for the end-to-end tests? Thanks in advance!
4 Replies
Hi @Ramon. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
To handle email verification in Playwright end-to-end tests for Wasp applications, you can use the
SKIP_EMAIL_VERIFICATION_IN_DEV
environment variable. This allows you to bypass the email verification step during development and testing.
Here's how you can implement this:
1. Set the SKIP_EMAIL_VERIFICATION_IN_DEV
environment variable to true
in your .env.server
file:
This setting will skip the email verification process in development mode, which is useful for both local development and running automated tests.
Email Verification Flow documentation states:
"In development mode, you can skip the email verification step by setting the SKIP_EMAIL_VERIFICATION_IN_DEV
environment variable to true
in your .env.server
file. This is useful when you are developing your app and don't want to go through the email verification flow every time you sign up. It can be also useful when you are writing automated tests for your app."
By using this approach, you can ensure that your Playwright tests can proceed through the signup process without getting stuck on email verification.
Remember to only use this setting for development and testing purposes. In production, you should always require email verification for security reasons.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @Ramon, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?Great one! I will try that. I think it would be helpful to be stated in the e2e-tests README!
@Vinny (@Wasp) one TODO for you
Good point! I’ll add that
actually. it already is in the
e2e-tests/README.md
file:
NOTE: When using the email auth method a verification link is sent when the user registers, or logged to the console if you're using the default Dummy provider. You must click this link to complete registration. Setting SKIP_EMAIL_VERIFICATION_IN_DEV to "true" skips this verification step, allowing you to automatically log in. This step must be skipped when running tests, otherwise the tests will hang and fail as the verification link is never clicked!