Login page testing: a set of checks that make sure an authorized user can sign in, and that a refused attempt is refused with a clear message, without leaking any information.
Testing a login page means checking that valid credentials open a session and that invalid ones are refused with a clear message. It also means making sure the page tells an attacker nothing and stays usable by everyone, from the keyboard as well as with a password manager. The login page is often the most visited page of an application, and the first step of almost every other journey: when it breaks, nothing else can be tested.
This article lists the test cases to cover with their expected results, then compares two ways to automate them. Every example can be replayed on a real page: the GoodDeal login page, Delta-QA's practice shop, with the demo account demo@gooddeal.test and the password Demo1234.
The essentials on one page (what a no-code tool really automates and how it compares): No-code test automation.
What should you test on a login page?
Five families of cases: behavior, error messages, security, accessibility and appearance. Many lists of test cases stop at the first one. Yet a login that "works" can still reveal to an attacker that an account exists, or lock out a user who relies on a password manager.
- Behavior: a valid account signs in, an invalid one is refused, the user returns to the page they asked for, and signing out really closes the session.
- Error messages: each empty or badly filled field has its own message, and a failed sign-in does not say which of the two fields was wrong.
- Security: a limited number of attempts, redirects limited to the site, a password never visible in the address.
- Accessibility: labels, keyboard navigation, errors announced to screen readers, pasting and autofill accepted.
- Appearance: an error message that turned white on white, or a button hidden behind a banner. For a script that checks the text, the page still works. For a user, it no longer does.
The first four families are tested with steps and an expected result. The last one requires looking at the page, or comparing it with a reference version.
The 10 essential test cases for a login page
These ten cases cover an email and password form. The expected results are those of the GoodDeal login page: you can check them yourself, in order.
| # | Test case | Steps | Expected result |
|---|---|---|---|
| 1 | Valid credentials | Enter demo@gooddeal.test and Demo1234, click "Sign in" |
Session opened, back to the home page, email shown in the header with a "Sign out" button |
| 2 | Wrong password | Valid email, password demo1234 |
Refused with a generic message |
| 3 | Unknown email | unknown@example.com and any password |
Exactly the same message as in case 2 |
| 4 | Empty fields | Click "Sign in" without entering anything | A message under each field and a "Please check 2 fields" summary at the top of the form |
| 5 | Malformed email | Enter demo@gooddeal |
"Enter an email address, like alex@example.com." |
| 6 | Uppercase and spaces | Enter Demo@GoodDeal.test with a leading space, and the right password |
Signed in: the email is normalized, the password stays case-sensitive |
| 7 | Enter key | Fill in both fields, press Enter | The form is submitted as with the button |
| 8 | Double click | Click "Sign in" twice in a row | A single request: the button stays disabled during the check |
| 9 | Return to the requested page | Add an item to the cart, go to checkout, follow "Sign in" | After signing in, back to checkout with the email already filled in |
| 10 | Sign out | Click "Sign out" | Session closed, back to the login page |
Each row reads as a complete test case: a precondition (being signed out), steps and an observable result. That is what lets another person run it and reach the same verdict. Cases 2 and 3 go together: their value lies in comparing the two messages.
Error messages: what they should say, and what they should keep quiet
A good error message tells the user what to fix without telling an attacker what they guessed. For a badly filled field, it names the field and the rule. For a failed sign-in, it stays generic, whether the email exists or not.
The OWASP Authentication Cheat Sheet puts it this way: the application should respond with a generic message, whether the user ID or the password is wrong, the account does not exist or it is locked. Its example of a correct response: "Login failed; Invalid user ID or password". A message such as "No account with this email" lets someone list the existing accounts before going after the passwords.
The test case that follows: compare the message for an unknown email with the one for a wrong password. They must be identical, character for character. On GoodDeal, both display "The email or the password is wrong. Check them, or create an account." The only different message, "Your account is not confirmed yet", appears only with the right password: it tells nothing to someone who does not know it.
For input errors, also check how they are shown:
- the message appears next to the field concerned and is linked to it (
aria-describedby); - the field is marked invalid (
aria-invalid); - a summary at the top of the form lists the errors, with a link to each field, and receives focus;
- the error disappears as soon as the user corrects the field.
These texts often change without anyone deciding it: an update of the authentication library, a new translation. A generic message replaced by a precise one is a security regression that passes every functional test, since the login still works.
The security cases you should not skip
On the security side, a login page is tested on what it lets people attempt and on what it lets leak. Five checks catch the most common regressions, the ones an update brings back without a sound.
- Limit attempts. After a series of failures, the application should slow down or block the next attempts. The OWASP cheat sheet devotes a section to automated attacks: limiting attempts, locking the account for a while. Test the threshold, the lockout duration and the message displayed. GoodDeal never locks, so that you can practice without locking yourself out: test this case on your own application.
- Redirect only within the site. If the address carries the return page (
?next=), it must accept only pages of the site. On GoodDeal,/playground/login?next=https://example.combrings you back to the home page after signing in, not to the external site. - Keep the password out of the address. Credentials travel in the body of a POST request, never in the URL, which ends up in the browser history and in server logs. The Network tab of the developer tools shows it in a single sign-in.
- Serve the page over HTTPS. The page and the form submission go over HTTPS, with no mixed content.
- Reject crafted input. Entered as the password with a valid email, a string such as
' OR '1'='1must produce the same refusal as a wrong password, with no technical error message.
These cases do not replace a penetration test. They act as a safety net between two audits: replayed on every version, they flag the day a change reopens a door.
Accessibility: signing in with a keyboard, a screen reader and a password manager
An accessible login page can be filled in from the keyboard, announces its errors to screen readers and lets the browser or the password manager fill in the fields. That last point reverses a test case that is still common: "check that the password cannot be pasted".
Success criterion 3.3.8 of WCAG 2.2, "Accessible Authentication (Minimum)", is level AA. It allows a cognitive function test, such as remembering a password, only if some help exists: pasting or autofill, for example. The W3C's explanatory page is clear: blocking paste forces the user to retype the information and fails the criterion, just like preventing a password manager from filling in the fields.
So the test case is reversed: check that pasting works and that the password manager fills in both fields. Then check:
- a visible label, linked to each field;
- the
autocomplete="username"andautocomplete="current-password"attributes, which help password managers recognize the fields; - the tab order: email, password, show button, sign-in button;
- the "Show" button, which announces its state (
aria-pressed); - a visible focus indicator on each element.
The GoodDeal page meets these points: practice checking them with the keyboard and a screen reader. The last one is visual, and Delta-QA publishes its test cases on forms and their states, focus indicators included.
Automating login page tests: with or without code
Two routes. A script (Playwright, Cypress, Selenium) fills in the fields through their selectors and checks what it was told to check. A no-code tool records the login while you do it, then replays it on every version and compares each step to its reference.
A script is precise and free, but it needs someone who codes, and it only sees its assertions. An error message that became unreadable or a hidden button go through as long as nobody has written the line that checks them. The script also breaks when a selector changes, even though the page works.
With Delta-QA, you open the login page, you sign in, and the journey is recorded. On every version, Delta-QA replays it in Chrome (Chromium), compares each step the way a human eye would and names the elements that changed: an error text, a field, a button. A button that was moved or renamed is found again without reworking the scenario (self-healing); if it has disappeared, Delta-QA does not click somewhere else and reports it to you.
Start with three scenarios: the successful sign-in, the failure with a wrong password, the empty form. The first one then serves as the starting point for your other journeys, such as the cart or checkout: it is an end-to-end test, and often the first smoke test run after a deployment. Replayed on every version, these scenarios become your regression tests.
FAQ
How many test cases does a login page need?
About ten cover an email and password form: success, failures, empty fields, format, redirect and sign-out, plus the basic security and accessibility checks. Each added feature brings its own: "Remember me", forgotten password, two-factor authentication, sign-in with a Google or Microsoft account.
Should you test account lockout after several failed attempts?
Yes, on your application. Check the number of attempts allowed, the lockout duration and the message displayed, which must not reveal whether the account exists. Also check that a third party cannot lock someone else's account at will by multiplying attempts.
Should copy and paste be blocked in the password field?
No. Blocking paste gets in the way of password managers and fails success criterion 3.3.8 of WCAG 2.2, "Accessible Authentication (Minimum)". The right test case checks the opposite: pasting and autofill work.
Is a login test a smoke test?
It is often the first one. Right after a deployment, checking that a test account can sign in tells you in a few seconds whether the application is still standing. The other cases in this article belong to regression testing: they are replayed on every version.
Where can you practice testing a login page?
On the GoodDeal login page, Delta-QA's practice shop: demo account demo@gooddeal.test, password Demo1234, no lockout after several failures. Other free sites are in our list of practice sites for test automation.
How do you automate a login test without writing code?
With a tool that records the journey: you sign in once in the browser, the tool records the steps, then replays them on every version. Delta-QA then compares each step to its reference, the way a human eye would, and names the elements that changed.
