> For the complete documentation index, see [llms.txt](https://docs.does.qa/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.does.qa/guides/test-a-forgotten-password-flow.md).

# Test a forgotten-password flow

A forgotten-password journey is a good early Flow. It covers form fill, email delivery, a reset link, and a new password, all without writing code.

```mermaid
flowchart TD
  open["Open reset page"] --> email["Set value with $testEmail"]
  email --> request["Touch submit"]
  request --> wait["Wait for email"]
  wait --> openMail["Open email"]
  openMail --> link["Touch reset link"]
  link --> password["Set value NEW_PASSWORD"]
  password --> save["Touch save"]
  save --> check["Check text or login"]
```

Use the **Flow Builder** for this walkthrough.

## What you need

* A website URL you can reach from the internet, with a working forgotten-password page
* An account in that application that can receive a reset email
* A [Value](/values/value-store.md) for the new password, such as `NEW_PASSWORD`

Prefer [`$testEmail`](/values/built-in-values.md) so the reset message lands in this Test Case inbox. See [Interacting with emails](/guides/interacting-with-emails.md) for inbox choices.

## Build the Flow

{% stepper %}
{% step %}

## Open the forgotten-password page

Start with [**Open**](/test-steps/starter/open.md). Point it at your forgotten-password URL on the browser you want to use.

<figure><img src="https://app.does.qa/screenshots/node/starter_open.png" alt="Open Test Step"><figcaption><p>Open</p></figcaption></figure>
{% endstep %}

{% step %}

## Enter the DoesQA address

Add [**Set value**](/test-steps/action/set-value.md) on the email field. Use [`$testEmail`](/values/built-in-values.md).

<figure><img src="https://app.does.qa/screenshots/node/action_input_setValue.png" alt="Set value Test Step"><figcaption><p>Set value</p></figcaption></figure>

That sends the application to the Test Case inbox for this Run.
{% endstep %}

{% step %}

## Request the reset

Add [**Touch**](/test-steps/action/touch.md) on the submit control that requests the reset email.

<figure><img src="https://app.does.qa/screenshots/node/action_touch_single.png" alt="Touch Test Step"><figcaption><p>Touch</p></figcaption></figure>

Add a short [**Check text**](/test-steps/check/check-text.md) afterward if the page shows confirmation text, so a silent failure is easy to spot.
{% endstep %}

{% step %}

## Wait for the reset email

Add [**Wait for email**](/test-steps/mail/wait-for-email.md) from the [**Mail**](/test-steps/mail.md) family.

<figure><img src="https://app.does.qa/screenshots/node/mail_wait_forMessage.png" alt="Wait for email Test Step"><figcaption><p>Wait for email</p></figcaption></figure>

1. Set **Inbox** to **Test Case**.
2. Prefer **Type** **Custom** with **Subject** or **From** wording your application sends.
3. Raise **End Offset** in advanced settings when the application usually takes longer than five minutes to send.
   {% endstep %}

{% step %}

## Open the email and follow the link

Add [**Open email**](/test-steps/mail/open-email.md) with the same **Test Case** inbox. Choose **Latest**, or **Custom** when you need a specific Subject or From.

<figure><img src="https://app.does.qa/screenshots/node/mail_message_open.png" alt="Open email Test Step"><figcaption><p>Open email</p></figcaption></figure>

The message body becomes the active page. Add [**Touch**](/test-steps/action/touch.md) on the reset link.

When the application opens in a new window or tab, add [**Switch window**](/test-steps/runner/switch-window.md) from the [**Runner**](/test-steps/runner.md) family so later steps land on the reset form. When you are finished with the message, add [**Close inbox**](/test-steps/mail/close-inbox.md).
{% endstep %}

{% step %}

## Set the new password

On the reset form, add [**Set value**](/test-steps/action/set-value.md) for the new password and confirmation fields. Use the same [Value](/values/value-store.md), such as `NEW_PASSWORD`, in both places.

Add [**Touch**](/test-steps/action/touch.md) on the control that saves the password.
{% endstep %}

{% step %}

## Confirm the outcome

Add Checks that match your product:

* Confirmation text on the success page with [**Check text**](/test-steps/check/check-text.md), or
* A login with the new password, using [**Set value**](/test-steps/action/set-value.md) and [**Touch**](/test-steps/action/touch.md) on the sign-in form

<figure><img src="https://app.does.qa/screenshots/node/check_text.png" alt="Check text Test Step"><figcaption><p>Check text</p></figcaption></figure>

If login is shared across Flows, turn that path into a [Step Group](/better-coverage/reuse-steps-with-step-groups.md) after this Flow works.
{% endstep %}
{% endstepper %}

{% hint style="info" %}
**Pro tip:** Keep the reset email filter tight with **Subject** or **From**. An open inbox that receives other messages is easier to debug when [**Wait for email**](/test-steps/mail/wait-for-email.md) matches one clear string.
{% endhint %}

## The finished Flow

![Open through Check text for a forgotten-password Flow](/files/rhA8EGMXom0frLFX6ueZ)

## Reuse what you built

| Piece             | Next step                                                                                                                                                                                                        |
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Mail steps        | Reuse the same pattern for invite emails. See [Interacting with emails](/guides/interacting-with-emails.md) and [Test registration and email verification](/guides/test-registration-and-email-verification.md). |
| Login after reset | Save it as a [Step Group](/better-coverage/reuse-steps-with-step-groups.md).                                                                                                                                     |
| New password      | Store it in the [Value Store](/values/value-store.md) so other Flows can sign in.                                                                                                                                |

## Related

* [Interacting with emails](/guides/interacting-with-emails.md)
* [Reuse steps with Step Groups](/better-coverage/reuse-steps-with-step-groups.md)
* [Wait For Email](/test-steps/mail/wait-for-email.md)
* [Open Email](/test-steps/mail/open-email.md)
* [Close Inbox](/test-steps/mail/close-inbox.md)
* [Set Value](/test-steps/action/set-value.md)
* [Touch](/test-steps/action/touch.md)
* [Check Text](/test-steps/check/check-text.md)
* [Switch Window](/test-steps/runner/switch-window.md)
* [Open](/test-steps/starter/open.md)
* [Value Store](/values/value-store.md)
* [Built-in Values](/values/built-in-values.md)
