Audience: Contributor
npm run test:cypress (repo root) starts a throwaway MariaDB + LokAkrt + UI, completes the setup wizard, dumps a baseline, then runs Cypress e2e and component specs. Requires Docker. The Cypress browser binary is installed by npm run install / clean:install.
See also: Developer setup · repository
README.md·CONTRIBUTING.md
When the harness sets CYPRESS_E2E_RESTORE=1, each e2e spec file restores MariaDB to the post-setup baseline once, in a Mocha before() hook (ui/main/cypress/support/e2e-restore.ts).
| Restores? | |
|---|---|
Start of login.cy.ts, project.cy.ts, … |
Yes — one snapshot per file |
Between it() cases in the same file |
No — login page-presented / invalid / valid share one snapshot |
| Component specs | No — they use a different support file |
LOKAKRT_E2E_REUSE=1 |
No — already-wizarded local servers; no dump or restore |
Restore talks to MariaDB over TCP (mysql2). Cypress must not spawn docker. After restore, the hook waits for GET /api/status?type=info 200 so the LokAkrt pool is usable.
The task timeout is 300s. The terminal should show → e2e-restore: starting then applied N batches (…ms). A hung TCP query is destroyed just before that so the next spec is not queued behind a dead restore.
# Full harness (Docker MariaDB + setup + Cypress e2e + component)
npm run test:cypress
# Already-wizarded local LokAkrt + UI (set both origins)
LOKAKRT_E2E_REUSE=1 \
CYPRESS_baseUrl=http://127.0.0.1:4200 \
CYPRESS_apiUrl=http://127.0.0.1:8080 \
npm run test:cypress
LOKAKRT_E2E_REUSE=1 requires CYPRESS_baseUrl and CYPRESS_apiUrl.
Chrome --headless only (no Electron browser). Cypress’s own process is still Electron and needs a display: a desktop DISPLAY, or the Xvfb binary (xorg-x11-server-Xvfb on CentOS Stream / RHEL). Do not set ELECTRON_RUN_AS_NODE=1 — Cypress 15 dies with SIGILL (exit 132) and the specs never start. The harness fails fast if Linux has neither DISPLAY nor Xvfb.
Helper unit tests (no Docker):
node --test scripts/e2e-mariadb.spec.mjs scripts/e2e-stack.spec.mjs
Compose project lokakrt-e2e, file server/main/docker-compose.e2e.yml. This is not the operator stack (lokakrt_mariadb / port 3306).
| Value | |
|---|---|
| Image | MariaDB 11.4 |
| Database / user | lokakrt_e2e / lokakrt_e2e |
| User password | e2e-changeme |
| Root password | e2e-root-changeme |
| Admin | admin@example.com / changeme |
LokAkrt NODE_ENV |
development (so migration.test runs) |
| Host ports | Ephemeral on 127.0.0.1 (LokAkrt, UI, MariaDB). Do not assume 8080 / 4200 / 3308. |
Harness order: MariaDB ready → LokAkrt setup (poll /api/status every 2s until dbSetup === false) → dump baseline once → ng serve → Cypress.
A dropped POST /api/setup is not fatal while the LokAkrt process is still migrating. If the LokAkrt exits, the harness fails immediately and prints MariaDB logs.
Leftover e2e containers look like a hung first-init. From the repo root:
pkill -f 'lokakrt-e2e-main' || true
docker compose -f server/main/docker-compose.e2e.yml -p lokakrt-e2e down -v --remove-orphans --timeout 5
docker ps -aq --filter name=lokakrt-e2e | xargs -r docker rm -f
rm -f ui/main/src/environments/environment.e2e.ts
rm -rf /tmp/lokakrt-e2e-shared-*
Do not tear down the operator stack (lokakrt_mariadb).