Authentication Testing

Login Page Test Cases That Prove the Right User Reaches the Right Account

50 practical cases covering credentials, account states, redirects, sessions, protected routes and recovery.

2026-07-28 Approximately 13 min read

A dashboard appearing after a user submits credentials does not prove that login works.

  • the intended user was authenticated
  • invalid credentials did not create a session
  • the account was eligible to sign in
  • a fresh authenticated session was created
  • the correct role, organisation or tenant was loaded
  • the user reached the intended destination
  • protected routes now recognise the authenticated state
  • previous anonymous or stale session state cannot override the new login
  • errors do not reveal whether an account exists
  • the user can recover from a failed attempt without restarting the journey

This guide contains 50 practical login page test cases covering credentials, account states, redirects, sessions, protected routes, error behaviour, accessibility and browser recovery.

Login testing workflow verifying credentials, account state, session creation, identity, tenant, redirect and protected access
Login testing workflow verifying credentials, account state, session creation, identity, tenant, redirect and protected access

The Minimum Login Page Smoke Test

When release time is limited, begin with these ten cases.

Minimum Login Smoke Test
IDTestWhat it proves
LOG-01Sign in with valid credentialsA valid active user can complete the primary flow
LOG-09Submit a correct identifier with a wrong passwordInvalid credentials do not create an authenticated state
LOG-10Submit an unknown identifierThe response does not reveal whether the account exists
LOG-19Attempt login with a disabled or suspended accountCorrect credentials do not override account state
LOG-28Compare the session before and after successful loginAuthentication creates or rotates the session correctly
LOG-30Open the originally requested protected route after loginRedirect-back behaviour preserves user intent
LOG-37Sign in as two users with different rolesThe correct account and permissions are loaded
LOG-41Refresh and reopen the authenticated pageThe session persists only according to policy
LOG-46Correct a failed login attempt and resubmitThe form recovers without stale errors or duplicate requests
LOG-50Bypass browser validation and call the login endpoint directlyServer-side authentication remains authoritative

The smoke set verifies the login transaction. It does not replace specialist security testing, load testing, MFA testing or a full session-management review.

Define the Login Acceptance Contract First

A login test becomes unreliable when “successful login” has no precise definition.

Before writing cases, define the expected contract for each part of the transaction.

Define Login Acceptance Contract
Contract elementQuestion to answer
IdentifierWhich email, username, phone number or external identity is accepted?
CredentialWhich password or authentication proof is valid?
Account stateCan active, unverified, locked, suspended or deleted accounts sign in?
Authentication methodPassword, SSO, OAuth, magic link or another method?
DestinationWhere should the user arrive after login?
SessionWhich cookie or browser state should be created or rotated?
IdentityWhich user ID should the authenticated session represent?
RoleWhich role or permission set should be loaded?
TenantWhich organisation, workspace or account should be selected?
Error behaviourWhich visible error should appear, and what must remain undisclosed?
RecoveryCan the user correct the attempt without losing relevant state?
EvidenceWhich browser, API and backend observations prove the result?

Example login contract

Define Login Acceptance Contract
Input stateExpected browser resultExpected system result
Active user + correct passwordRedirect to intended pageFresh authenticated session for that user
Active user + wrong passwordGeneric login errorNo authenticated session
Unknown email + any passwordSame generic login errorNo account information disclosed
Suspended user + correct passwordLogin refused according to policyNo active session
Authenticated user opens login pageRedirect or account-switch behaviour according to policyExisting session handled predictably
Logged-out user opens protected pageRedirect to login with destination preservedNo protected content returned

Model Login as a State Transition

Login state model from logged out through authentication decision, session creation, identity resolution and protected application state
Login state model from logged out through authentication decision, session creation, identity resolution and protected application state

A login page is not just two fields and a button. It is a transition between security and application states.

  1. Logged out
  2. Credentials entered
  3. Submission started
  4. Authentication decision
  5. Denied
  6. Account restricted
  7. Additional verification required
  8. Authenticated
  9. Session created or rotated
  10. Identity loaded
  11. Role and tenant resolved
  12. Destination selected
  13. Protected application state

The test suite should cover both transitions and prohibited transitions.

Prohibited login transitions
StateMust not transition to
Wrong passwordAuthenticated
Suspended account with correct passwordProtected application state

Login Page and Form Behaviour Test Cases

