Authentication

Invalid login

Negative path: wrong password surfaces a stable, accessible error message.

User story

As a user with a typo, I want a clear error message instead of a redirect so I know what to fix.

Acceptance criteria

  • Submitting wrong password shows an inline error
  • Error copy is stable text usable for assertions
  • Aria-live region announces the error to screen readers
  • URL stays on /login

Manual test steps

  1. 1.Open /login
  2. 2.Enter demo@hakdogan.com
  3. 3.Enter Wrong-password-1!
  4. 4.Submit and observe the error

Expected result

An error chip with 'Invalid credentials' appears; URL remains /login.

Possible bug risks

  • Error text changes between releases, breaking selectors
  • Server returns 500 instead of 401, masking the real cause
  • Lockout counter not surfaced after 5 failed attempts

Reference Playwright spec

invalid-login.spec.ts
ts
1
2
3
4
5
6
7
8
9
10
11
import { test, expect } from '@playwright/test';

test('invalid password shows stable error @regression', async ({ page }) => {
  await page.goto('https://lab.hakdogan.com/login');
  await page.getByLabel(/work email/i).fill('demo@hakdogan.com');
  await page.getByLabel(/^password$/i).fill('Wrong-password-1!');
  await page.getByRole('button', { name: /sign in/i }).click();

  await expect(page.getByRole('alert')).toContainText(/invalid credentials/i);
  await expect(page).toHaveURL(/\/login$/);
});