Skip to content
45 changes: 45 additions & 0 deletions docs/adr/0003-visual-regression-testing-tool.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# 3. Visual Regression Testing Tool

Date: 2026-02-12

## Status

Accepted

## Context

We need visual regression testing to catch unintended UI changes across our component library. With approximately 990 visual snapshots across our components, we needed to evaluate different visual regression testing tools to determine the best fit for our needs.

The primary options considered were:

- **Percy**: A visual testing platform with cross-browser support and cloud infrastructure
- **visual-html**: An eBay open-source tool for visual regression testing (https://github.com/eBay/visual-html)
- **Vitest snapshot testing**: Built-in snapshot capabilities in our existing test framework

## Decision

We will use Percy for visual regression testing.

Key factors in this decision:

1. **Existing infrastructure**: We already have an enterprise Percy plan at eBay, eliminating procurement and setup overhead
2. **Cross-browser testing**: Percy provides testing across multiple browsers (Chrome, Firefox, Safari, Edge), which visual-html does not natively support
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a couple of other factors IMO.

  1. Percy has responsive testing out of the box, which also has specific mobile browser testing
  2. Percy is actively being maintained and improved, so we should have more abilities to scale and automate in the future.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree with this

3. **Cost management**: While Percy has costs associated with our 990 snapshots, we can manage this through partial builds that only run snapshots for changed components
4. **Cloud infrastructure**: Percy's cloud-based service reduces our CI infrastructure burden compared to self-hosting visual-html
5. **Integration**: Percy integrates well with our GitHub Actions workflow and provides PR integration

## Consequences

**Positive:**

- Cross-browser visual regression coverage without additional infrastructure
- Leverages existing eBay Percy enterprise plan
- No need to maintain custom visual regression infrastructure
- Better collaboration through Percy's PR integration and review UI

**Negative:**

- Ongoing costs based on snapshot count (~990 snapshots)
- Requires careful cost management through partial builds (only running snapshots for changed components)
- Dependency on external service rather than an internal eBay tool
- Must trigger full builds when global files change (tokens, variables, mixins)