Skip to content

Login errors (Playwright)

Example for one row:

### ✅ Login errors: Account is locked
- **Given** the user is on the login page
- **When** the user logs in with "[email protected]" and "secret"
- **Then** the error message should be "Account is locked"
import { test } from '@playwright/test';
import { story } from 'executable-stories-playwright';
const loginErrorExamples = [
{ email: "[email protected]", password: "wrong", message: "Invalid credentials" },
{ email: "[email protected]", password: "secret", message: "Account is locked" },
{ email: "[email protected]", password: "secret", message: "Invalid credentials" },
];
for (const row of loginErrorExamples) {
test(`Login errors: ${row.message}`, async ({}, testInfo) => {
story.init(testInfo);
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}"`);
});
}