跳到正文
Skillpedia
测试75k · #3080

visual-regression

它能做什么

这个技能设置视觉测试,随时间对比页面或组件的截图。它面向希望在上线前发现意外设计变化的团队。

适用场景

  • ✓CSS 修改可能破坏单元测试没有检查的布局的时候。
  • ✓项目的持续集成流程中没有任何视觉检查的时候。
  • ✓关键组件需要一个稳定的视觉基准的时候。

技能链接

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/visual-regression/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/visual-regression/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“我们修改了一些 CSS,现在页面的部分内容看起来不对,但测试仍然通过。请帮我们添加视觉检查吗?”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会找出关键页面或组件,并截取基准截图。之后的运行会把新截图与基准进行比较,并标出超过设定阈值的差异。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Use visual regression testing

Functional tests verify behavior but don't see your page. A CSS refactor might pass all unit and integration tests while completely breaking the layout — text overlapping images, buttons invisible, wrong colors. Visual regression testing acts as a safety net that reviews your actual rendered output, catching changes that no amount of JavaScript testing can detect.

Quick Reference

  • Visual regression tests catch CSS regressions that functional tests miss
  • Run screenshot comparisons in CI to block merges that break visual appearance
  • Use component-level (Storybook) tests for focused, fast visual coverage
  • Set pixel difference thresholds to avoid flaky tests from sub-pixel rendering

Check

Does this project have visual regression testing? What critical components or pages would benefit most from visual baselines?

Fix

Set up visual regression tests for the key components using Playwright's screenshot comparison or a tool like Chromatic.

Explain

Explain visual regression testing, how it differs from functional tests, and how to set up screenshot comparison in a CI pipeline.

Code Review

Review tests, CI workflows, and enforcement points related to Use visual regression testing. Flag exact gaps where the rule is not automatically verified or where failures do not block regressions.


For full implementation details, code examples, and framework-specific guidance, see references/rule.md.

Rule page: https://frontendchecklist.io/rules/testing/visual-regression

常见问题

什么工具可以做到这一点?

这个技能提到了 Playwright 截图对比和 Chromatic 作为可选方案。

为什么要设置差异阈值?

微小的渲染差异可能导致测试不稳定,阈值可以避免因细微改动而失败。

视觉测试应该在 CI 中运行吗?

应该。这个技能建议在 CI 中运行截图对比,阻止会破坏外观的合并。

详情

作者的原始描述

Use when reviewing CI coverage, automated checks, or test strategy related to Use visual regression testing. Focus on whether the rule is continuously verified, not just documented.

repo: thedaviddias/Front-End-Checklist

热度

GitHub 星标
75k
排名
#3080
许可证
MIT
更新时间
2026/10/31

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能