# Test that sign-in and saved data survive a reload

> The page looked right until someone pressed refresh. One plain-language test signs in, reloads, saves a note, reloads again and checks what is left.

By Jason Nguyen, Founder, Testsy. Published 2026-11-20. https://testsy.dev/blog/test-that-sign-in-survives-a-reload/

## State that lives in the wrong place

A single-page app can show you anything without having saved it. You sign in and the header shows your name. You type a note, press Save, and it appears in the list. Everything is on the screen, so the test passes.

Then the user presses refresh. The header says "Sign in". The note is gone.

The screen was showing what the page remembered, not what was stored. A test that never reloads cannot tell the difference, and scripted tests rarely reload, for a reason that has nothing to do with users: signing in through the form on every test is slow, so suites inject a saved session and skip the form. The sign-in form, the wrong-password message and the session that should outlive a reload are then the least tested screens in the product.

## The test

Written as plain text and run in Chrome on a desktop-sized screen:

```text
Open Sign in. Sign in with demo@example.test and the wrong password
nope and verify the error reads Error: Wrong email or password.
Then sign in with demo@example.test / demo123. Reload the page and
verify it still shows Signed in as demo@example.test.
Go back to Home, open Storage, type Buy milk into Note and save it.
Reload the page and verify Saved note: Buy milk.
```

The site is Web Lab, our practice site. The password in this test is the practice site's public demo password, printed on its sign-in page. On your own site, never write a password into a test: store the account once and name it. More on that below.

## What happened

The picture at the top of this page shows three screens from the run: the wrong-password error, the page still signed in after the reload, and the saved note after its reload.

1. With the wrong password the page said "Error: Wrong email or password", and stayed signed out.
2. With the right one it said "Signed in as demo@example.test".
3. The tester reloaded the page. It still said "Signed in as demo@example.test".
4. On the Storage page it typed "Buy milk", saved, and reloaded. The page said "Saved note: Buy milk".

![The result: all 11 checks passed in 1 minute 31 seconds.](https://testsy.dev/blog/img/web-session-result.webp)

The checks are written as before-and-after pairs. The signed-in line is recorded once as a baseline, the reload is its own check, and the line after the reload is compared with the baseline.

![The checks. Each reload is a step of its own, with the value before and after.](https://testsy.dev/blog/img/web-session-checks.webp)

[Recording: The review video of the run, 40 seconds.](https://testsy.dev/blog/video/web-session.mp4)

Open [the run](https://app.testsy.dev/share/TdEMIxQQQlDqbCJ1MIQ0xXt9_X7S2KAl) to step through it. The link is read-only and stays live until 18 February 2027.

## Passwords and stored accounts

For your own site, add a sign-in account to the project once: a name, the username and the password. The test then says:

```text
Sign in with the stored account "customer".
```

The password is typed by the tester at the sign-in form and never appears in the test text, the plan or the result. [Sign-in accounts](https://testsy.dev/docs/sign-in-accounts/) has the details.

## Write it for your app

Add "reload the page" after every step that is supposed to save something:

```text
Sign in with the stored account "customer".
Open Settings, change the display name to "Sam Rivera" and save.
Reload the page and check the display name is still "Sam Rivera".
Sign out, sign in again, and check it once more.
```

Other things a reload finds:

- **A cart that empties.** Add two items, reload, count them.
- **A filter that resets.** Filter a list, reload, and check whether the filter is still applied and whether that is what you intended.
- **A session that is too short.** Sign in, wait, reload. Check the user is not thrown out mid-task.
- **Sign out that does not.** Sign out, press the browser's back button, and check the private page is not shown.

## Run it

Paste your site's address into **New test**, describe the journey with its reloads, and run it. [Write a test](https://testsy.dev/docs/write-a-test/) covers wording steps and checks.

This post is one of a series: [The hardest parts of web testing, each one run for real](https://testsy.dev/blog/the-hardest-parts-of-web-testing/).
