Case Study: User Reset Password via Email in Selenium WebDriver
Checking emails in automated tests is quite common. Typical cases are user-sign-up (confirm email address) and user-reset password (get password reset link). In a previous article, I went through how to use MailCatcher or a temporary online mail service to complete the user sign up test case. This article will cover the user-reset password test case by clicking the reset link in the reset email.
The sample site I will use is WhenWise (https://whenwise.agileway.net/).
Table of Contents:
· With MailCatcher
∘ Complete test script
· Zhimin’s notes
Using a newly registered user for this test case. If using an existing user, changing its password might affect other testing activities.
If do use an existing user, learn more on how to clean up after reset password tests in this article.
- Register a new user by email
a random email address.
- Enter your email on the ‘Reset Password’ page then click the “Reset” button
- Wait for the reset password email and visit the reset link in it
- Enter the new password
- Login with email and new password successfully
There are two “gotchas” for this test case:
- Register a brand new user just for this test case only
Essentially, include the ‘User Sign up’ test steps first. Because other team members are not aware of this new user, we don’t need to worry about the effect of password change.
- Receiving and reading emails
This is covered in the previous article, but we can use a fake SMTP server or a temporary online mail service to receive emails.