# Otto Browser Test Agent

This runner executes browser steps embedded in the Otto test plans under `otto/docs/test-plan/`.

## Setup
1. Install dependencies:
   - `npm install`
2. Install Playwright browsers:
   - `npx playwright install`

## Run
- Run all plans:
  - `node ./src/run.js --all`
- Run a single plan:
  - `node ./src/run.js --plan TEST-01`

### Options
- `--base-url` (default: `http://localhost`)
- `--headed` (run non-headless browser)
- `--timeout` (step timeout in ms)

## Browser Step Format
Add a fenced YAML or JSON block containing `browser_steps` to the test plan file:

```yaml
browser_steps:
  - action: navigate
    url: "/otto/setup"
  - action: click
    selector: "button[type='submit']"
    optional: true
    waitForNavigation: true
  - action: expectText
    selector: "body"
    value: "Otto Dashboard"
```

### Supported actions
- `navigate` (`url`)
- `click` (`selector`, optional: `optional`, `waitForNavigation`)
- `fill` (`selector`, `value`, optional: `optional`)
- `select` (`selector`, `value`, optional: `optional`)
- `expectText` (`selector`, `value`)
- `expectVisible` (`selector`)

### Results
Reports are written to `tests/otto/browser-agent-results/`:
- JSON report per test
- Markdown summary per test
