Visual testing in every GitHub Actions workflow
Catch UI regressions on every pull request with automated screenshots
Add screenshot capture to your GitHub Actions CI/CD pipeline. Automatically capture screenshots of preview deployments on every PR, compare them against baselines, and catch visual regressions before they reach production.
- 1
Add workflow file
Create a .github/workflows/screenshots.yml file in your repository.
- 2
Store your API key
Add your Allscreenshots API key as a GitHub repository secret.
- 3
Capture on PR
Use curl in a workflow step to capture screenshots of your preview deployment.
- 4
Upload as artifacts
Store screenshots as GitHub Actions artifacts for review and comparison.
1name: Visual Regression Tests
2on:
3 pull_request:
4 branches: [main]
5
6jobs:
7 screenshots:
8 runs-on: ubuntu-latest
9 steps:
10 - uses: actions/checkout@v4
11
12 - name: Capture Screenshots
13 run: |
14 curl -X POST 'https://api.allscreenshots.com/v1/screenshots' \
15 -H 'X-API-Key: ${{ secrets.SCREENSHOT_API_KEY }}' \
16 -H 'Content-Type: application/json' \
17 -d '{
18 "url": "https://preview-${{ github.event.number }}.yourapp.com",
19 "fullPage": true,
20 "viewport": { "width": 1920, "height": 1080 }
21 }' -o screenshot.png
22
23 - name: Upload Screenshot
24 uses: actions/upload-artifact@v4
25 with:
26 name: screenshots
27 path: screenshot.pngNo browser setup
Skip installing Puppeteer or Playwright in your CI. One API call captures any page.
Fast and reliable
Screenshots are captured on Allscreenshots' infrastructure, not your CI runner. No flaky browser tests.
PR-level visibility
Attach screenshots as artifacts to every PR for easy visual review.
Can I compare screenshots between PRs?
Yes. Download the baseline screenshot from the main branch artifact and compare it with the PR screenshot using image diff tools in your workflow.
Does this slow down my CI pipeline?
No. The API call takes 2-5 seconds. Screenshots are captured on our infrastructure, not on your GitHub runner.
Can I capture multiple pages in one workflow?
Yes. Add multiple curl commands or use a matrix strategy to capture screenshots of different pages in parallel.
How do I store the API key securely?
Add it as a GitHub repository secret (Settings > Secrets > Actions) and reference it as ${{ secrets.SCREENSHOT_API_KEY }}.
- Full-page captures
- Popups and repeated sticky bars removed
- Markdown, JSON and PDF output
- Crawl a site from one URL
- Desktop, tablet and phone in one image
- Works in n8n, Make and Zapier
- MCP server for AI assistants