Reuse flows & seed data
For the complete documentation index, see llms.txtKeep scenarios short and reliable by extracting repetition into helpers.
Extract a flow
Move a repeated journey into a flow_* helper:
function flow_signin(email, password) { goto("/login"); fill(getByLabel("Email"), email); fill(getByLabel("Password"), password); click(getByRole("button", { name: "Sign in" }));}Call it from a scenario:
function test_orders() { step("Sign in", () => { flow_signin(TEST_USER_EMAIL, TEST_PASSWORD); }); step("Orders page loads", () => { assertVisible(getByRole("heading", { name: "Your orders" })); });}Seed data with mocks
Put the backend into a known state before the test, and clean up after:
function seed_order(userId) { dbExec("INSERT INTO orders (uid, status) VALUES ($1, 'paid')", userId);}dbQuery / dbExec use the database URL from config; apiCall uses
apiBaseUrl; shell runs a binary. These are pinned in
config — scenarios can’t point them elsewhere.