Scenarios & Steps
Scenarios are sequences of steps that result in captured assets. They can be recorded interactively or written manually.
Scenario Structure
{
"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
Step Examples
Navigation
{ "action": "goto", "url": "/dashboard" }Click
{ "action": "click", "selector": "[data-testid='submit-btn']" }Type
{ "action": "type", "selector": "#search", "text": "documentation" }Hover (for menus)
{ "action": "hover", "selector": "[data-testid='dropdown-trigger']" }Wait (fixed delay)
{ "action": "wait", "ms": 1000 }Wait For Element
{ "action": "waitFor", "selector": ".loading-complete", "timeout": 5000 }Capture
{ "action": "capture", "key": "settings-page" }Selectors
Poliage supports multiple selector formats:
Prefer data-testid attributes for the most stable selectors that won't break when styles change.
Scenario Options
{
"name": "checkout-flow",
"timeout": 60000,
"viewport": {
"width": 1920,
"height": 1080
},
"steps": [...]
}Scenario-level settings override global config.