Login Form Behaviour
IDScenarioExpected resultEvidence
LOG-01Open the login page while logged outThe login form loads and the expected authentication methods are availablePage state and visible controls
LOG-02Submit the form with both fields emptySubmission is blocked and both required fields are identifiedField errors and absence of request
LOG-03Submit with the identifier emptyThe identifier error appears without clearing the password unnecessarilyField state
LOG-04Submit with the password emptyThe password requirement is identifiedField state
LOG-05Navigate through the form using only the keyboardFocus order is logical and submission is possible without a mouseFocus sequence
LOG-06Paste credentials from a password managerSupported paste and autofill behaviour does not prevent loginFilled values and final result
LOG-07Toggle password visibilityThe value is revealed and hidden without changing itInput type and value
LOG-08Click the submit button repeatedly while the request is pendingOnly one authentication transaction is createdRequest count and button state

Credential and Identity Test Cases

Credential Identity Test Cases
IDScenarioExpected resultEvidence
LOG-09Valid identifier with wrong passwordLogin is rejected and no authenticated session is createdError, cookies and protected-route check
LOG-10Unknown identifier with any passwordThe visible and HTTP response do not reveal whether the account existsResponse comparison
LOG-11Correct credentials with identifier case changedBehaviour follows the documented identifier case policyBrowser and API result
LOG-12Correct password with one character’s case changedLogin fails because passwords remain case-sensitiveError and session check
LOG-13Add leading or trailing spaces to the identifierThe documented identifier-normalisation policy is appliedSubmitted and resolved identity
LOG-14Add leading or trailing spaces to the passwordThe password is not silently changed unless explicitly documentedAuthentication decision
LOG-15Submit extremely long credential valuesThe request fails safely without truncation, crash or unintended loginResponse and logs
LOG-16Submit valid credentials using browser autofillThe correct user is authenticated, not a stale previously saved accountUser identity after login
LOG-17Change one credential after the browser autofills both fieldsThe final visible values, not stale autofill state, determine the requestPayload and authenticated user
LOG-18Submit credentials from another open login tabThe resulting authenticated state is deterministic and follows the latest accepted transactionBoth tabs and session state

Account-State Test Cases

Account State Test Cases
IDScenarioExpected resultEvidence
LOG-19Active account with correct credentialsLogin succeedsIdentity and session
LOG-20Unverified account with correct credentialsApplication follows the documented verification policyError or verification route
LOG-21Disabled account with correct credentialsLogin is refused and no session is createdResponse and protected-route check
LOG-22Suspended account with correct credentialsAccess is refused according to policyAccount state and response
LOG-23Temporarily locked account with correct credentialsLogin remains blocked until the documented unlock condition is satisfiedTimed attempts
LOG-24Account immediately before the lockout thresholdBehaviour matches the defined thresholdAttempt count
LOG-25Account at the lockout thresholdThe intended lockout or throttling state is appliedAccount and response state
LOG-26Account after automatic or administrator unlockCorrect credentials work again without restoring an invalid stale sessionNew session and identity
LOG-27Deleted or deprovisioned account with previously valid credentialsLogin fails and existing authenticated state follows the revocation policyLogin response and old session

Redirect and Destination Test Cases

Redirect Destination Test Cases
IDScenarioExpected resultEvidence
LOG-28Compare session state before and after loginThe authenticated session is newly created or rotated according to policyCookie or storage comparison
LOG-29Open the login page directly and sign inThe default authenticated destination opensFinal URL and page identity
LOG-30Open a protected deep link while logged out, then sign inThe user returns to the originally requested permitted destinationRedirect chain
LOG-31Open a protected URL containing query parametersSafe query state is preserved where intendedFinal URL and page result
LOG-32Supply an external or malformed redirect destinationThe application does not redirect to an untrusted originRedirect result
LOG-33Sign in as a new user requiring onboardingThe user reaches onboarding rather than an existing-user dashboardAccount state and final URL
LOG-34Sign in as an existing user with unfinished setupThe documented resume or onboarding rule is appliedFinal destination
LOG-35Sign in after the requested destination becomes unavailableA safe fallback page and useful message are shownRedirect and error
LOG-36Submit login twice during a slow redirectOnly one effective session and destination transition occurRequest and navigation count

Role, Tenant and Protected-Route Test Cases

