Token导航 LogoToken导航

Agent Skill · 开发

visual-regression-testing(视觉回归测试)

用于辅助界面设计、视觉规范、排版、配色、布局和交互体验优化。它适合让 Agent 根据产品场景整理页面结构、生成 UI 方案、检查视觉一致性或改进组件层级。使用时需要结合现有品牌、设计系统和用户任务,不应只堆装饰元素;涉及真实页面改动时,应通过截图或浏览器预览检查文本溢出、对齐和响应式表现。

visual-regression-testing 是开发类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为操作浏览器;许可证为 MIT,第三方扫描已通过,按安装量在开发类的 21,746 个 Skill 里排第 13,072。

总安装 1,023周安装 41GitHub Stars 20下载 331核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
MIT

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:visual-regression-testing(视觉回归测试)
来源仓库:https://github.com/jgtolentino/insightpulse-odoo
仓库路径:skills/visual-regression-testing
安装命令:
npx skills add https://github.com/jgtolentino/insightpulse-odoo --skill visual-regression-testing
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/jgtolentino/insightpulse-odoo --skill visual-regression-testing

这个 Skill 是做什么的

开发类 Skill 面向写代码、改代码和排查问题,一般会读写仓库文件,部分还会执行构建或测试命令。

visual-regression-testing 用于界面视觉一致性检查,适合发现布局错位或样式异常。适用于 Web 应用与移动端 UI 的版本比对。需结合截图工具与浏览器预览验证实际效果。不应仅依赖自动化检测,需人工复核关键页面。

适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

来源仓库内路径:skills/visual-regression-testing

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/jgtolentino/insightpulse-odoo --skill visual-r…;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要操作浏览器,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

visual-regression-testing 怎么安装?

在终端执行 npx skills add https://github.com/jgtolentino/insightpulse-odoo --skill visual-regression-…。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

visual-regression-testing 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

visual-regression-testing 需要什么权限?

权限级别是操作浏览器。该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

visual-regression-testing 是免费的吗?

来源标注的许可证是 MIT。本站不代收任何费用,也不托管安装包;能否商用、要不要署名,以许可证原文为准。

visual-regression-testing 用的人多吗?

公开数据是累计安装 1,023 次,近一周安装 41 次,下载 331 次,GitHub 20 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

visual-regression-testing 安全吗?

第三方扫描结果为通过,但这只覆盖已知的静态检查项,不能替代自己读一遍源码和安装命令。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。
  • 3 个目录同时收录,说明这个 Skill 流传比较广。
  • 许可证明确为 MIT,商用和分发边界好判断。
  • 第三方扫描已通过,常见的高风险行为没有命中。

先想清楚的地方

  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理开发类任务、又不想每次都手写提示词的人。
  • 需要许可证清楚、并且有第三方扫描结果的团队项目。

不太适合

  • 需要厂商级技术支持和 SLA 的生产系统。

开发类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
skill-vetter

技能审查员 · OpenClaw

8,779,018986操作浏览器MIT-0通过
ontology

本体论 · OpenClaw

6,636,960576只读MIT-0通过
entra-app-registration

内部应用程序注册 · Codex、Claude

6,631,872764接触敏感数据未明确通过
entra-app-registration

内部应用程序注册 · Codex、Claude

3,757,680201接触敏感数据未明确通过
nano-banana-pro

纳米香蕉专业版 · OpenClaw

3,526,898364接触敏感数据MIT-0有提醒
visual-regression-testing

视觉回归测试 · 本页

1,02320操作浏览器MIT通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Visual Regression Testing

This skill provides comprehensive visual regression testing capabilities to detect unintended visual changes in UI components and prevent visual bugs from being merged into production.

Overview

Visual regression testing works by:

  1. Taking screenshots of components/pages in a known-good state (baselines)
  2. Taking new screenshots after code changes
  3. Comparing new screenshots with baselines pixel-by-pixel
  4. Flagging differences for human review

Framework: Playwright + jest-image-snapshot Approach: Based on Ant Design's visual regression testing methodology

Core Capabilities

1. Screenshot Baseline Management

Create and update baseline screenshots that serve as the source of truth for visual comparison.

Implementation: tests/shared/imageTest.tsx

Key features:

  • Automated baseline capture for all component demos
  • Version-controlled baseline storage
  • Easy baseline updates when intentional changes occur
  • Support for multiple viewport sizes and themes

2. Visual Comparison Testing

Implementation: scripts/visual-regression/

Core testing workflow:

// Example structure from tests/shared/imageTest.tsx
import { test, expect } from '@playwright/test';

