AI semantic test oracle for Playwright. Your test goes green; Visual Reviewer independently answers: did the software actually do what this test was intended to verify? — and shows its evidence when the answer is no.
Advisory-only by design: it never fails your CI on its own.
✓ checkout.spec.ts > user upgrades subscription 7/7 assertions passed
🚨 visual-reviewer: REGRESSION (87%)
POST /api/subscription returned {"success":false}
UI contains "Payment could not be completed"
npm install -D visual-reviewerRequires Node ≥ 20 and an API key for any OpenAI-compatible provider. The default judge is deepseek/deepseek-v4.1-flash via OpenRouter, a multimodal model that is inexpensive to run (see OpenRouter for current pricing). If your OpenRouter account restricts models with a guardrail, the model must be on its allow-list.
export OPENROUTER_API_KEY=sk-or-...import { defineConfig } from "@playwright/test";
export default defineConfig({
reporter: [
["list"],
["visual-reviewer/reporter", {
// all optional:
outputDir: ".visual-reviewer",
model: "deepseek/deepseek-v4.1-flash", // any OpenRouter model id
baseURL: "https://openrouter.ai/api/v1", // or Ollama, OpenAI, vLLM…
maxScreenshots: 6, // cost knob
judge: true, // run oracle after the run
}],
],
});A Playwright reporter can't see network bodies, console output or accessibility trees — so either use the drop-in test:
import { test, expect } from "visual-reviewer/playwright";
test("user upgrades subscription", async ({ page }) => {
// …your normal test…
});…or keep your own imports and attach the collector manually:
import { test as base } from "@playwright/test";
import { attachEvidenceCollector } from "visual-reviewer";
const test = base.extend({
vrCollector: [async ({ page }, use, testInfo) => {
const collector = await attachEvidenceCollector(page, testInfo);
await use(collector);
await collector.flush();
}, { auto: true }],
});npx playwright testAfter the deterministic run, each captured test is judged. Verdicts print in the terminal; evidence reports land at .visual-reviewer/**/report.md (+ report.html per test) with a run index at .visual-reviewer/report.html.
Evidence comes from two sources, used together when available:
- Trace parsing — any suite with
trace: 'on'gets network bodies, action timeline, DOM snapshot and screencast screenshots extracted fromtrace.zip, no fixture needed. - The capture fixture (
visual-reviewer/playwright) adds live network/console/a11y observations.
Each judged run persists a history record; the next judgement of the same test receives the previous verdict and previous screenshot as semantic baseline ("did the UI change in ways inconsistent with intent?"), not pixel diffing. Disable with --no-baselines or baselines: false.
If the first pass is UNCERTAIN or below followUpThreshold (default 0.7), the oracle may request up to 3 specific additional pieces of evidence (network bodies by URL, console events, DOM snapshot, screenshot by index, action timeline). Requests are resolved deterministically against the local bundle and the round is capped at one. Disable with followUps: false.
When several tests in a run receive REGRESSION/FAIL verdicts, they often share one root cause. Verdicts are grouped by shared failure signatures — failing endpoints (POST /api/payment → 500), error-level console messages, uncaught page exceptions — and surfaced as "likely root causes" in the run summary, the HTML run index, and the GitHub step summary:
Clustering: 4 material verdict(s) → 1 likely root cause(s)
🔗 POST /api/payment → 500
3 test(s): upgrade subscription, renew plan, buy gift card
Clustering is deterministic (no extra model calls). Every judgement also persists a machine-readable verdict.json next to its report, so you can re-cluster offline at any time:
npx visual-reviewer clusters # reads .visual-reviewer/**/{bundle,verdict}.jsonPut team knowledge in .visual-reviewer/expectations.md — known issues, environment quirks, conventions — and it is injected into the oracle's system prompt:
- KNOWN ISSUE #42: the payment API fails in staging and the UI shows both success text and the error banner. Report PASS and reference KNOWN ISSUE #42.Override the location with expectationsFile.
Inside GitHub Actions, verdicts are appended to the job summary ($GITHUB_STEP_SUMMARY) as a table, and REGRESSION/FAIL verdicts emit ::warning annotations. They never fail the job.
The oracle talks to any OpenAI-compatible endpoint through the Vercel AI SDK. Swap two strings:
| Provider | baseURL | model | key env |
|---|---|---|---|
| OpenRouter (default) | https://openrouter.ai/api/v1 |
deepseek/deepseek-v4.1-flash |
OPENROUTER_API_KEY |
| OpenRouter (stronger) | same | qwen/qwen3-vl-235b-a22b-instruct |
OPENROUTER_API_KEY |
| Ollama Cloud | https://ollama.com/v1 |
deepseek-v4.1-flash |
OLLAMA_API_KEY (--api-key-env OLLAMA_API_KEY) |
| OpenAI | https://api.openai.com/v1 |
gpt-4o |
OPENAI_API_KEY (--api-key-env OPENAI_API_KEY) |
| Ollama (local) | http://localhost:11434/v1 |
qwen3-vl:30b |
none needed |
Env-var equivalents: VISUAL_REVIEWER_MODEL, VISUAL_REVIEWER_BASE_URL, VISUAL_REVIEWER_API_KEY_ENV (the name of the variable holding the key), VISUAL_REVIEWER_OUTPUT_DIR. An empty value counts as unset, so the default applies; to turn the judge off, use judge: false or leave the key variable unexported.
To judge with Ollama Cloud instead of OpenRouter, set VISUAL_REVIEWER_BASE_URL=https://ollama.com/v1, VISUAL_REVIEWER_MODEL=deepseek-v4.1-flash and VISUAL_REVIEWER_API_KEY_ENV=OLLAMA_API_KEY, then export OLLAMA_API_KEY. Ollama Cloud names models without the provider prefix.
Bundles are persisted even if you set judge: false, so you can judge later / selectively / with a different model:
npx playwright test --reporter=list # capture only
npx visual-reviewer judge --model qwen/qwen3-vl-235b-a22b-instruct- run: npx playwright test
- uses: actions/upload-artifact@v4
if: always()
with: { name: visual-reviewer, path: .visual-reviewer/ }Exit codes are untouched by verdicts. Judge infrastructure errors exit 2.
- PASS — evidence supports the intent, nothing contradictory.
- REGRESSION / FAIL — evidence shows the intended outcome did not occur.
- UNCERTAIN — insufficient or contradictory evidence. First-class result, never hidden.
Every report cites evidence ids, distinguishes observation from interpretation, and suggests a next investigation step.
Playwright (reporter + evidence fixture)
↓
EvidenceBundle ← framework-agnostic typed observations (images are not special)
↓
Context builder ← curated dossier, not a firehose (screenshots capped, non-2xx first)
↓
Oracle (Vercel AI SDK → any OpenAI-compatible model)
↓
Verdict JSON (zod-validated) → Evidence report (Markdown)
No Playwright concepts exist outside src/playwright/. A second adapter (Appium, Selenium…) would only translate its artifacts into an EvidenceBundle.
Beyond Playwright, any harness can feed the same oracle through the adapter layer (src/adapter/). A concrete FrameworkAdapter translates a native harness's artifact export into the canonical AdapterArtifacts shape; the shared bundle builder writes it to a reviewable EvidenceBundle (screenshots and state dumps under files/), so a native run flows through the same context → oracle → report pipeline.
Two adapters are included (Phase-3 roadmap):
- Appium (
appiumAdapter) — iOS/Android. Reads anappium.jsonmanifest: tap/action steps with screenshots, in-step visibility hierarchies, network/console/log events, and assertion events. - XCTest / XCUITest (
xctestAdapter) — Apple native. Reads anxctest.jsonmanifest: UI hierarchy snapshots, screenshots, logs, attachments (video), and assertion events.
parseAppium / parseXCTest translate manifests entirely offline. The context builder renders native_ui_tree, native_state, and user_action evidence natively, so the oracle judges native output with the same evidence-backed reasoning as web output.
Because every adapter produces an EvidenceBundle, the same intent run on several harnesses can be grouped (src/cross/). Bundles are keyed by their intent — the test's first title segment, platform-independent — and each group reports which platforms agree, which diverge, and each platform's deterministic status:
import { groupPlatformRuns } from "visual-reviewer";
const groups = groupPlatformRuns(bundlePaths); // { intentTitle, runs, allPassed, divergent }divergent is true when at least two harnesses disagree on pass/fail for the same intent — an early signal that a cross-platform regression slipped past green tests.
See VISUAL_REVIEWER_PRODUCT_BRIEF.md for the full product brief.
v0.2. Implemented: Playwright adapter + evidence fixture, trace.zip parsing (network/console/DOM/screenshots), agentic follow-up evidence requests, semantic baseline comparison, flakiness signal from verdict history, HTML/Markdown evidence reports with run index, GitHub CI surfacing, project expectations (org memory), human feedback loop, benchmark harness, regression clustering, native adapters (Appium + XCUITest), cross-platform consistency grouping.
Remaining vs the roadmap: autonomous reproduction/debugging.