Role Tenant Protected Routes
IDScenarioExpected resultEvidence
LOG-37Sign in as a standard userThe standard-user identity and navigation are loadedProfile, role and accessible routes
LOG-38Sign in as an administratorThe administrator identity is loaded without inheriting another user’s cached stateRole and protected page
LOG-39Sign out one user and sign in as another in the same browserNo profile, tenant or cached content from the previous user remainsUI, storage and API responses
LOG-40Sign in to a multi-tenant productThe correct organisation or workspace is selected according to policyTenant identifier and visible account
LOG-41Refresh the authenticated destinationThe authenticated state remains valid only according to session policyReload result
LOG-42Open a protected route in a new tab after loginThe new tab recognises the same permitted sessionRoute result
LOG-43Attempt to open the same route in an anonymous browser contextThe anonymous context is redirected or deniedSeparate browser context

Error, Accessibility and Recovery Test Cases

Errors Accessibility Recovery
IDScenarioExpected resultEvidence
LOG-44Compare the response for unknown account and wrong passwordObservable responses do not disclose which account existsText, status and timing review
LOG-45Receive a server-side authentication errorThe error is mapped to a useful form-level message without exposing internalsUI and response
LOG-46Correct a failed password attempt and resubmitStale errors clear correctly and successful login becomes possibleError state and final result
LOG-47Navigate the failed form with a screen reader or accessibility treeErrors and controls have meaningful labels and associationsAccessibility inspection
LOG-48Use Back after a successful loginSensitive logged-out content and stale form state are not restored incorrectlyBrowser history behaviour
LOG-49Lose network connectivity during submission and retryThe form presents a recoverable state and does not create conflicting sessionsNetwork and retry result
LOG-50Bypass HTML and JavaScript validation and submit directlyThe server remains authoritative and invalid credentials cannot create a sessionAPI response and protected route

The Most Important Login Failure Patterns

Login defects involving wrong identity, wrong tenant, stale session, browser cookie failure, protected-content flash and multi-tab races
Login defects involving wrong identity, wrong tenant, stale session, browser cookie failure, protected-content flash and multi-tab races

A dashboard appeared, but the wrong user is authenticated

Assert a stable account-specific indicator such as user ID, email, profile name, tenant, role or account-specific data.

The correct user is authenticated into the wrong tenant

Verify the resolved tenant separately from the authenticated user identity.

Login succeeds without rotating the session

Compare suitable session evidence before and after login when the architecture exposes it.

The login form rejects a valid user before the server sees the request

Check stale client validation, email patterns, password-manager input, autofill events and whitespace handling.

The server authenticates successfully, but the browser remains logged out

Inspect cookie storage, domain/path attributes, same-site behaviour, identity refresh and redirect timing.

Protected content becomes visible before authentication finishes

Capture screenshots or video during the transition, not only the final page.

A second tab overrides the first login

Define whether latest completed or latest submitted login wins, then test that policy.

The Back button restores sensitive authenticated content

Combine browser-history checks, network observation and server-side session verification.

What Each Testing Layer Can Prove

Login testing layers covering browser, API, identity service, session store, authorisation, accessibility, security and load testing
Login testing layers covering browser, API, identity service, session store, authorisation, accessibility, security and load testing
Testing Layers
LayerWhat it can verifyWhat it cannot prove alone
Browser testForm behaviour, redirects, identity display, browser session, protected navigation and recoveryPassword storage, complete server enforcement or infrastructure security
Login API testCredential decisions, structured errors, throttling responses and session issuanceAccessible presentation and real browser redirect behaviour
Identity-service testUser state, lockout, verification and credential policyCorrect rendering in the SaaS application
Session-store testSession creation, rotation, expiry and revocationWhether the browser applies the session correctly
Authorisation testRole, tenant and resource accessWhether the original login UX works
Accessibility evaluationLabels, focus, errors and keyboard completionServer-side identity integrity
Security reviewEnumeration, bypass, fixation and attack resistanceEveryday usability
Load testConcurrent authentication capacity and degradationCorrect identity and UI recovery for an individual user

When to Use the Browser and When to Use a Prepared Session

The login flow itself should be tested through the UI. Unrelated authenticated tests do not need to repeat login every time.

Browser Vs Prepared Session
Use real UI login when testingUse prepared authenticated state when testing
the login pagean unrelated settings page
redirectsbilling calculations
password-manager behaviourcontent editing
error recoveryanother protected workflow where login is only setup
account statestable authenticated test setup
identity switchingrepeatable role-specific environments

Automating Login Page Test Cases

