Record flows

Record

No SDK, through a local proxy:

npx stresseur record --browser http://localhost:3000

Or add the SDK to your browser entry point, in development only:

import { StresseurRecorder } from 'stresseur-recorder';

if (process.env.NODE_ENV !== 'production') {
  StresseurRecorder.init({ endpoint: 'http://127.0.0.1:3737/ingest' });
}

and start your app through the recorder:

npx stresseur record -- npm run dev

It captures fetch and XHR, so any frontend framework works. Use the app, then Ctrl-C. Sessions go to .stresseur/recording.db.

--browser and --app also record page loads and form posts, so server-rendered apps (Flask, Django, Rails, Express views, Next.js server actions) work. They pick a free port when 3738 is busy, and always record your app’s address, never the proxy’s.

Generate

npx stresseur sessions                              # list session ids
npx stresseur generate                              # latest session
npx stresseur generate --session <id> --name checkout

Flows are written to api-tests/<name>.yamlflow.yaml. Secrets become {{ #env:VAR }} references, listed in .env.example. Each new flow runs once against APP_URL, your app’s address; skip with --no-verify.

Generated flows:

  • send form posts as recorded (urlencoded or multipart, fields in the order sent): the post and its redirect in one step (follow_redirects: false), the page it lands on in the next
  • read CSRF tokens and row ids from the page that showed them, and other values only from a form field of the same name
  • name steps after the resource (GetProfile), never after a recorded value
  • send a fresh email or username on sign-up each run, and reuse it in later steps
  • check each answer, not just the status: JSON keys, no error page, not a login page (by body and final URL)
  • check that a write happened: the list read after it holds the new id, or the page after it shows what you typed (made unique each run)
  • never assert recorded timestamps or ids
  • use one variable for a password typed twice

A step that fails with “landed on a login page” means the login didn’t carry over: check the session cookie, CSRF token, or the password in .env. “Expected JSON, got an HTML page” means the step called a page, not your API: check APP_URL against the address in .env.example. Without APP_URL, generate says Not checked and shows your app’s recorded address.

Next.js server-action ids change with every build. Record again after a rebuild.

From a HAR file

No recorder needed. Use your app in the browser with devtools open, then on the Network tab choose “Save all as HAR”.

npx stresseur generate --har ~/Downloads/localhost.har --name checkout

It keeps your app’s own fetch and XHR calls, and its page loads and form posts when your app posts page forms. The base URL becomes APP_URL, tokens and ids are mapped between steps, and streamed responses get stream:. Use --origin <url> when the HAR’s first page is on another site.

A HAR file holds raw cookies and tokens. Don’t commit it.

When a step looks like an AI endpoint, generate prints a hint to add expect: checks. See AI checks. Your coding agent does this after npx stresseur install-skill.