Skip to content

Create users from table input

Loop over table rows and register one scenario per row.

import { story } from 'executable-stories-vitest';
import { it } from 'vitest';
const createUserExamples = [
{ email: "[email protected]", role: "user" },
{ email: "[email protected]", role: "admin" },
];
for (const row of createUserExamples) {
it(`Create users from table input: ${row.email}`, ({ task }) => {
story.init(task);
story.given("the admin is on the create user page");
story.when("the admin submits the following user details");
story.table({
label: "Details",
columns: ["email", "role"],
rows: [[row.email, row.role]],
});
story.then(`the user "${row.email}" should exist with role "${row.role}"`);
});
}
### ✅ Create users from table input: [email protected]
- **Given** the admin is on the create user page
- **When** the admin submits the following user details
**Details**
| email | role |
| --- | --- |
| [email protected] | user |
- **Then** the user "[email protected]" should exist with role "user"