Test suites
Run Cardinal's own tests, the browser suites and the gate scripts.
These are the platform's tests, for people who change Cardinal itself. To test an app, use cardinal test --app APP.
Start the repo's dev stack first, and stop any workspace stack, since both use port 5432:
docker compose -f deploy/docker-compose.yml up -dUnit and integration tests
| Area | Folder | Commands |
|---|---|---|
| Rust | native/ | cargo fmt --check, cargo clippy --all-targets -- -D warnings, cargo test |
| Elixir | platform/ | mix deps.get, mix format --check-formatted, mix compile --warnings-as-errors, mix test |
| Frontend | frontend/ | bun install, bun run build:wasm, bun run typecheck, bun run build, bun test |
| Docs | repo root | scripts/check-docs.sh |
mix test needs Postgres and builds the NIF through Rustler. Run bun run build:wasm before the frontend tests and after any Rust change. A stale module fails the parity test.
Each large Rust crate has a golden corpus that cargo test, ExUnit through the NIF and the WASM build all replay, so the server and the browser give the same answers.
Browser suites
cd frontend/packages/desk && bunx playwright install chromium # once
scripts/e2e.sh # every suite
scripts/e2e.sh form.e2e.ts grid.e2e.ts # only thesee2e.sh builds the release image with CARDINAL_DEV_BUILD=1, so it holds the gate test app.
It boots deploy/docker-compose.e2e.yml as its own compose project: two web nodes, two worker nodes, Postgres, RustFS, Mailpit, Gotenberg and a Caddy proxy on CARDINAL_E2E_PORT (8080).
A seed run creates e2e.localhost with every app and admin@e2e.localhost as System Manager, plus wiz.localhost unclaimed and wiz-admin.localhost claimed, for the setup wizard suites.
It waits until both web nodes answer and both workers run, runs the Playwright suites and removes the stack.
The proxy sends requests round-robin over both web nodes, so every suite also checks that the desk works when requests change nodes. The suites live in frontend/packages/desk/e2e/, one *.e2e.ts file per feature. With a stack already up, bun run e2e runs them directly. Parallel runs set their own COMPOSE_PROJECT_NAME and CARDINAL_E2E_PORT.
Gate scripts
| Script | Checks |
|---|---|
scripts/api-gate.sh BASE_URL LOGIN | The REST API with curl: create, filtered list, decimal and datetime forms, no Password in reads, stale modified as 409, submit, cancel, delete, 403 without System Manager. Needs CARDINAL_ADMIN_PASSWORD |
scripts/workspace-apps-gate.sh | Two workspaces on one Postgres: an app linked into one shows only there, app new, test --app, app new --requires |
scripts/workspace-release-gate.sh | app get from a bare repo, build.json, a release that installs the app, and the workspace Dockerfile when Docker runs |
scripts/apps-signoff-gate.sh | An app from app new --with-frontend through tag, app get, build, new-site --install-app, its tests, a release and an image |
bin/cardinal.test.sh | That bin/cardinal never passes passwords in argv, picks the right folder for mix, and runs self-update |
scripts/check-desk-style.sh | No colour literals outside ui/src/tokens.css, no v-html outside SafeHtml, no physical left/right styles, no hand-written <a> in desk components |
bun scripts/check-form-layout.ts APP[=SOURCE] | RecType layouts that would draw badly, and, given the Frappe source, fields out of the DocType's order. Not in CI |
The workspace gates use the Postgres on localhost:5432 (CARDINAL_DB_PASSWORD, DB_HOST, DB_PORT, DB_USER) and drop their databases afterwards.
CI
.github/workflows/ci.yml runs on pull requests into staging and production and on pushes to them. A pull request into main runs only the changelog check.
| Job | Runs |
|---|---|
rust | fmt, clippy, tests, release-mode property tests, the WASM target |
elixir | format, compile, mix test, bin/cardinal.test.sh, the three workspace gates, api-gate.sh, and release checks such as CARDINAL_ROLE=bogus failing |
frontend | build, typecheck, tests, style checks |
e2e | scripts/e2e.sh, keeping traces on failure |
docs | scripts/check-docs.sh |
For load and chaos testing, see Scaling and load.