test('component visual regression', async ({ page }) => {
  await page.goto('http://localhost:5173/component-demo');
  await page.waitForLoadState('networkidle');

  // Take screenshot and compare with baseline
  const screenshot = await page.screenshot();
  expect(screenshot).toMatchImageSnapshot({
    customSnapshotsDir: '__image_snapshots__',
    customDiffDir: '__image_snapshots__/diff',
    threshold: 0.1, // 0.1% pixel difference tolerance
  });
});

3. CI/CD Integration

Implementation: .github/workflows/visual-regression-*.yml

Workflow files:

  • visual-regression-pr.yml - Runs on pull requests
  • visual-regression-baseline.yml - Updates baselines on main branch
  • visual-regression-report.yml - Generates and uploads diff reports

PR Workflow:

  1. Checkout code and install dependencies
  2. Start local server
  3. Run visual regression tests
  4. If differences found:

- Generate diff screenshots - Upload artifacts to GitHub - Post comment on PR with visual diff preview - Mark check as failed

  1. If no differences, mark check as passed

Baseline Update Workflow:

  1. Runs on main branch after merge
  2. Regenerates all baseline screenshots
  3. Commits updated baselines back to repo

File Structure

.github/workflows/
  ├── visual-regression-pr.yml          # PR visual checks
  ├── visual-regression-baseline.yml    # Baseline updates
  └── visual-regression-report.yml      # Diff reporting

tests/shared/
  └── imageTest.tsx                     # Baseline screenshot utilities

scripts/visual-regression/
  ├── capture-baselines.ts              # Generate baseline screenshots
  ├── compare-screenshots.ts            # Compare current vs baseline
  ├── generate-report.ts                # Create HTML diff report
  └── upload-to-storage.ts              # Upload to OSS/S3

__image_snapshots__/
  ├── baseline/                         # Baseline screenshots
  ├── current/                          # Latest test screenshots
  └── diff/                             # Difference highlights

Usage Patterns

For Component Development

When developing a new component:

# 1. Create component and demos
npm run dev

# 2. Generate initial baseline
npm run visual:baseline

# 3. Make changes
# ... edit component code ...

# 4. Run visual regression test
npm run visual:test

# 5. Review diffs (if any)
npm run visual:report

# 6. Update baseline if changes are intentional
npm run visual:update-baseline

For PR Reviews

Reviewers can:

  1. Check CI status for visual regression failures
  2. Click artifact link in PR comment
  3. Review visual diff report
  4. Approve/request changes based on visual impact

For CI/CD Pipeline

# Example from .github/workflows/visual-regression-pr.yml
name: Visual Regression Testing

on:
  pull_request:
    branches: [main, develop]

jobs:
  visual-regression:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Setup Node
        uses: actions/setup-node@v4
        with:
          node-version: '20'

      - name: Install dependencies
        run: npm ci

      - name: Install Playwright
        run: npx playwright install --with-deps chromium

      - name: Start dev server
        run: npm run dev &

      - name: Wait for server
        run: npx wait-on http://localhost:5173

      - name: Run visual regression tests
        run: npm run visual:test

      - name: Upload diff artifacts
        if: failure()
        uses: actions/upload-artifact@v4
        with:
          name: visual-diffs
          path: __image_snapshots__/diff/

      - name: Generate report
        if: failure()
        run: npm run visual:report

      - name: Comment PR with results
        if: failure()
        uses: actions/github-script@v7
        with:
          script: |
            const fs = require('fs');
            const report = fs.readFileSync('visual-report.md', 'utf8');
            github.rest.issues.createComment({
              issue_number: context.issue.number,
              owner: context.repo.owner,
              repo: context.repo.repo,
              body: report
            });

Best Practices

1. Baseline Management

  • Version control baselines: Commit baseline screenshots to git
  • Update selectively: Only update baselines for intentional visual changes
  • Document updates: Include baseline updates in PR descriptions
  • Platform consistency: Generate baselines in CI environment, not locally

2. Test Writing

  • Wait for stability: Always use page.waitForLoadState('networkidle')
  • Hide dynamic content: Mask timestamps, animations, random data
  • Test critical paths: Focus on user-facing components
  • Multiple viewports: Test responsive breakpoints
  • Theme variants: Test light/dark modes if applicable

3. Threshold Configuration

// Strict comparison for critical UI
expect(screenshot).toMatchImageSnapshot({ threshold: 0.01 });

// Relaxed for minor anti-aliasing differences
expect(screenshot).toMatchImageSnapshot({ threshold: 0.1 });

// Very relaxed for charts/animations
expect(screenshot).toMatchImageSnapshot({ threshold: 0.5 });

