This documentation is available as Markdown. For the complete index, see llms.txt. Skip to content

Helpers — flows & mocks

For the complete documentation index, see llms.txt

Helpers are ordinary JS functions in unotest/e2e/_helpers/. There are two kinds, and keeping them separate keeps scenarios clean.

Flows — replay a UI journey

flow_* functions wrap a repeated user journey: sign-in, checkout, onboarding. Write once, call from any scenario.

_helpers/flows.js
function flow_signin(email, password) {
goto("/login");
fill(getByLabel("Email"), email);
fill(getByLabel("Password"), password);
click(getByRole("button", { name: "Sign in" }));
}

An agent can also replay a flow live (explore_run_flow) to seed state, then record a new test on top of it.

Mocks — seed & reset data

Use the sandbox helpers to put the app into a known state before a test and clean up after. Connection details are pinned in config — a scenario can’t redirect them.

_helpers/mocks.js
function seed_cart(userId) {
dbExec("INSERT INTO carts (uid) VALUES ($1)", userId);
apiCall("POST", "/test/checkout/reset");
}
HelperUse
dbQuery / dbExecparameterized SQL (postgres / mysql / sqlite)
apiCallrelative-path HTTP against apiBaseUrl
shellrun a binary (execFile, no shell interpretation)