# Workflow Overview

Workflows are visual test sequences that model user journeys through your application. Each workflow is a directed graph of nodes — login, navigate, action, assertion, wait, condition, seed, and more — connected to form a testable path.

**Feedback.** Tell Cofactor the moment a step in this guide is wrong, unclear or missing; a command fails in a way the guide did not predict; you took a detour or had to guess; or a tool you needed does not exist. Send it when it happens, not only at the end: one sentence on what happened and what would have helped. Run `cofactor feedback "<what happened; what would have helped>" --topic instructions --command "cofactor workflow guide <section>"`, or call the `cofactor_feedback_submit` MCP tool with the same text, topic and command. Never include secrets, customer data, real names or URLs; use neutral examples (Acme, example.com).

When to use workflows:

- Critical paths: signup, checkout, billing, onboarding
- High-risk areas: features that regress often or have complex logic
- Multi-step journeys: flows spanning multiple pages or user roles

For visual regression coverage, add one Visual checkpoint for each meaningful
state. Seed the state in Sandboxes v2 before capturing it. See
`cofactor workflow guide visual-checkpoints` for native and Playwright examples.

## Flow types

- `standard`: The default. Models a single user journey end-to-end.
  Login → Navigate → Actions → Assertions → Cleanup.
- `setup`: Deprecated. Formerly a prerequisite workflow referenced by a
  setup node; use a seed workflow for shared data and suite
  layers for ordering instead.
- `seed`: A data-seeding workflow that generates test data and exports
  variables for downstream workflows. Seed outputs are declared
  in the workflow definition and available as `$var.{dataKey}`
  in any workflow that references the seed.
- `teardown`: A cleanup workflow that runs after a seed workflow completes.
  Automatically invoked to remove data the seed created.

## Execution model

1. Login node provisions an authenticated browser session
2. Nodes execute in sequence (or branch at condition nodes)
3. Each action node interacts with the live application
4. Assertions verify expected outcomes
5. Additional login nodes switch to a different user — each starts a
   new segment with a fresh session (great for multi-role testing)
6. Wait nodes pause execution (minutes, hours, days) — also creating
   segments. After a wait, a login re-establishes the session.
7. On completion, the run is marked success or failure

## Version history

Workflows maintain version history. Publishing creates a versioned
snapshot. Previous versions can be previewed or restored to draft.
Seed nodes reference a specific published version of the seed workflow.
