Scenarios & Steps

Scenarios are sequences of steps that end in one or more captures. They can be recorded interactively or written manually, but the stored model is always JSON.

Smallest scenario

JSON
{
  "scenarios": [
    {
      "name": "billing-overview",
      "steps": [
        { "action": "goto", "url": "/app/billing" },
        { "action": "capture", "key": "billing-overview" }
      ]
    }
  ]
}

Expanded example

JSON
{
  "scenarios": [
    {
      "name": "user-login",
      "steps": [
        { "action": "goto", "url": "/login" },
        { "action": "type", "selector": "#email", "text": "user@example.com" },
        { "action": "type", "selector": "#password", "text": "password123" },
        { "action": "click", "selector": "button[type='submit']" },
        { "action": "waitFor", "selector": "[data-testid='dashboard']" },
        { "action": "capture", "key": "dashboard-logged-in" }
      ]
    }
  ]
}

Step API reference

ActionRequired fieldsOptional fieldsDescription
gotourl-Navigate to a route
clickselectordescriptionClick an element
typeselector, text-Type into an input
hoverselector-Hover an element
wait-msPause execution
waitForselectortimeoutWait for a selector
capturekeyselector, clip, cropCapture the current view

Scenario-level overrides

JSON
{
  "name": "checkout-flow",
  "timeout": 60000,
  "viewport": {
    "width": 1920,
    "height": 1080
  },
  "steps": []
}

Scenario-level settings override the global config.

Selector guidance

Prefer app-owned selectors such as data-testid or data-reshot-* attributes. They are easier to keep stable across product changes than visual CSS selectors.

Scenarios & Steps — Reshot Docs | Reshot