Files
azionelab-v2/docs/testing.md
T
2026-06-24 11:06:33 +02:00

44 lines
1.9 KiB
Markdown

# Testing
All tests should run inside Docker containers.
## Canonical test command
```bash
docker compose run --rm backend python manage.py test
docker compose run --rm frontend npm run check
docker compose run --rm frontend npm run build
docker compose run --rm proxy nginx -t
docker compose run --rm --no-deps --entrypoint certbot certbot --version
docker compose -f docker-compose.yml -f docker-compose.test.yml --profile test run --rm backend python manage.py seed_demo
docker compose -f docker-compose.yml -f docker-compose.test.yml --profile test run --build --rm functional-tests
docker compose config --quiet
LETSENCRYPT_ENABLED=1 docker compose config --quiet
```
## Test categories
The test suite covers:
- Django model and API integration tests;
- Astro static type and template validation;
- production frontend build;
- NGINX syntax and upstream configuration validation;
- Certbot image availability/version and optional Compose service rendering;
- Playwright functional browser tests through the NGINX virtual host;
- Docker Compose configuration validation.
All commands run in containers. The backend test container starts PostgreSQL through
Compose; the frontend checks use the checked-in lockfile for reproducible installs.
`docker-compose.test.yml` is an override used only for functional verification. It
adds an internal `azionelab.org` alias to the proxy and starts a pinned Playwright
container. Run the idempotent demo seed through the merged backend service immediately
before the browser suite. The override uses `test_postgres_data` instead of the normal
database volume and does not publish additional host ports.
The browser suite verifies the public content and section order, CTA/contact links,
mobile navigation, horizontal overflow, semantic landmarks, image alternatives, API
contract, uploaded media, Wagtail admin routing, and rejection of unknown hosts. A
manual visual review is still recommended for subjective layout and design quality.