Skip to content

Login errors

Generate one scenario per error case from an array.

import { story } from 'executable-stories-vitest';
import { it } from 'vitest';
const loginErrorExamples = [
{ email: "user@example.com", password: "wrong", message: "Invalid credentials" },
{ email: "locked@example.com", password: "secret", message: "Account is locked" },
{ email: "unknown@example.com", password: "secret", message: "Invalid credentials" },
];
for (const row of loginErrorExamples) {
it(`Login errors: ${row.message}`, ({ task }) => {
story.init(task);
story.given("the user is on the login page");
story.when(`the user logs in with "${row.email}" and "${row.password}"`);
story.then(`the error message should be "${row.message}"`);
});
}
### ✅ Login errors: Account is locked
- **Given** the user is on the login page
- **When** the user logs in with "locked@example.com" and "secret"
- **Then** the error message should be "Account is locked"