user3303019
user3303019

Reputation: 134

Automating a Password Reset flow with Testcafe

My goal is to somehow send the email and click the link to reset the password, access that link and write a new password. Don't really know if this is possible or could only be mocked.

I would also like to catch the content of the email and check it. Is there a way within TestCafe to do this?

Upvotes: 0

Views: 247

Answers (1)

wentwrong
wentwrong

Reputation: 711

You can use TestCafe to fill out and submit the password recovery form that will initiate a request to your backend. After that, you can use either of the following solutions:

  1. Intercept this request to the backend using TestCafe features for Intercepting HTTP Requests. Then, make sure that the "an email with a retrieval link was sent" message was shown, navigate to the known in advance retrieval link and log in with a new password.
  2. Make this request to the backend actually initiate sending an email. Then, in your test, connect to an email service (using some of the Node.js email clients), receive the email, and navigate TestCafe to the link.

The first approach seems to be more robust because it doesn't rely on any third-party services.

Upvotes: 3

Related Questions