Skip to main content

Running & writing tests for frontend

Before we start

If you have never run Infrahub tests before, we highly suggest following the frontend guide.

We're expecting to see proper tests for each feature/bugfix you make. If you're not sure how to write these tests, this page is made to help you get started.

Infrahub frontend has 3 types of testing:

E2E tests​

End-to-end tests live in tests/e2e/ at the repository root. The suite is written in Python with pytest-playwright and boots a complete Infrahub stack with infrahub-testcontainers. You need a running Docker daemon and a locally built Infrahub image (uv run invoke dev.build). Run from the repository root (not from frontend/app):

INFRAHUB_TESTING_IMAGE_VER=local INFRAHUB_TESTING_DOCKER_PULL=false \
uv run pytest -c tests/e2e/pytest.ini tests/e2e

To run against an already-running Infrahub instead of booting a stack, set INFRAHUB_ADDRESS.

See tests/e2e/README.md for the suite architecture, the data fixtures, and the debugging workflow.

Unit & integration tests​

pnpm test

# same with coverage
pnpm test:coverage