4. Performance Optimization

  • Parallel execution: Run tests in parallel across multiple workers
  • Selective testing: Only test affected components in PR
  • Incremental baselines: Cache and reuse unchanged baselines
  • Headless mode: Always run in headless mode in CI

5. False Positive Reduction

Common causes of false positives:

  • Font rendering differences across OS
  • Anti-aliasing variations
  • Animation timing
  • Browser version differences
  • System fonts

Solutions:

  • Use Docker for consistent environment
  • Freeze animations with CSS
  • Use consistent browser versions
  • Increase threshold for minor differences

Integration with Existing Testing

Visual regression testing complements existing testing strategies:

Unit Tests (Jest)
  ↓
Component Tests (React Testing Library)
  ↓
Visual Regression (Playwright + jest-image-snapshot)
  ↓
E2E Tests (Playwright)
  ↓
Manual QA

Troubleshooting

"Screenshots don't match but look identical"

Cause: Platform-specific rendering differences Solution:

expect(screenshot).toMatchImageSnapshot({
  failureThreshold: 0.01,
  failureThresholdType: 'percent'
});

"Baselines outdated after dependency update"

Cause: Library update changed component styling Solution:

# Review changes first
npm run visual:test

# Update all baselines if changes are expected
npm run visual:update-baseline

"CI fails but local tests pass"

Cause: Different environments (fonts, OS, browser version) Solution: Use Docker or GitHub Actions locally

# Run in Docker matching CI environment
docker run -v $(pwd):/app -w /app mcr.microsoft.com/playwright:v1.40.0 npm run visual:test

References

Implementation Files

  • .github/workflows/visual-regression-*.yml - CI/CD workflows
  • tests/shared/imageTest.tsx - Baseline screenshot implementation
  • scripts/visual-regression/ - Test code and utilities

External Resources

Advanced Features

Multi-Browser Testing

// Test across Chromium, Firefox, and WebKit
import { devices } from '@playwright/test';

const browsers = ['chromium', 'firefox', 'webkit'];
for (const browser of browsers) {
  test(`visual regression on ${browser}`, async ({ playwright }) => {
    const browserInstance = await playwright[browser].launch();
    const page = await browserInstance.newPage();
    // ... test logic
  });
}

Responsive Testing

// Test multiple viewports
const viewports = [
  { width: 375, height: 667, name: 'mobile' },
  { width: 768, height: 1024, name: 'tablet' },
  { width: 1920, height: 1080, name: 'desktop' },
];

for (const viewport of viewports) {
  test(`visual regression ${viewport.name}`, async ({ page }) => {
    await page.setViewportSize(viewport);
    // ... test logic
  });
}

Component Isolation

// Test individual component variants
const variants = ['default', 'primary', 'danger', 'disabled'];

for (const variant of variants) {
  test(`button ${variant} variant`, async ({ page }) => {
    await page.goto(`http://localhost:5173/button/${variant}`);
    await page.waitForLoadState('networkidle');
    const screenshot = await page.locator('[data-testid="button"]').screenshot();
    expect(screenshot).toMatchImageSnapshot({
      customSnapshotIdentifier: `button-${variant}`
    });
  });
}

Agent Capabilities

When users request visual regression testing, the agent should:

  1. Setup Infrastructure

- Create GitHub Actions workflows - Configure Playwright with jest-image-snapshot - Set up baseline directory structure - Add npm scripts for common operations

  1. Generate Tests

- Create test files for each component - Configure appropriate thresholds - Handle dynamic content masking - Set up multi-viewport testing

  1. Integrate with CI/CD

- Configure PR checks - Set up baseline update workflows - Configure artifact uploads - Add PR commenting with diff previews

  1. Provide Documentation

- Document baseline update process - Create troubleshooting guides - Add examples for common scenarios - Document threshold configuration

Example: Full Implementation

See the following files for complete implementation examples:

  • .github/workflows/visual-regression-pr.yml:1 - Full PR workflow
  • tests/shared/imageTest.tsx:1 - Baseline screenshot utilities
  • scripts/visual-regression/compare-screenshots.ts:1 - Comparison logic

This skill enables comprehensive visual regression testing that catches visual bugs before they reach production, maintaining UI consistency across the entire application.

平台分布

Claude Code

28.26%
按下载量换算94

windsurf

22.48%
按下载量换算74

Antigravity

17.74%
按下载量换算59

Gemini CLI

13.02%
按下载量换算43

trae

7.37%
按下载量换算24

OpenCode

3.7%
按下载量换算12

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

继续浏览同类 Skills