Best Practices
Explore before authoring
Read the intended journey and relevant product-map capability. Use a cofactor session with the intended credential and application environment to explore the real UI before choosing targets. Confirm the signed-in user and role during this preflight, not as an extra runtime requirement unless authentication or identity is what the test covers.
Discover named data candidates yourself, then confirm with the user which existing fixtures are reliable for repeated tests. Ask about genuinely ambiguous behavior or data stability, not labels or URLs you can discover. If shared data is unsuitable, agree on test-owned setup.
Scope: one coherent user journey
A workflow should test one job-to-be-done, not multiple unrelated tasks. Many steps are fine if they're all part of the same flow (an action and everything it is meant to cause). Stop when the goal is accomplished.
Good — multi-role journey:
Login as Customer → Place an order → Login as Sales Rep → Verify the order appears in the queue
Good — single-entity journey:
Login → Navigate to projects → Create project → Edit name → Assert name updated → Cleanup: delete project
Good — read-only flow:
Login → Navigate to dashboard → Assert widgets visible
Bad — multiple unrelated journeys:
Dashboard → Create item → Manage users → Generate report (These are separate jobs — create separate workflows)
Rule: "Is this step dependent on or naturally connected to the previous steps?" If no, you're starting a new journey — stop.
A coherent flow can be long or short — there is no target node count. If a flow grows very long, ask whether it is really several INDEPENDENT journeys: splitting them into separate tests lets them run in parallel and fail independently. Keep a single coherent journey together — don't split mid-flow.
Test the seams: follow the action to its effect
CRUD rarely breaks on its own. The seams between features break: the place where one action is supposed to cause something somewhere else. Creating a ticket is not the point. The point is what the ticket does: notify the assignee, land in Support's queue, bump a count on the dashboard, sync to an integration.
Before writing a flow, ask: "When this action succeeds, what is supposed to happen next, and where would a user see it?" When there's an answer, the stronger journey follows the action to that effect:
Weaker — stops at the write:
Login → Create ticket assigned to Support → Assert ticket in my list
Stronger — crosses the seam:
Login as Customer → Create ticket assigned to Support → Login as Support → Confirm the assignment email in Support's inbox → Verify the ticket is in the Support queue
Common seams to look for:
- Another screen or view (a list, dashboard, report, activity feed)
- Another role or user (a queue, an approval, a shared record)
- A message (email, in-app notification; for email, see External
dependencies in
cofactor workflow guide data-lifecycle) - A downstream state change (status, count, permission)
Create → edit → delete is mostly data management: the test makes what it needs and cleans it up (see Make each test self-sufficient). It is a fine flow for a page whose writes have no effect elsewhere. But when the action is meant to trigger something, the effect is what's worth proving.
This is a preference, not a requirement. Some seams can't be observed from the test (a third-party system with no readable surface, a side effect with no UI). Assert what you can see and move on. When authoring from a recording, apply this only within what was captured — don't add steps the recording never performed.
Write steps as human intent
A workflow should read like instructions you'd explain to a teammate:
- "Create a ticket assigned to Support."
- "Submit the ticket and confirm it appears in the list."
- "Change the ticket status to Closed."
Capture the "why" and the "what" — not UI mechanics.
Choose the right granularity
Too granular:
- "Click New"
- "Type title"
- "Type description"
- "Click Save"
Too stuffed:
- "Create a ticket, assign it, comment, upload, and verify in three views"
Good:
- "Create a ticket with required fields"
- "Assign the ticket to Support"
- "Verify the ticket appears in the queue"
Sizing rule: a node is a single coherent goal of roughly 3–8 playbook steps
(one meaningful action each — a whole form-fill is ONE fill_form step). The
"too granular" list above is about splitting one goal into a node per keystroke
or writing mechanics-only titles — NOT a ban on single-action nodes: a lone
action that stands on its own ("Click Start to open the modal") is fine. This
~3–8 is per action node (its playbook STEPS); it is NOT a cap on how many NODES
a flow has — flow length follows the journey (see Scope above). See the Action
Nodes section.
If an action crosses multiple screens or changes multiple entities, split it. If it's a single user goal on a single screen, keep it as one action.
Make each test self-sufficient
A strong test is idempotent, controls its own data, and is isolated. The
full rules and their sanctioned workarounds are the "Strong tests" block of
the Test Data Lifecycle guide (cofactor workflow guide data-lifecycle).
In short:
- Create the data the test operates on, inline, with macros (
$EMAIL(),$UUID(), etc.) so reruns don't collide - Use a seed workflow only for data that several tests share
- Pre-existing data the test only READS is fine — declare it in
## Preflight(the workflow's preflight field, not its description) and never mutate it - Tests that must run in order go in suite layers, never rely on implicit ordering
This keeps runs deterministic and prevents cascading failures.
Verify the specified behavior
Verify each meaningful product claim, without adding implementation-only checks. Assertions express the required outcome; replay code supplies DOM evidence and measurements. Chosen scroll distances and viewport sizes are action/setup inputs, not acceptance thresholds unless the spec says so. Do not assert ARIA values, SVG paths, or a signed-in user merely because exploration exposed them.
Before recording a step, verify its expected outcome:
- Form submissions: confirm acceptance (success message, redirect, new item in list)
- Data creation: navigate to where the record should appear and confirm
- Data modification: reload and confirm the change persisted
- Deletions: confirm the item is gone (a toast alone is not enough)
- Side effects: where an action is meant to cause something elsewhere, check it there when you can (see Test the seams)
- Navigation: confirm the expected page loaded
If verification fails, debug the issue — don't record and move on.
Keep descriptions clear
An action node's "title" is short and says what the user does; its
configJson.actionDescription adds the detail the title can't carry:
{ "nodeType": "action", "title": "Create a support ticket",
"configJson": { "actionDescription": "Fill the form with a QA Test subject and High priority, then submit" } }
- Bad title: "Step 3 - ticket creation process"
- Bad title: "Fill the form with a QA Test subject and High priority, then submit" (that is the description; a copied instruction is not a title)
A missing title is rejected, never derived from the description.
The workflow description gives the spirit of the whole test in one or two
plain sentences: what it does and why it matters. Capability codes,
preconditions, issue ids, status and step narration do not belong there:
preconditions go in ## Preflight, and the rest lives with the product-map
link, the linked issue, the run history and the nodes.
People read description, preflight and cleanup, so write preflight and
cleanup as short markdown bullet lists and never put a raw ID in any of
them (no UUID or UUID prefix, no wf_/prule_ or other prefixed id, no issue
or run id). Name the seed workflow, teardown, connection or record instead.
Node ordering
The start-of-workflow order is a strict hierarchy (see "Starting node" in the Node Types guide):
Seed (if needed) → Login → Navigate → ...
The first node is the ACTOR, not a navigate: an authenticated flow opens
with a login node (or a seed, if it needs data first) — never with a
navigate node. A navigate jumps to the test's entry point AFTER login.
Only unauthenticated flows (signup, password reset, public pages, or a
login test) may start with a navigate.
Seed nodes should come first. Seeds run in their own isolated context
(usually via API sequence) and export variables the rest of the flow
consumes. Putting a login before the seed wastes a browser segment,
and any login/navigate that references $var.{seed_output} must come
after the seed that produced it.
Only skip the seed-first rule if the seed itself genuinely depends on a browser session created earlier in the same workflow (rare — in that case, prefer a separate browser-based seed workflow and reference it here).
Login best practices
- Most workflows start with a login node. Workflows can also start with a seed node or API sequence when no browser session is needed yet.
- Login SUBSUMES logging in. A login node already provisions an authenticated session — it IS the act of logging in. Never follow a login node with "navigate to /login" / "enter email + password" / "click Sign in" steps. Start with the login node and go straight to the first real action. (Only exception: a flow whose purpose is to test login — start logged out and make the login steps the journey.)
- Login nodes require a
credentialId(UUID), not just acredentialName. Without acredentialIdthe Flow Designer flags the node as invalid. Find credential IDs with:cofactor credential list [--env prod|dev] - Use multiple login nodes for multi-role testing — each login starts a new segment with a fresh session as that user
- Don't test login itself (unless that's the explicit goal)
- A navigate node after login is a great way to jump directly to the test's entry point
Prefer inline assertions
Attach assertions to action nodes using inlineAssertions rather than
adding standalone assertion nodes. Inline assertions keep the test
focused and produce clearer failure reports. See the Assertions section
for details.