Testing¶
Go¶
internal/domain: pure unit tests (ranking, club competition, special prizes, age categories, amounts in words …).internal/storeandinternal/web: integration tests.internal/testdbcreates a throwaway, migrated database per test fromTEST_DATABASE_URL;make teststarts the compose PostgreSQL on port 5433 and sets the variable. Without it these tests are skipped.internal/docs: checks the text of rendered PDFs withpdftotextwhen installed.DOCS_OUT=dir go test ./internal/docs/writes the PDFs for a visual check.internal/i18n: fails on untranslated messages or mismatched format verbs.
End to end¶
Builds the real image, starts it with an empty database on :3002 (compose profile e2e) and runs the Playwright specs in e2e/tests in the mcr.microsoft.com/playwright image with Chromium at 1280×800, several spec files in parallel. The Makefile's PLAYWRIGHT_IMAGE, the CI job and @playwright/test in e2e/package.json must use the same version; Renovate updates them together.
On a failure, e2e/test-results holds a screenshot and a trace of the failed test; open the trace with npx playwright show-trace <file> in e2e/. The CI job keeps the folder as an artifact and reports the results as JUnit.
Specs create their own club through the admin panel (createClub in e2e/helpers.js) and their data through the API, so they can run in parallel against the same instance. Each file runs serially: tests in a file may build on each other, and a retry repeats the whole file with a new club. c(scope, selector, text) finds the innermost element containing a text, like cy.contains. Toasts are [data-sonner-toast], confirmations [role=alertdialog].
Documentation screenshots¶
make docs-screenshots runs e2e/docs/screenshots.spec.js as the Playwright project docs (1440×900) and writes the PNGs to docs/content/images/screenshots. It is not part of make e2e. Use invented names only: the screenshots are public.