# Test password reset from the email to the new password

> A reset email that links to the wrong host, or a link that fails in a new browser, locks users out. One test requests the reset, follows the link and signs in again.

By Jason Nguyen, Founder, Testsy. Published 2026-11-21. https://testsy.dev/blog/test-password-reset-from-the-email-to-the-new-password/

## The flow nobody runs until they need it

You test sign-up because you go through it yourself. Password reset you go through once, when you build it, and then never again. It is also the flow a locked-out customer is in when they are already annoyed.

The failures are specific and well documented:

- **The wrong host.** Reset links that [still carry localhost, an old preview domain or the wrong callback path](https://www.indiehackers.com/post/supabase-auth-kept-sending-reset-links-to-the-wrong-host-the-diff-i-check-first-00f6ca22c1), because the reset email uses a different setting from the sign-up email.
- **A different browser.** With Supabase's default flow, a link opened in a different browser from the one that asked for it can fail, because the verifier is [stored in the browser that started the flow](https://makerkit.dev/docs/next-supabase-turbo/going-to-production/authentication). People request a reset on a laptop and open the email on a phone.
- **The old password still works**, or the new one does not, because the reset page saved nothing.

## The test

Each Testsy run can have [its own mailbox](https://testsy.dev/docs/mailbox-phone-endpoints/). Create the account in the same test, so the run owns the address it resets:

```text
On https://app.example.com, sign up with this run's email address
and the password FirstPass-2026, and confirm the account from the email.
Sign out.
On the sign-in page choose "Forgot password" and enter this run's
email address.
Wait for the reset email and open the link in it.
Check the page it opens is on app.example.com.
Set the new password SecondPass-2026 and save.
Sign out, then sign in with SecondPass-2026 and check the dashboard opens.
Sign out, try FirstPass-2026 and check it is refused.
```

The passwords here are throwaway values for a throwaway account the test creates, so writing them in the test is fine. Never put a real account's password in test text; use a [sign-in account](https://testsy.dev/docs/sign-in-accounts/) for that.

## Two emails in one run

This test reads two emails: the confirmation and the reset. The run's mailbox keeps both, in order, and the tester knows which one is which. We showed the same thing on our practice site with two codes: the first email's code was refused after a second one was requested.

![From that run: the first email's code refused after a new one was sent, then the second code accepted.](https://testsy.dev/blog/img/web-email-resend-screens.webp)

All 9 checks passed in 57 seconds. Open [the run](https://app.testsy.dev/share/gaJ-Ha3KndJe_QL_dD11MlqI4-i2pxrE) (live until 18 February 2027).

## Add the cases that hurt

- **The link used twice.** Open the reset link again after using it, and check it says the link has expired.
- **The old email.** Request a reset twice and check that only the newest link works.
- **An unknown address.** Request a reset for an address that has no account, and check the page does not say whether the account exists.

Run the test on a [schedule](https://testsy.dev/docs/schedules/) as well as after deploys: the reset email depends on your email provider and auth settings, which change without a code change.

This post is part of [Testing an app you built with AI](https://testsy.dev/blog/test-an-app-you-built-with-ai/).
