
TestivAI
ai.testiv由 testiv.ai 发布v0.9.3更新于 Nov 7, 2026
Local-first visual regression for AI agents: verdicts, diff images, explain_snapshot. No API key.
概览
本地优先的视觉回归 MCP 服务器,为 AI 编码代理提供网页 UI 变更的截图差异判定、差异图片和快照解释。
- 可以做什么
- 读取本地报告中的视觉回归结果,包括每个快照的差异百分比和 DOM 变更摘要
- 获取差异图片,让代理查看页面上具体改动了什么
- 解释快照,向代理提供分层证据,例如发生位移的选择器、仅样式变更和整页位移,叙述由代理自己的模型撰写
- 给出区分渲染噪声与真实结构或样式变更的噪声感知判定
- 适用场景
- 当 AI 代理修改 UI 代码后需要确认页面外观时使用,读取机器可读结果和差异图片以便自我修正。适合已在本地或 CI 中运行 TestivAI 截图、希望代理解读结果而不依赖托管 AI 服务的团队。
- 运行要求
- 以本地 stdio 进程运行 npm 包,需要 Node.js。无需账号、API 密钥或网络访问。它处理的是 TestivAI 截图产生的结果,这需要浏览器(例如带 Chromium 的 Playwright)以及项目中的基线。
安装
在 SourceWeft 中
- 打开 控制台中的 TestivAI,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
TestivAI Open Source
[@testivai/witness] [@testivai/witness-playwright] [@testivai/witness-webdriverio] [License: MIT]
Local-first visual regression testing SDKs for modern web applications.
This is the home of TestivAI. It contains everything you need to capture, diff, and report visual regressions fully locally — MIT-licensed, no account, no server.
See a live report → — a real TestivAI OSS report rendered in your browser, straight from CI. No install, no signup.
[Real TestivAI report — style-only-change verdict, selector-attributed regions, heatmap diff]
Why TestivAI?
Pixel-only visual testing drowns you in false positives — a font re-hint or an anti-aliasing shift across machines lights up as a "change," and you spend your time re-approving noise.
TestivAI pairs the screenshot with a snapshot of the page DOM (every adapter and the crawler capture one by default; the experimental testivai run sidecar does not) and, from most test-framework adapters, a digest of every element's computed styles. When pixels differ but the DOM and the computed styles are identical and the diff is small and scattered, the report labels the diff likely render noise instead of crying wolf. When the DOM and styles match but the diff sits in one area, it says that too: the style check covers a fixed list of properties, not size, overflow, transform or images, so that is a bad capture or a real change, not noise. It still shows the diff; it tells you what it most likely is. When only the styles changed, it says so: a style-only change is real. When the styles could not be compared, it says styles not compared and does not call the diff noise, because a stylesheet-only change is not ruled out. When the DOM actually changed, you see exactly what (2 added, 1 removed). That layered signal is the difference between a flaky test wall and a report you trust.
- Fully local, no account — captures, diffs, and a self-contained HTML report all stay on your machine.
- DOM + style-aware noise hint — tells likely render jitter from real changes, and catches the stylesheet-only case. When both captures carry an element map (the Playwright JS/TS, WebdriverIO, Selenium and Ruby adapters record one), an identical DOM with changed computed styles reads as "Styles changed on
button.cta", never as noise. Without an element map on both sides (thetestivai witness <url>crawler, playwright-python, playwright-java), computed styles are not compared, and an identical-DOM diff reads "styles not compared", not "likely render noise". - Auditable masks & region-level diffs — exclude dynamic areas (selectors or coordinates) with the masked region hatched in the diff, and get "3 changed regions" with bounding boxes instead of a raw pixel percentage.
- Element attribution & exact shift detection — the report names which element changed ("
div.card:nth-of-type(2)shifted +8px vertically — content unchanged") and spots the injected-banner case ("everything below y=80 moved +24px"), derived from layout, not pixel guesswork. No local-first tool does this. - First-class adapters — Playwright (TS/JS and Python, Java experimental) and WebdriverIO, using each framework's native APIs; every language shares one set of baselines and one report.
- Mobile web, no extra package — Playwright device emulation works through the same
witness()call: one project per device profile, baselines keyed per device automatically, and the DOM and computed-style attribution survives emulation, so a change behind a@mediaquery is caught on mobile and correctly passes on desktop. See the mobile web guide. - PR-native workflow — a GitHub Action posts the diff and approves baselines from a
/testivai approvecomment, and a companion action can publish each run's report to the repository's GitHub Pages, linked from the comment. - No lock-in — MIT license, baselines live in your git, and
results.jsonis a semver-governed public contract.
Evaluating this for a team? Maintenance & roadmap covers who builds it, the release cadence, and what happens to your setup if maintenance ever stops.
Already using Playwright's
toHaveScreenshot()? It's good, and if a pixel diff answers your question you should keep using it. Here's an honest look at what TestivAI adds and when it isn't worth the dependency.
Eyes for your coding agent
If an AI agent (Claude Code, Cursor, Copilot, …) writes your UI code, someone still has to check what the UI looks like — and it shouldn't be you, one screenshot at a time. TestivAI is built to be that check:
- No account, no API key, no network — an agent can run it inside any sandbox without you provisioning secrets.
- Machine-readable output — every run writes
visual-report/results.json(a semver-governed schema) with per-snapshot diff percentages and DOM change summaries, so an agent can read the result and self-correct. - Noise-aware verdicts — the DOM and computed-style checks tell the agent whether a pixel diff is likely render noise (identical DOM, styles compared and identical, a small and scattered diff), a concentrated or large diff (identical DOM and styles, but the diff sits in one area or covers over 1% of pixels: a bad capture or a change the style check does not cover), a style-only change (identical DOM, restyled elements), a real structural change (
2 added, 1 removed), styles not compared (identical DOM, but no style data to compare, so a stylesheet-only change is not ruled out), or an unhealthy capture (a web font or stylesheet failed to load, so the image is not the page as built: never noise, never a baseline). It doesn't chase anti-aliasing ghosts, and it doesn't label a diff it couldn't check as noise. - Explanations, bring-your-own-model — the MCP
explain_snapshottool hands your agent layered evidence (which selectors shifted vs changed, whole-page shift detection, style-only changes) and your model writes the narrative: "card #2 shifted +24px — likely the banner injected above it." No hosted AI service in the loop. - Human approval stays in the PR — the agent iterates locally; you approve baselines with one
/testivai approvecomment.
Paste this into your project's AGENTS.md / CLAUDE.md to wire it up (full guide with MCP setup, a real agent transcript, and the approval rule: docs/guides/ai-agents.md). In Claude Code, the testivai-report plugin shows the report itself in the app, screenshots included (/plugin install testivai-report --marketplace testivai/testivai-oss):
Packages
Live versions are shown by the badges at the top of this README.
Plus:
action/— GitHub Action for PR-based visual approvalsexamples/— minimal real-world example projectsexamples/site-check/— an hourly GitHub Actions check that fails when a page is up but broken (stylesheet, script or font missing, JavaScript error, blank page), with one issue per outage. testiv.ai runs it on itself.
docs/— public documentatione2e/— OSS smoke E2E test suite
No test suite? One command.
AI-built and vibe-coded apps (Lovable, Bolt, v0, ...) usually ship with zero tests. You still get the full safety net:
TestivAI launches a headless Chrome, discovers your pages (or takes
--pages "/,/pricing"), and captures a screenshot and the DOM of each one.
Baselines, pixel and DOM diffs, the HTML report and PR approvals work as
below, no test framework required. The crawler records no element map, so
computed styles are not compared: a pixel diff with an identical DOM reads
styles not compared (could be render noise or a stylesheet-only change),
never likely noise, and there is no selector attribution or page-shift
detection. See the vibe-coded apps guide.
Quick Start (Playwright, Local Mode)
First run: baselines are written to .testivai/baselines/.
Later runs: screenshots are diffed and a self-contained HTML report is written to ./visual-report/.
What you get out of the box (free, no account)
- Full-page screenshot capture via Playwright
- Stabilized captures by default — animations/transitions frozen, caret hidden, web fonts awaited (the top causes of flaky visual tests, neutralized before every screenshot)
- Local pixel diff with configurable threshold
- Tunable pass criteria, all opt-in —
maxDiffPercent/maxDiffPixelstolerances,shiftTolerancefor pure element shifts, andnoiseAutoPass, which passes a diff only when the DOM is identical, the computed styles were compared and match, and the diff is not concentrated in one area (never one whose styles were not compared). Nothing auto-passes until you configure it, and auto-passed snapshots stay labeled in the report ignoreSelectorsandmaskfor dynamic content such as timestamps (global or per-snapshot): stabilization does not hide changing content, so you list it- Self-contained HTML report (
visual-report/index.html) - Machine-readable results (
visual-report/results.json) - Committed baselines under
.testivai/baselines/(justgit addthem)
CI Integration (GitHub Actions)
Copy this single workflow file into your repository. It handles both running the visual regression tests and processing /testivai approve commands from PR comments — no extra secrets, no external services required.
The ai-triage job runs on every pull request with a changed or new
snapshot or a missing baseline (unless .testivai/config.json sets
failOnMissing: false) once an ANTHROPIC_API_KEY secret is set (or a
CLAUDE_CODE_OAUTH_TOKEN secret, passed as claude-code-oauth-token), and
posts one advisory comment: which diffs look like glitches, which
match the PR, and which look like bugs. It never changes the check or a
baseline. See AI triage of every diff.
Reports on GitHub Pages
Instead of a ZIP to download, the comment can link the report itself: the
testivai/testivai-oss/publish@v1 action publishes each pull request's last
runs, forks included, and the default branch's latest run to the repository's
GitHub Pages site, and adds the links to the comment. Each page is rebuilt from
the run's checked results.json and PNGs. Who can open the site is GitHub's
Pages setting: a private repository's reports go on a public site only when
an admin says so. It replaces the repository's whole Pages site; when that
site is your website, pass the built site as site-dir and the reports go
under a path of it (reports-path, since v1.6.0). See
Reports on GitHub Pages.
Approve changed baselines
After CI posts the diff report on your PR, review the testivai-visual-report artifact, then comment:
What happens:
- Action verifies you have write access to the repository (others get a polite rejection)
- Downloads the
testivai-visual-reportartifact from the latest CI run on your branch - Copies approved screenshots into
.testivai/baselines/and commits them to your PR branch - Posts a confirmation comment listing what was approved and from which CI run, with a link to that run's report when it is published on GitHub Pages (publish@v1)
- CI runs again on the new commit — approved snapshots now pass
Step 5 needs a token other than GITHUB_TOKEN: GitHub starts no workflow run for a push made with GITHUB_TOKEN. Give the approve step a fine-grained personal access token (github-token: ${{ secrets.TESTIVAI_APPROVE_TOKEN || secrets.GITHUB_TOKEN }}), or push another commit after approving. See Approve with a token that re-runs CI.
What the PR comment looks like
Real-World Example
A complete, minimal consumer project lives at testivai-example: a static page, three witness() calls, the PR /testivai approve flow, and a live report on Pages, published with publish@v1 beside the reports of main and each open pull request — all against the published packages.
Repository Layout
Development
Contributing
Bug reports, feature requests, and PRs welcome. Please see:
Releases
Releases are published to npm under the latest dist-tag, with provenance
attestations. The flow is Changesets-driven: a PR that changes a published
package adds a changeset, merging it opens a "version packages" PR collecting
the pending bumps, and merging that publishes. See
.changeset/README.md for the contributor side and
.github/workflows/release.yml for the
workflow itself.
Attribution
This repository was extracted from the private TestivAI monorepo with a clean initial git history. Original development history is preserved internally; this public repository is the new source of truth for the SDKs going forward.
License
MIT — see LICENSE.
来源:README.md,提交 d83763b
工具
0版本历史
8- v0.9.3最新Nov 7, 2026
- v0.9.2Nov 4, 2026
- v0.9.1Nov 3, 2026
- v0.9.0Oct 19, 2026
- v0.8.3Oct 18, 2026
- v0.8.2Oct 18, 2026
- v0.8.1Oct 17, 2026
- v0.5.7Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分