Visual regression testing in CI catches UI breakage before it merges. Every PR gets screenshots compared against baselines automatically.
Setup
Create .github/workflows/visual-tests.yml:
name: Visual Regression Tests
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
visual-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: las-team/lastest/action@main
with:
server-url: ${{ secrets.LASTEST_SERVER_URL }}
runner-token: ${{ secrets.LASTEST_RUNNER_TOKEN }}
timeout: 300
fail-on-changes: false
Smart Run: Test Only What Changed
Lastest's Smart Run analyzes git diffs to run only affected tests:
- Changed
Button.tsx? Run tests using that component. - Changed
global.css? Run all tests. - Changed
README.md? Skip visual tests.
Turns a 15-minute suite into a 30-second focused check on most PRs.
PR Comments
| Status | Meaning | CI Result |
|---|---|---|
passed | No visual changes | Pass |
review_required | Visual changes found | Configurable |
blocked | Tests failed to run | Fail |
safe_to_merge | Changes reviewed and approved | Pass |
Cross-OS Testing
Deploy @lastest/runner on different machines - each registers with your server and picks up test jobs:
npm install -g @lastest/runner
lastest-runner start -t YOUR_TOKEN -s https://lastest.yourcompany.com
Branch Baselines
Main is the source of truth. Feature branches fork from main. Approved baselines merge back when the PR closes.
