0

I want to automate forgot password link. When click on forgot password link It goes to enter the emailenter image description here

enter image description here

A link would be send via email. When click on that link we can get the change psssword option. On that page asking for current password, change password, confirm password. at last we can change the password How to the forgot password link text ? how to verify this email is getting or not using selenium webdriver with java ?

2

If you want to test it end-2-end you can use a service like https://mailtrap.io/

Here you can use an API to retrieve the email and extract the link and open the link with Selenium.

Still I am wondering if you want to test this workflow end-2-end, maybe some integration tests would suffice.

  • Checking emails sending gets triggered, not actual testing the email content.
    • Email content could be checked by the class it-self with unit-test.
  • Setting up a state that you can verify with the same link everytime
    • Setup database state
    • Follow known link
    • Login with new password

Other reads:

0

You could try fetching the emails from the email server by establishing a connection to it.
You can use the JavaMail API for this. Here's a tutorial to fetch the emails from a GMail account https://www.tutorialspoint.com/javamail_api/javamail_api_checking_emails.htm

  • hai I couldn't understand. Can you explain please ? – user21268 Nov 7 '16 at 9:46
  • What you would need to do is connect to your mail server (Gmail/Outlook) using the JavaMail API and fetch the emails from the server after you've clicked on the forgot password link and typed in the correct email address. – sagarwadhwa1 Nov 7 '16 at 11:15
  • You can then fetch the emails for that email address and get the link for the forgotten password, and visit that address using selenium driver.get() method. – sagarwadhwa1 Nov 7 '16 at 11:16
0

Here are few scenarios you can implement.Depending on the implementation you can add more or remove some.

  1. Forgot password - check display (click on the forgot password link and check that you have title, email field, and submit button)

  2. Forgot password - valid email (click on the forgot password link, enter a valid email and check the email is received and contains a the link for reset password)

  3. Forgot password - valid email, change password, logout and login with changed password

  4. Forgot password - invalid email format (validate the email field for invalid email like test@com gives an error)

  5. Forgot password - valid email, use the reset password link and have a password for current password and a different password for confirm password

  6. Forgot password - valid email, use the reset password link twice and see that second time you are using it will give you an error

  7. Forgot password - valid email, use the reset password link and check display (that you have password/confirm password fields etc)

  8. Forgot password - submit email that is not registered and check the result (it may be an error, or a general success message - this depends if how security is implemented)

  9. Forgot password - valid email, use the reset password link and check validation on password/confirm password link (like weak/medium/strong password or minimum length - depending of what validations you have)

As email you can use a dispostable email server like Mailinator. Investigate what other options you would have since you might need the email for some other tests also.

Please note that some of the free email services have usually public inboxes, meaning anyone can see it, you can opt in for a payed plan with private inbox.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy