Deterministic Test Fixtures for CI/CD Pipelines

Published March 11, 2026

CI/CD pipelines must produce the same result regardless of when or where they run. External image dependencies — URLs that fetch from CDNs, APIs that return random content, or services that have downtime — violate this principle. Deterministic image fixtures committed to your repository guarantee that every pipeline run uses identical test data, eliminating an entire class of infrastructure-related failures.

The cost of external dependencies in CI

Every external HTTP request in a CI pipeline is a potential point of failure. CDN outages, rate limits, DNS resolution delays, and content changes all cause test failures that have nothing to do with your code. When a visual regression test fails because Lorem Picsum returned a different photo, the team wastes time triaging a false alarm.

The fix is simple: remove the external dependency. Generate fixture images once, commit them, and reference them by file path in your test setup. The pipeline never makes an HTTP request for image data.

Generating a fixture set for your pipeline

Audit your test suite for every image reference. Collect the dimensions and contexts (product images, avatars, banners, etc.). Enter them into PlacePack with descriptive labels and download the ZIP.

Extract the fixtures into a directory like `test/fixtures/images/` or `__fixtures__/images/`. Reference these paths in your test configuration, mock setup, or seed scripts.

Integrating fixtures with Docker-based CI

Docker-based CI environments (GitHub Actions, GitLab CI, CircleCI) build a fresh container for each run. Because fixture images are committed to the repository, they are included in the container automatically. No setup step, no download, no cache management.

If your CI caches `node_modules/` but not the full repo, make sure the fixture directory is included in the build context. In most configurations this happens by default since `COPY . .` includes everything.

GitHub Actions workflow step

- name: Run visual tests
  run: |
    # Fixtures are already committed — no download needed
    npx playwright test --reporter=html
  env:
    CI: true

Verifying fixture integrity

Add a CI step that checksums the fixture directory and compares it against a known hash. If someone accidentally modifies a fixture file — or if the generator produces different output — the pipeline fails early with a clear error message.

This is especially useful for teams where multiple developers regenerate fixtures independently. The checksum step catches any drift before it affects downstream tests.

Fixture integrity check

# Generate checksum of fixture directory
find test/fixtures/images/ -type f -exec sha256sum {} + | sort | sha256sum > fixtures.sha256
# Compare against committed checksum
diff fixtures.sha256 test/fixtures/images/CHECKSUM || (echo "Fixture drift detected" && exit 1)

Regenerating fixtures when designs change

Store the PlacePack share URL in your project documentation or a dedicated `FIXTURES.md` file. When component dimensions change, any team member can reopen the URL, update the affected sizes, regenerate the ZIP, and commit the updated files.

Include the fixture update in the same pull request as the design change. This keeps the code, the fixtures, and the visual baselines in sync. Reviewers can verify that the fixture dimensions match the new component requirements.

FAQ — Frequently asked questions

How do I prevent fixture images from bloating the repo?
PlacePack placeholder images are typically under 5 KB each. For large fixture sets (100+ images), consider Git LFS. For most projects, the size impact is negligible.
Can I generate fixtures in a CI step instead of committing them?
You can use the PlacePack API's /pack endpoint, but this reintroduces an external dependency. Committing fixtures is more reliable for CI. Use the API only for validation or regeneration workflows.
Do fixture images work with monorepo setups?
Yes. Place fixtures in each package's test directory or in a shared workspace root. Reference them by relative path from each test file.

Related guides

Ready to generate placeholder images?

Open the generator with the right preset pre-loaded and download your pack in seconds.