# Repeatable browser checks

Capture an app once and give both reviewers the same screenshots, interaction results and build identity. Reviewers can then explore that captured app independently.

## Use it

1. In **Hybrid Workflow settings → Reviewer browser**, install browser support or enable an existing local Playwright installation.
2. Ask your implementation agent: **“Add repeatable browser checks for the changed UI states, then run them before review.”**
3. The agent defines `package.json` → `hybrid.browser` and calls `hybrid_checkpoint` with `action: "browser"`. Current evidence is attached automatically to planning, design and code reviews.

This is optional per project. It supports static pages and existing static frontend builds with explicit API fixtures. **It does not test a live backend, SSR server, production account or database.** For those, keep the application's existing integration tests and provide relevant browser evidence through the ordinary `images`/`checks` fields. Do not convert an application to static export just to use this adapter.

## A small scenario

Merge this into the project's existing `package.json`:

```json
{
  "hybrid": {
    "browser": {
      "version": 1,
      "root": "public",
      "scenarios": [{
        "id": "mobile-navigation",
        "viewport": { "width": 390, "height": 844 },
        "steps": [
          { "action": "navigate", "path": "/" },
          { "action": "click", "locator": { "role": "button", "name": "Menu" } },
          { "action": "assertVisible", "locator": { "role": "link", "name": "Contact" } },
          { "action": "assertNoOverflow" },
          { "action": "capture", "label": "Mobile menu open" }
        ]
      }]
    }
  }
}
```

Without a build step, every asset must match current Git-visible source. For an existing static build, use `"root": "dist", "build": "build"`; this runs the project's existing `pnpm run build`. Output must be ignored by Git and cannot contain tracked source. If that build also creates intermediates, declare `"buildOutputs": [".next"]` or the applicable `node_modules/.vite` / `node_modules/.vite-temp` directories. These must also be ignored and contain no tracked source. Other source, configuration, ignored inputs and installed dependencies remain part of the input identity.

Builds require normal planning/design approval. Before approval, an existing tracked static app can be captured without building; otherwise supply baseline screenshots using the implementation browser. A missing static adapter is not itself a product defect.

## Fixture responses and recovery states

Optional `fixtures` supply deterministic responses without contacting a server:

```json
{
  "path": "/api/quotes",
  "method": "POST",
  "responses": [{ "status": 409, "body": "{\"conflict\":true}", "delayMs": 250 }]
}
```

Responses advance in order and repeat the final response. Methods are GET, POST, PUT, PATCH and DELETE. Redirect responses are rejected. Optional `contentType` defaults to JSON. Fixtures match exact path/query and method; they do not validate backend logic or request bodies.

Each scenario gets a fresh browser. Optional `storage` seeds disposable localStorage strings for recovery tests. `spaFallback: true` serves the captured index for otherwise missing navigation paths. Undeclared API requests fail; they never reach a live service.

Locators use `role` plus accessible `name`, `testId`, or `css`. Actions are `navigate`, `reload`, `click`, `fill`, `press`, `select`, `assertText`, `assertVisible`, `assertHidden`, `assertCount`, `assertURL`, `assertNoOverflow`, and `capture`. Every scenario starts by navigating and contains an assertion and a labeled capture. Choose cases for distinct risks; no screenshot-count or scenario-count quota is imposed.

## What the evidence means

- Screenshots and assertion results identify the exact source/build, scenario, viewport and browser version. Animations are disabled during screenshots.
- Changed source, dependencies, environment inputs or output makes prior evidence stale. A failed new attempt supersedes an earlier success.
- A partial or failed run remains failed even if it produced screenshots. Pixel hashes establish identity, not visual quality or behavioral correctness.
- Both reviewers get the same saved captures. `browser_scenario` starts a fresh declared scenario; reviewers navigate and perform its actions themselves, then explore relevant gaps.
- Browser results never grant approval. The existing reviewer finding and approval rules remain in force.

## Browser and research boundaries

Firefox, Chrome and Edge are supported through the local Playwright installation. The managed installer provides Firefox. WebKit and arbitrary browser MCP commands are not supported by this adapter. Existing user browser sessions and implementation MCP configuration are not changed.

The captured app uses `http://hybrid.invalid`. Assets and fixtures are fulfilled locally; other requests are denied. Service workers, WebSockets, WebRTC and QUIC/WebTransport are blocked. Chromium also uses protocol offline mode. Firefox uses interception and a mandatory deny proxy because its offline mode rejects fulfilled navigation. `navigator.onLine` is simulated as true for the fixture app; real offline behavior is not tested. This is a browser-tool boundary, not an operating-system sandbox for malicious native code. The build script remains the project's normal trusted command.

Reviewers no longer browse arbitrary live URLs or issue general web-search queries with project evidence. `hybrid_public_document` supplies a fixed catalog of public documentation IDs, including React, Next.js, Playwright, Vitest, WCAG and web design guidelines. The tool sends no model-written URL, query or body; text ranges are selected locally. For other documentation, provide the relevant content through the implementation agent. Source lookup remains available. Known credential/private-key markers and private asset paths are rejected, but this is not a comprehensive secret scanner: use only disposable fixture data.
