Test Case Examples

Complete Login Page Test Scenarios

A risk-based login testing checklist covering functional, negative, validation, accessibility, session, and security-relevant scenarios.

By AutomationTekAI11 min read
Login page test scenarios and expected results for QA engineers

A “complete” login suite is not a fixed list. It depends on authentication methods, account states, security controls, session policy, identity providers, and accessibility requirements. Use this as a risk-based starting point and remove anything your product does not support.

Core functional scenarios

IDScenarioExpected result
LGN-01Valid active accountUser is authenticated and reaches the documented destination.
LGN-02Incorrect passwordAccess is denied with a safe error; no authenticated session is created.
LGN-03Empty required fieldsSubmission is blocked and accessible validation is shown.
LGN-04Disabled or locked accountBehavior matches the documented account-state and recovery policy.
LGN-05Sign outSession is invalidated and protected pages require authentication.

Input and validation

  • Email or username format, whitespace, case behavior, and documented length boundaries.
  • Password masking, show/hide control, paste behavior, and password-manager compatibility.
  • Single submission when the user presses Enter or rapidly activates the button.
  • Clear validation that is associated with the field and announced to assistive technology.

Session and navigation

  • Protected routes redirect unauthenticated users appropriately.
  • Successful login returns the user to an allowed intended destination.
  • Logout, expiry, and credential changes invalidate sessions according to documented policy.
  • Back navigation does not expose protected content after logout.

Accessibility and responsive behavior

  • All controls have programmatic labels and visible focus.
  • Keyboard order is logical and the form submits without a pointer.
  • Errors are not conveyed by color alone.
  • Zoom, mobile viewport, and long localized text do not hide actions.

Playwright starter example

test('rejects an invalid password', async ({ page }) => {
  await page.goto('/login');
  await page.getByLabel('Email').fill('qa-user@example.test');
  await page.getByLabel('Password').fill('incorrect-password');
  await page.getByRole('button', { name: 'Sign in' }).click();
  await expect(page.getByRole('alert')).toBeVisible();
});

This is an illustrative starter. Replace paths, labels, accounts, fixtures, and assertions with your application’s documented behavior.

Security-relevant checks

Verify transport, rate limiting, account-state behavior, neutral errors, session cookies, and audit events only against approved requirements. Do not run disruptive security tests against production without authorization.

Prioritize the suite

Run valid login, invalid login, required fields, critical account states, session creation, logout, and keyboard access first. Add identity-provider, MFA, recovery, device, and risk-based scenarios only when the product supports them.

Frequently asked questions

What should every login test suite cover?

At minimum, cover valid and invalid credentials, required fields, account states, error behavior, session handling, keyboard use, and the product’s documented recovery paths.

Should login error messages reveal whether an email exists?

Generally, authentication errors should avoid unnecessary account-enumeration clues. Confirm the exact required wording with your security and product requirements.

Can these scenarios be automated?

Many can, but use controlled accounts and test environments. CAPTCHA, third-party identity providers, and risk controls may require a separate strategy.