> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.doc-detective.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.doc-detective.com/_mcp/server.

# step

> A step in a test.

A step in a test.

## Referenced In

* [test](/reference/schemas/test)
* [Resolved context](/reference/schemas/resolved-context)

## Fields

| Field              | Type    | Description                        | Default |
| :----------------- | :------ | :--------------------------------- | :------ |
| \$schema           | unknown | Optional. No description provided. | —       |
| result             | unknown | Optional. No description provided. | —       |
| resultDescription  | unknown | Optional. No description provided. | —       |
| resultCode         | unknown | Optional. No description provided. | —       |
| resultHint         | unknown | Optional. No description provided. | —       |
| stepId             | unknown | Optional. No description provided. | —       |
| description        | unknown | Optional. No description provided. | —       |
| unsafe             | unknown | Optional. No description provided. | —       |
| outputs            | unknown | Optional. No description provided. | —       |
| variables          | unknown | Optional. No description provided. | —       |
| if                 | unknown | Optional. No description provided. | —       |
| assertions         | unknown | Optional. No description provided. | —       |
| onPass             | unknown | Optional. No description provided. | —       |
| onFail             | unknown | Optional. No description provided. | —       |
| onWarning          | unknown | Optional. No description provided. | —       |
| onSkip             | unknown | Optional. No description provided. | —       |
| location           | unknown | Optional. No description provided. | —       |
| autoScreenshotPath | unknown | Optional. No description provided. | —       |
| attempts           | unknown | Optional. No description provided. | —       |
| visit              | unknown | Optional. No description provided. | —       |
| durationMs         | unknown | Optional. No description provided. | —       |
| startedAt          | unknown | Optional. No description provided. | —       |
| checkLink          | unknown | Optional. No description provided. | —       |
| click              | unknown | Optional. No description provided. | —       |
| find               | unknown | Optional. No description provided. | —       |
| goTo               | unknown | Optional. No description provided. | —       |
| httpRequest        | unknown | Optional. No description provided. | —       |
| runShell           | unknown | Optional. No description provided. | —       |
| runCode            | unknown | Optional. No description provided. | —       |
| runBrowserScript   | unknown | Optional. No description provided. | —       |
| type               | unknown | Optional. No description provided. | —       |
| screenshot         | unknown | Optional. No description provided. | —       |
| saveCookie         | unknown | Optional. No description provided. | —       |
| record             | unknown | Optional. No description provided. | —       |
| stopRecord         | unknown | Optional. No description provided. | —       |
| closeSurface       | unknown | Optional. No description provided. | —       |
| startSurface       | unknown | Optional. No description provided. | —       |
| loadVariables      | unknown | Optional. No description provided. | —       |
| dragAndDrop        | unknown | Optional. No description provided. | —       |
| loadCookie         | unknown | Optional. No description provided. | —       |
| swipe              | unknown | Optional. No description provided. | —       |
| wait               | unknown | Optional. No description provided. | —       |
| annotate           | unknown | Optional. No description provided. | —       |

## Examples

```json
{
  "stepId": "uuid",
  "description": "Description of the step.",
  "checkLink": "https://www.google.com",
  "variables": {
    "variableKey": "variableValue"
  }
}
```

```json
{
  "checkLink": "https://www.google.com"
}
```

```json
{
  "stepId": "path-only",
  "checkLink": "/search"
}
```

```json
{
  "stepId": "status-code",
  "checkLink": {
    "url": "https://www.google.com",
    "statusCodes": [
      200
    ]
  }
}
```

```json
{
  "goTo": {
    "url": "https://www.google.com"
  }
}
```

```json
{
  "goTo": "https://www.google.com"
}
```

```json
{
  "wait": 5000
}
```

```json
{
  "swipe": "up"
}
```

```json
{
  "swipe": {
    "from": {
      "x": 200,
      "y": 600
    },
    "to": {
      "x": 200,
      "y": 200
    }
  }
}
```

```json
{
  "runCode": {
    "language": "python",
    "code": "print('Hello from Python')",
    "workingDirectory": ".",
    "exitCodes": [
      0
    ],
    "stdio": "Hello from Python!",
    "path": "python-output.txt",
    "directory": "output",
    "maxVariation": 0.1,
    "overwrite": "aboveVariation"
  }
}
```

```json
{
  "stopRecord": true
}
```

```json
{
  "runShell": {
    "command": "docker run -p 8080:80 nginx",
    "background": {
      "name": "web",
      "waitUntil": {
        "httpGet": "http://localhost:8080"
      }
    },
    "timeout": 30000
  }
}
```

```json
{
  "closeSurface": "web"
}
```

```json
{
  "screenshot": true
}
```

```json
{
  "screenshot": "image.png"
}
```

```json
{
  "screenshot": "static/images/image.png"
}
```

```json
{
  "screenshot": "/User/manny/projects/doc-detective/static/images/image.png"
}
```

```json
{
  "screenshot": {
    "path": "image.png",
    "directory": "static/images",
    "maxVariation": 0.1,
    "overwrite": "aboveVariation",
    "crop": "#elementToScreenshot"
  }
}
```

```json
{
  "screenshot": {
    "path": "image.png",
    "directory": "static/images",
    "maxVariation": 0.1,
    "overwrite": "aboveVariation"
  }
}
```

```json
{
  "screenshot": {
    "path": "image.png",
    "directory": "static/images",
    "maxVariation": 0.1,
    "overwrite": "aboveVariation",
    "crop": {
      "selector": "#elementToScreenshot",
      "elementText": "Element text",
      "padding": {
        "top": 0,
        "right": 0,
        "bottom": 0,
        "left": 0
      }
    }
  }
}
```