A reusable browser flow can separate actions from scenario data:

  1. Open {{LOGIN_URL}}
  2. Fill {{IDENTIFIER}}
  3. Fill {{PASSWORD}}
  4. Select {{REMEMBER_ME}}
  5. Submit
  6. Assert {{EXPECTED_DESTINATION}}
  7. Assert {{EXPECTED_IDENTITY}}
  8. Assert {{EXPECTED_SESSION_STATE}}
  9. Assert {{EXPECTED_ERROR}}

Positive dataset

{
  "name": "active user reaches requested report",
  "accountState": "active",
  "credentials": {
    "identifier": "[email protected]",
    "password": "{{SECRET}}"
  },
  "startPath": "/reports/monthly",
  "expected": {
    "authenticated": true,
    "destination": "/reports/monthly",
    "identity": "qa-user",
    "role": "member",
    "tenant": "test-workspace"
  }
}

Negative dataset

{
  "name": "wrong password creates no session",
  "accountState": "active",
  "credentials": {
    "identifier": "[email protected]",
    "password": "{{WRONG_SECRET}}"
  },
  "expected": {
    "authenticated": false,
    "destination": "/login",
    "error": "generic-invalid-credentials",
    "protectedRouteAccessible": false
  }
}

Use names based on the business condition, not login_test_1 or negative_case_7.

What Browser Automation Should Not Claim

  • passwords are hashed correctly
  • database queries are parameterised
  • all injection vulnerabilities are absent
  • rate limiting works under production-scale distributed traffic
  • TLS is configured securely across every endpoint
  • session tokens cannot be forged
  • every authorisation boundary is protected
  • identity-provider signatures are validated correctly
  • every account-enumeration timing difference is impossible

Login Page Testing Checklist

  • the login form works with keyboard, paste, autofill and password managers
  • one valid active user can sign in
  • invalid credentials create no authenticated state
  • unknown account and wrong password responses follow the enumeration policy
  • identifier and password normalisation rules are explicit
  • active, unverified, locked, suspended and deleted accounts follow defined policies
  • repeated submission does not create competing transactions
  • the session is created or rotated correctly
  • the final identity is verified
  • the correct role and tenant are loaded
  • the original permitted destination is restored
  • unsafe redirect destinations are rejected
  • protected routes remain unavailable to anonymous contexts
  • account switching removes previous-user state
  • refresh, new tab and browser history follow session policy
  • server-side errors map to useful browser messages
  • failed attempts can be corrected without restarting the journey
  • errors are accessible and do not rely only on colour
  • network interruption produces a recoverable state
  • UI and server decisions remain compatible
  • browser tests are not used as proof of unrelated security controls

Final acceptance criterion. Do not accept: “The dashboard appeared.” Accept: “The intended identity received the correct session, role, tenant and destination, while invalid or restricted accounts remained outside the protected state.”

Frequently Asked Questions

What are the most important test cases for a login page?

Valid login, invalid credential rejection, generic errors, restricted account states, session creation or rotation, correct identity, intended redirect and protected-route access.

What is the difference between a login scenario and a login test case?

A scenario states the goal. A test case defines preconditions, exact actions, test data, expected identity, expected session and observable evidence.

Should login tests verify the dashboard?

They should verify more than the dashboard because the wrong identity, tenant, role or stale session may still be active.

Should unknown accounts and wrong passwords show the same error?

Where enumeration risk exists, generic responses are normally safer. Review visible text, HTTP response and timing behaviour.

Should every automated test log in through the UI?

No. Test login itself through the UI, then use prepared authenticated state for unrelated protected workflows when appropriate.

Does this article cover MFA, session timeout and logout completely?

No. Those are separate Child pages in the Authentication Testing cocoon.

Automate the Repeatable Login Journey

Reusable login automation flow with datasets for valid, invalid, restricted and recovery-focused login cases
Reusable login automation flow with datasets for valid, invalid, restricted and recovery-focused login cases

WrightTest lets teams record a login flow in a real browser, replace fixed credentials with named datasets, run cases independently and inspect screenshots, step results, errors and Playwright traces.

which account was used→ whether authentication was accepted→ which page opened→ which identity was loaded→ whether the protected route worked→ where a failed attempt stopped

The resulting browser checks can be exported to Playwright .spec.ts files when they need to move into an existing repository or CI pipeline.

Use WrightTest to verify the repeatable browser journey. Combine it with API, session-store, authorisation, accessibility and security checks to prove the complete authentication contract.

Continue with Authentication Testing

Login is one part of the complete authentication lifecycle. Use the Authentication Testing guide to plan coverage for MFA, session management and logout.