Integrations/GitLab CI
GitLab

Screenshot capture in GitLab CI pipelines

Automated visual testing for every merge request

Integrate screenshot capture into your GitLab CI/CD pipelines. Capture screenshots of review apps on every merge request, store them as pipeline artifacts, and catch visual issues before merging.

How it works

Connect in 4 steps

1

Add a pipeline stage

Add a screenshots stage to your .gitlab-ci.yml file.

2

Store the API key

Add your API key as a GitLab CI/CD variable in project settings.

3

Capture screenshots

Use curl to call the Allscreenshots API targeting your review app URL.

4

Store as artifacts

Save screenshots as pipeline artifacts for easy access from merge requests.

</> Code

.gitlab-ci.yml

yaml
1stages:
2  - test
3  - screenshots
4
5capture_screenshots:
6  stage: screenshots
7  image: alpine/curl
8  script:
9    - |
10      curl -X POST 'https://api.allscreenshots.com/v1/screenshot' \
11        -H "Authorization: Bearer $SCREENSHOT_API_KEY" \
12        -H 'Content-Type: application/json' \
13        -d "{
14          \"url\": \"https://$CI_ENVIRONMENT_SLUG.yourapp.com\",
15          \"fullPage\": true,
16          \"viewport\": { \"width\": 1920, \"height\": 1080 }
17        }" -o screenshot.png
18  artifacts:
19    paths:
20      - screenshot.png
21    expire_in: 30 days
22  only:
23    - merge_requests
Why Allscreenshots

Built for GitLab CI

Lightweight CI job

Uses a tiny alpine/curl image. No heavy browser dependencies in your pipeline.

Review app screenshots

Automatically capture screenshots of GitLab review apps for every merge request.

Artifact integration

Screenshots appear as downloadable artifacts directly in your merge request.

FAQ

Frequently asked questions

Yes. Use the $CI_ENVIRONMENT_SLUG variable to dynamically target your review app URL in the API request.

Ready to integrate with GitLab CI?

Start with 100 free screenshots every month. No credit card required.