# Objs Test Recorder (Chrome extension)

Manifest V3 extension bundled with **Objs 2.4**. It injects Objs into the **page MAIN world** (`lib/objs-inject.js` + `bridge.js`).

- **Tests** are stored as **JavaScript** from `o.exportTest()` (same idea as **Export Objs test** in the [recording example](../examples/recording/index.html)). Edit that script in the accordion textarea.
- **Play** runs the exported script with `o.test` (sync) or **legacy JSON** via `o.playRecording`. When a run finishes, the page shows the same **`o.testOverlay()`** panel as the [recording example](../examples/recording/index.html). The **Show succeeded** checkbox sets **`o.tShowOk`** before the run (whether passed steps get “OK” lines in the log / overlay).
- **Stop** after recording updates both the script and an internal snapshot for `recordingSnapshot` (Playwright export).
- Each test has **Observe root** (selector) and **`o.autotag`** (default `qa` → `data-qa`), applied on Record / Play in the page before Objs runs.

The Objs project does **not** publish this to the public Chrome Web Store. Package it for your org (zip, private store, policy).

## Load unpacked (development)

1. Run `npm run build` at the repo root so `lib/objs-inject.js` matches `objs.js`.
2. Open `chrome://extensions`, enable **Developer mode**, **Load unpacked**, select this **`objs-extension`** folder.
3. Open a normal **http(s)** tab. Open the extension **popup** — tab resolution uses the **browser** window, not the popup.

## Enterprise packaging

- Zip the contents of `objs-extension/` for internal distribution.
- Adjust `manifest.json` **host_permissions** if `<all_urls>` is too broad for your policy.
- Sign or deploy via Chrome policy / internal store per your IT guidelines.

## Files

| File | Role |
|------|------|
| `manifest.json` | MV3 manifest (`tabs` permission for reliable tab URL resolution) |
| `background.js` | Service worker: inject Objs, `getTargetTabId`, messaging |
| `sidepanel.html` / `sidepanel.js` | Accordion UI per test |
| `bridge.js` | `stopAndExport`, `runExportedTest`, `playRecording`, etc. |
| `lib/objs-inject.js` | Generated by `npm run build` — do not edit by hand |
