Skip to Content
screw bugs docs

Cases and steps

How a job, its cases and their steps are written, and what each step does.

A job is one run: a URL and a list of cases, each a list of steps run in order. Whoever writes the cases (your agent, or you) decides what runs; screw-bugs decides each status.

The model

  • Job: url, cases, and optional title, instructions, summary, device (desktop or mobile) and account. title, instructions and summary are shown, never interpreted.
  • Case: id, title, steps, an optional success sentence and an optional continue.
  • Session: cases run one after another in one browser, recorded as one video. Cookies and storage carry over.
  • Start page: a case starts at the job URL (or its first goto), unless it continues.

An example

A --spec file for screw-bugs run. The MCP tool start_run takes the same job without version, and there summary is required.

{
  "version": 1,
  "url": "http://localhost:3000",
  "title": "Sign-in after the refactor",
  "summary": "Signing in with a test account still reaches the dashboard and greets the user.",
  "cases": [
    {
      "id": "login-works",
      "title": "Signing in reaches the dashboard",
      "success": "The user lands on the dashboard and sees a welcome message.",
      "steps": [
        { "action": "goto", "url": "/login" },
        { "action": "fill", "target": { "label": "Email" }, "value": "test@example.com" },
        { "action": "click", "target": { "role": "button", "name": "Sign in" } },
        { "action": "expectUrl", "includes": "/dashboard" },
        { "action": "expectText", "text": "Welcome" },
        { "action": "screenshot", "name": "dashboard" }
      ]
    }
  ]
}

screw-bugs schema job prints the full JSON Schema.

Step kinds

StepFieldsWhat it does
gotourlOpen a URL; paths resolve against the job URL. HTTP 400+ fails
reloadReload the page; judged like goto
clicktargetClick an element
hovertargetMove the pointer over an element
filltarget, valueReplace the value of an input
uploadtarget, filesChoose files for a file input
presskeyPress a key, such as Enter
expectTexttext, frame?Expect the text to become visible
expectNoTexttext, frame? or target?Expect the text not to show, as text, alt text or label
expectUrlincludesExpect the page URL to contain this
expectLinktarget, href, match?Expect a link to go to an address, without following it
waitFortarget, state?Wait until the target is visible, hidden, attached or detached
scrollone of target, to, by; frame?Scroll, then screenshot the view
screenshotnameSave a full-page screenshot as evidence
  • Targets: exactly one of role (with optional name), text, label, alt or css, plus an optional frame.
  • Timeouts: every step but screenshot takes timeoutMs (100 to 180000). Defaults: 5 s for elements, 15 s for page loads.
  • Prove the behavior: expect what only shows when it worked, such as the exact success message. A field label proves nothing.

Continuing a case

"continue": true starts a case on the page the case before it ended on, instead of the job URL. Use it to check what an earlier case made, one check per case.

{
  "id": "no-sample-logos",
  "title": "The portfolio shows no sample client logos",
  "continue": true,
  "steps": [{ "action": "expectNoText", "text": "Acme" }]
}
  • A continuing case runs even when the case before it failed.
  • The first case of a job cannot continue.

Test accounts

A job runs signed in with account: a label, or { "label": "paid-user", "about": "Pro plan, paying monthly" }. Without it, a run starts signed out.

Start the job

Nothing starts, and you're asked to sign in, when the account has no saved session for this origin, its session was saved for another origin (staging instead of localhost), or all its cookies expired. Over MCP the reply gives a link to a live view of the browser; the CLI exits with code 9 and prints the command:

npx -y screw-bugs@latest accounts sign-in trial-user --url http://localhost:3000 --about "On a 14-day trial"

Sign in once

Open the live view, sign in as that user and press Save sign-in. What you type is never logged, recorded or saved; only the app's cookies and storage are kept.

Run again

Every later run with that account starts signed in.

  • Over MCP: call start_run once with waitSeconds: 0 to get the link and show it to the user, then again with waitSeconds (up to 600) to wait for Save sign-in and start.
  • Session stopped working sooner (the run lands on a sign-in page)? Send { "label": "trial-user", "renew": true } once. It doesn't ask again for 10 minutes after a save.

Sessions live in .screw-bugs/accounts/<label>.json (mode 0600), listed in .screw-bugs/accounts.json. For Cloud runs, see Test accounts.

Full reference

The README has every detail:

  • The screw-bugs README, sections "Jobs, cases and steps", "Waiting and scrolling", "Frames", "Images and links", "Uploads", "Continuing a case" and "Test accounts".
  • npx -y screw-bugs@latest schema job prints the full JSON Schema, with every limit.
  • The schema itself: packages/core/src/schema/job.ts (screw-bugs)
NextReports

On this page