GitLab CI Integration
Unofficial workflow

Last verified: 2026-02-20 · Source

Visual testing in GitLab CI

Add screenshot capture to GitLab CI pipelines. Run visual regression testing on merge requests with simple API calls.

GitLab CI + Scrnpix Pipeline

Capture screenshots in your .gitlab-ci.yml stages:

curl "https://api.scrnpix.com/screenshot?url=https%3A%2F%2Freview-app.example.com&width=1440&height=900&full_page=true" \
  -H "X-KEY: your-api-key" \
  -o mr-screenshot.png

GitLab CI Response Handling

Handle API responses in your pipeline jobs:

StatusDescription
200 OKSuccess. Save as artifact and expose in merge request widget.
400 Bad RequestInvalid parameters. Check job logs and use CI_DEBUG_TRACE for verbose output.
401 UnauthorizedAPI key error. Store in CI/CD Variables (masked) and access via $API_KEY.
408 TimeoutPage timeout. Add dependency on review app deployment job.
5xx Server ErrorServer error. Use retry: 2 in job configuration for automatic retries.

Key Features

Review App Screenshots

Capture screenshots of GitLab Review Apps. Attach to merge requests for visual review.

Artifact Storage

Save screenshots as GitLab artifacts. Browse in pipeline UI or download for comparison.

Pipeline DAG

Use needs: to run screenshot capture after deployment. Build efficient visual testing pipelines.

Container-Free

No need for browser images in Docker executors. API calls work in any runner environment.

Frequently Asked Questions

How do I add screenshots to GitLab CI?

Use curl in script section to call Scrnpix API. Save output to artifacts:paths for storage and MR attachment.

Can I screenshot Review Apps?

Yes. Add screenshot job with dependency on review environment. Use CI_ENVIRONMENT_URL for dynamic Review App URLs.

How do I display screenshots in MRs?

Use artifacts:expose_as to show screenshots in merge request UI. Or post to MR comments via GitLab API.

Add screenshots to GitLab CI

Capture visual regression baselines in your GitLab CI/CD pipelines. Simple API integration.

Get Started