```json
{
  "record": true
}
```

```json
{
  "record": "video.mp4"
}
```

```json
{
  "record": "static/media/video.mp4"
}
```

```json
{
  "record": "/User/manny/projects/doc-detective/static/media/video.mp4"
}
```

```json
{
  "record": {
    "path": "video.mp4",
    "directory": "static/media",
    "overwrite": true
  }
}
```

```json
{
  "loadVariables": "variables.env"
}
```

```json
{
  "saveCookie": "session_token"
}
```

```json
{
  "saveCookie": {
    "name": "auth_cookie",
    "path": "auth-session.txt",
    "directory": "./test-data",
    "overwrite": true
  }
}
```

```json
{
  "loadCookie": "session_token"
}
```

```json
{
  "loadCookie": {
    "name": "auth_cookie",
    "path": "auth-session.txt",
    "directory": "./test-data"
  }
}
```

```json
{
  "find": "Find me!"
}
```

```json
{
  "find": {
    "selector": "[title=Search]"
  }
}
```

```json
{
  "find": {
    "selector": "[title=Search]",
    "timeout": 10000,
    "elementText": "Search",
    "moveTo": true,
    "click": true,
    "type": "shorthair cat"
  }
}
```

```json
{
  "find": {
    "selector": "[title=Search]",
    "click": {
      "button": "right"
    }
  }
}
```

```json
{
  "find": {
    "selector": "[title=Search]",
    "timeout": 10000,
    "elementText": "Search",
    "moveTo": true,
    "click": true,
    "type": {
      "keys": [
        "shorthair cat"
      ],
      "inputDelay": 100
    }
  }
}
```

```json
{
  "click": "Submit"
}
```

```json
{
  "click": {
    "button": "left",
    "elementText": "Element text"
  }
}
```

```json
{
  "click": {
    "selector": "#elementToScreenshot",
    "elementText": "Element text",
    "button": "middle"
  }
}
```

```json
{
  "httpRequest": "https://reqres.in/api/users"
}
```

```json
{
  "httpRequest": "$API_URL/users"
}
```

```json
{
  "httpRequest": {
    "url": "https://reqres.in/api/users"
  }
}
```

```json
{
  "httpRequest": {
    "url": "/api/users",
    "statusCodes": 200,
    "request": {
      "headers": "Accept: application/json\nAuthorization: Bearer $TOKEN"
    }
  }
}
```

```json
{
  "httpRequest": {
    "url": "https://reqres.in/api/users/2",
    "method": "put",
    "request": {
      "body": {
        "name": "morpheus",
        "job": "zion resident"
      }
    }
  }
}
```

```json
{
  "httpRequest": {
    "url": "https://reqres.in/api/users",
    "method": "post",
    "request": {
      "body": {
        "name": "morpheus",
        "job": "leader"
      }
    },
    "response": {
      "body": {
        "name": "morpheus",
        "job": "leader"
      }
    },
    "statusCodes": [
      200,
      201
    ]
  }
}
```

```json
{
  "httpRequest": {
    "url": "https://www.api-server.com",
    "method": "post",
    "timeout": 30000,
    "request": {
      "body": {
        "field": "value"
      },
      "headers": {
        "header": "value"
      },
      "parameters": {
        "param": "value"
      }
    },
    "response": {
      "body": {
        "field": "value"
      },
      "headers": {
        "header": "value"
      }
    },
    "statusCodes": [
      200
    ]
  }
}
```

```json
{
  "httpRequest": {
    "url": "https://reqres.in/api/users",
    "method": "post",
    "request": {
      "body": {
        "name": "morpheus",
        "job": "leader"
      }
    },
    "response": {
      "body": {
        "name": "morpheus",
        "job": "leader"
      }
    },
    "statusCodes": [
      200,
      201
    ],
    "path": "response.json",
    "directory": "media",
    "maxVariation": 0.05,
    "overwrite": "aboveVariation"
  }
}
```

```json
{
  "httpRequest": {
    "openApi": "getUserById"
  }
}
```

```json
{
  "httpRequest": {
    "openApi": {
      "name": "Reqres",
      "operationId": "getUserById"
    },
    "request": {
      "parameters": {
        "id": 123
      }
    }
  }
}
```

```json
{
  "httpRequest": {
    "openApi": {
      "descriptionPath": "https://api.example.com/openapi.json",
      "operationId": "getUserById"
    },
    "request": {
      "parameters": {
        "id": 123
      }
    }
  }
}
```

```json
{
  "httpRequest": {
    "openApi": {
      "descriptionPath": "https://api.example.com/openapi.json",
      "operationId": "createUser",
      "useExample": "both"
    }
  }
}
```

```json
{
  "dragAndDrop": {
    "source": {
      "selector": "#sourceElement"
    },
    "target": {
      "selector": "#targetElement"
    }
  }
}
```

```json
{
  "runBrowserScript": "return document.title;"
}
```

```json
{
  "runBrowserScript": {
    "script": "return arguments[0] + arguments[1];",
    "args": [
      "foo",
      "bar"
    ],
    "output": "foobar"
  }
}
```

```json
{
  "annotate": {
    "add": [
      {
        "id": "step-1",
        "badge": "#username",
        "label": "1"
      }
    ]
  }
}
```

```json
{
  "annotate": {
    "clear": true
  }
}
```