MCP HubMCP Hub
返回技能列表

visual-testing-advanced

proffesor-for-testing
更新于 Today
135 次查看
99
21
99
在 GitHub 上查看
其他visualregressionscreenshotpixel-diffpercyplaywrightresponsive

关于

This Claude Skill performs advanced visual regression testing with pixel-perfect and AI-powered diff analysis to detect UI changes. It validates responsive designs across multiple viewports and ensures cross-browser visual consistency. Use it to catch visual regressions, validate design implementations, and maintain UI quality.

快速安装

Claude Code

推荐
插件命令推荐
/plugin add https://github.com/proffesor-for-testing/agentic-qe
Git 克隆备选方式
git clone https://github.com/proffesor-for-testing/agentic-qe.git ~/.claude/skills/visual-testing-advanced

在 Claude Code 中复制并粘贴此命令以安装该技能

技能文档

Advanced Visual Testing

<default_to_action> When detecting visual regressions or validating UI:

  1. CAPTURE baseline screenshots (first run establishes baseline)
  2. COMPARE new screenshots against baseline (pixel-by-pixel or AI)
  3. MASK dynamic content (timestamps, ads, user counts)
  4. TEST across devices (desktop, tablet, mobile viewports)
  5. REVIEW and approve intentional changes, fail on regressions

Quick Visual Testing Steps:

  • Set up baseline on main branch
  • Compare feature branch against baseline
  • Mask dynamic elements (timestamps, avatars)
  • Use AI-powered comparison to reduce false positives
  • Integrate in CI/CD to block visual regressions

Critical Success Factors:

  • Functional tests don't catch visual bugs
  • AI-powered tools reduce false positives
  • Review diffs, don't just auto-approve </default_to_action>

Quick Reference Card

When to Use

  • UI component changes
  • CSS/styling modifications
  • Responsive design validation
  • Cross-browser consistency checks

Visual Bug Types

Bug TypeDescription
Layout shiftElements moved position
Color changeUnintended color modification
Font renderingTypography issues
AlignmentSpacing/alignment problems
Missing imagesBroken image paths
OverflowContent clipping

Comparison Algorithms

AlgorithmBest For
Pixel diffExact match requirement
Structural similarityHandle anti-aliasing
AI semanticIgnore insignificant changes

Visual Regression with Playwright

import { test, expect } from '@playwright/test';

test('homepage visual regression', async ({ page }) => {
  await page.goto('https://example.com');

  // Capture and compare screenshot
  await expect(page).toHaveScreenshot('homepage.png');
  // First run: saves baseline
  // Subsequent runs: compares to baseline
});

test('responsive design', async ({ page }) => {
  // Mobile viewport
  await page.setViewportSize({ width: 375, height: 667 });
  await page.goto('https://example.com');
  await expect(page).toHaveScreenshot('homepage-mobile.png');

  // Tablet viewport
  await page.setViewportSize({ width: 768, height: 1024 });
  await expect(page).toHaveScreenshot('homepage-tablet.png');
});

Handling Dynamic Content

test('mask dynamic elements', async ({ page }) => {
  await page.goto('https://example.com');

  await expect(page).toHaveScreenshot({
    mask: [
      page.locator('.timestamp'),     // Dynamic time
      page.locator('.user-count'),    // Live counter
      page.locator('.advertisement'), // Ads
      page.locator('.avatar')         // User avatars
    ]
  });
});

AI-Powered Visual Testing (Percy)

import percySnapshot from '@percy/playwright';

test('AI-powered visual test', async ({ page }) => {
  await page.goto('https://example.com');

  // Percy uses AI to ignore anti-aliasing, minor font differences
  await percySnapshot(page, 'Homepage');
});

test('component visual test', async ({ page }) => {
  await page.goto('https://example.com/components');

  // Snapshot specific component
  const button = page.locator('.primary-button');
  await percySnapshot(page, 'Primary Button', {
    scope: button
  });
});

Playwright Configuration

// playwright.config.js
export default {
  expect: {
    toHaveScreenshot: {
      maxDiffPixels: 100,      // Allow 100 pixel difference
      maxDiffPixelRatio: 0.01, // Or 1% of image
      threshold: 0.2,          // Color similarity threshold
      animations: 'disabled',  // Disable animations
      caret: 'hide'            // Hide cursor
    }
  }
};

Agent-Driven Visual Testing

// Comprehensive visual regression
await Task("Visual Regression Suite", {
  baseline: 'main-branch',
  current: 'feature-branch',
  pages: ['homepage', 'product', 'checkout'],
  devices: ['desktop', 'tablet', 'mobile'],
  browsers: ['chrome', 'firefox', 'safari'],
  threshold: 0.01
}, "qe-visual-tester");

// Returns:
// {
//   comparisons: 27,  // 3 pages × 3 devices × 3 browsers
//   differences: 2,
//   report: 'visual-regression-report.html'
// }

Agent Coordination Hints

Memory Namespace

aqe/visual-testing/
├── baselines/*          - Baseline screenshots
├── comparisons/*        - Diff results
├── components/*         - Component snapshots
└── reports/*            - Visual regression reports

Fleet Coordination

const visualFleet = await FleetManager.coordinate({
  strategy: 'visual-testing',
  agents: [
    'qe-visual-tester',   // Screenshot comparison
    'qe-test-executor',   // Cross-browser execution
    'qe-quality-gate'     // Block on visual regressions
  ],
  topology: 'parallel'
});

Related Skills


Remember

Functional tests don't catch visual bugs. Layout shifts, color changes, font rendering, alignment issues - all invisible to functional tests but visible to users.

AI-powered tools reduce false positives. Percy, Applitools use AI to ignore insignificant differences (anti-aliasing, minor font rendering).

With Agents: qe-visual-tester automates visual regression across browsers and devices, uses AI to filter noise, and generates visual diff reports. Catches UI regressions before users see them.

GitHub 仓库

proffesor-for-testing/agentic-qe
路径: .claude/skills/visual-testing-advanced
agenticqeagenticsfoundationagentsquality-engineering

相关推荐技能

regression-testing

其他

该Skill提供智能化的回归测试策略,帮助开发者在验证代码修复时确保现有功能不被破坏。它通过变更影响分析和风险评估,智能选择测试用例并优化执行顺序,避免全量测试的时间消耗。适用于CI/CD流程中的测试套件规划、变更验证和快速反馈场景,能显著提升回归测试效率。

查看技能

testability-scoring

其他

该Skill基于10个内在可测试性原则,对Web应用进行AI驱动的可测试性评估。它使用Playwright并可选集成Vibium,帮助开发者评估测试就绪度、识别改进点并生成报告。适用于软件可测试性评估、测试准备度检查及生成可测试性改进建议等场景。

查看技能

compatibility-testing

其他

该Skill用于跨浏览器、跨平台和跨设备的兼容性测试,确保应用在不同环境下体验一致。它特别适用于验证浏览器支持、测试响应式设计或确保平台兼容性等场景。关键能力包括定义浏览器矩阵、并行测试多设备、使用云服务进行真机测试以及跨平台视觉对比。

查看技能

test-environment-management

其他

该Skill专注于测试环境管理,提供基于基础设施即代码的自动化配置,支持使用Docker/Kubernetes确保环境一致性。它适用于创建与生产环境保持高度一致的测试环境,并通过服务虚拟化和成本优化策略来提升测试效率。开发者可用它来管理测试基础设施生命周期,优化资源使用成本。

查看技能