<!-- https://testapilocally.com/docs/core-features/monitors-scheduler/ -->
# Monitors & scheduler

Local monitors schedule collection runs on a heartbeat while the Signoff UI is open. Definitions can sync with the workspace as Git-friendly `runner/schedules.json`; last-run status stays machine-local.

**Important:** Schedules **only fire while the app or VS Code Signoff panel is open**. For always-on monitoring, use the **Windows app** (Microsoft Store build recommended).

---

### Create & edit schedules

* **Platform Availability:** Partial (UI Full Parity; always-on / desktop notify prefer Windows)
* **Overview:** Create once / daily / weekly / monthly / cron schedules bound to a collection (or folder) target, environment, and timezone. Enable/disable without deleting the definition.
* **How It Works (Windows App):**
  1. Open **Runner** → bottom dock **Monitors** (split view).
  2. Create a schedule: name, recurrence (or cron), timezone, environment, target collection/folder.
  3. Save and leave SignOff Studio running so the 30s heartbeat can fire due runs.

![Windows monitors split view](/docs/assets/screenshots/windows/windows-monitors-split-view.png)

* **How It Works (VS Code Extension):**
  1. Open Runner → **Monitors** in the shared webview.
  2. Configure the same fields (Environment dropdown + searchable timezone picker).
  3. Keep the SignOff Studio editor tab/panel open; closing VS Code pauses fires.

![VS Code monitors split view](/docs/assets/screenshots/vscode/vscode-monitors-split-view.png)

* **Code / Configuration Examples:**

```json
{
  "id": "sched_smoke_daily",
  "name": "Daily smoke",
  "enabled": true,
  "rule": { "type": "daily", "at": "09:00" },
  "timezone": "Asia/Kolkata",
  "environmentId": "env_httpbingo",
  "target": { "collectionId": "col_starter" }
}
```

Cron example:

```text
0 */6 * * *
```

* **Edge Cases, Troubleshooting & Pro-Tips:**
  - Invalid cron is rejected up front — fix the expression before enabling.
  - If the environment was deleted, the schedule shows attention: pick another env and save.
  - Missed runs while the UI was closed are counted locally; they do not backfill automatically.

> **GAP IDENTIFIED:** Failure **desktop notifications** are Windows Only. VS Code acknowledges schedules in webview mode (`runner.schedule` → `mode: "webview"`) but does not run extension-host cron. Prefer the Windows Store app for unattended monitors.

---

### Environment & timezone pickers

* **Platform Availability:** Full Parity (UI)
* **Overview:** Every schedule pins an environment and a searchable IANA timezone so `{{vars}}` and wall-clock rules stay explicit across laptops.
* **How It Works (Windows App):**
  1. In the schedule editor, open **Environment** and pick from workspace envs.
  2. Open the timezone picker; type to filter (e.g. `Kolkata`, `UTC`, `New_York`).
  3. Save — next fire uses that env snapshot resolution path.

![Windows monitors env/tz](/docs/assets/screenshots/windows/windows-monitors-split-view.png)

* **How It Works (VS Code Extension):**
  1. Same Environment dropdown and searchable timezone control.
  2. Ensure the workspace with those env files is the active Signoff workspace.
  3. Switch workspace → re-open Monitors and confirm targets still resolve.

![VS Code monitors env/tz](/docs/assets/screenshots/vscode/vscode-monitors-split-view.png)

* **Code / Configuration Examples:**

```text
timezone: Asia/Kolkata
environment: httpbingo
```

* **Edge Cases, Troubleshooting & Pro-Tips:**
  - DST shifts: prefer explicit IANA zones over fixed UTC offsets in the UI.
  - Attention reason **Open the workspace this schedule belongs to** means the schedule’s workspace root is not loaded.

---

### Runtime while open & Store recommendation

* **Platform Availability:** Partial — copy shown on both; Windows recommended for always-on
* **Overview:** SchedulerService heartbeats about every 30s inside the webview. No fire path exists when the UI is closed. Product copy recommends the Microsoft Store Windows app when monitors must keep running.
* **How It Works (Windows App):**
  1. Leave SignOff Studio open (minimize is fine).
  2. On failure, desktop notify can surface (Windows).
  3. Install from Microsoft Store when you want a durable always-available desktop host.

![Windows runner main](/docs/assets/screenshots/windows/windows-runner-main.png)

* **How It Works (VS Code Extension):**
  1. Leave the Signoff webview open in a VS Code window.
  2. Read the in-product Store recommendation if you need always-on.
  3. For CI periodicity, use CLI/`cron` OS schedulers instead of in-app monitors.

![VS Code runner main](/docs/assets/screenshots/vscode/vscode-runner-main.png)

* **Code / Configuration Examples:**

```bash
# CI alternative to in-app monitors
npm run runner -- run -c ./smoke.signoff.json -e ./ci.signoff.env.json --reporters junit -o ./reports --bail
```

* **Edge Cases, Troubleshooting & Pro-Tips:**
  - Sleeping laptops pause heartbeats — use a plugged-in always-on machine for production monitors.
  - Network failures must show a readable connection message **and** the endpoint URL.

> **GAP IDENTIFIED:** In-app monitors are not a substitute for OS/`cron`/CI schedulers when the IDE or app is closed. Windows App (+ Store) is the supported always-on path; VS Code is best-effort while the panel remains open.

---

## Related

- [Runner](/docs/runner/)
- [Load testing](/docs/core-features/load-testing/)
- [Parity & gap report](/docs/parity-and-gap-report/)
