mirror of
https://github.com/Zproger/Aurum.git
synced 2026-10-13 02:56:39 +07:00
test: real backend pytest + E2E Playwright suites, both isolated from prod data
backend/tests/: 33 pytest tests against a real Postgres database (aurum_test, created/migrated/dropped per run) exercised through the actual HTTP API — not sqlite, not mocks, and the real `aurum` database is never opened (app lifespan is skipped, get_session is overridden per test). Covers transaction category-kind validation, year/month/date-range filtering and pagination, dashboard summary arithmetic, budget status, cash flow, and the /transactions/years picker. e2e/: 6 Playwright specs driving a real browser against a fully separate throwaway docker-compose stack (run.sh: separate project name, database, port, and volume, torn down with `down -v` on exit) — regression coverage for the Recent Transactions month bug, the Card grid-overflow bug, the frozen-year bug, the Net Worth default range, and the Dashboard-> Transactions deep link, all fixed earlier this session. Also synced the backend's APP_VERSION constant (stale at 0.15.2, embedded in exported backups) with the frontend version.
This commit is contained in:
37
e2e/run.sh
Executable file
37
e2e/run.sh
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env bash
|
||||
# Spins up a throwaway Aurum stack for E2E tests, runs Playwright against it,
|
||||
# then always tears the stack down again — including its Postgres volume.
|
||||
#
|
||||
# Fully isolated from the real self-hosted instance:
|
||||
# - separate compose project name (aurum-e2e) -> separate containers/network
|
||||
# - separate Postgres database name (aurum_e2e) -> separate data, same server
|
||||
# - separate host port (3100, vs the real one's 3000) -> no port clash
|
||||
# - `down -v` on exit removes the isolated volume, so no test data persists
|
||||
# and the real `aurum`/`aurum_pgdata` are never opened.
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
export AURUM_POSTGRES_DB=aurum_e2e
|
||||
export AURUM_POSTGRES_PASSWORD=aurum-e2e-only
|
||||
export AURUM_WEB_PORT=3100
|
||||
COMPOSE="docker compose -p aurum-e2e"
|
||||
|
||||
cleanup() {
|
||||
$COMPOSE down -v
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
$COMPOSE up -d --build
|
||||
|
||||
echo "waiting for http://localhost:${AURUM_WEB_PORT} ..."
|
||||
for _ in $(seq 1 60); do
|
||||
if curl -sf "http://localhost:${AURUM_WEB_PORT}" >/dev/null; then
|
||||
echo "stack is up"
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
|
||||
cd e2e
|
||||
npm install
|
||||
AURUM_E2E_BASE_URL="http://localhost:${AURUM_WEB_PORT}" npx playwright test "$@"
|
||||
Reference in New Issue
Block a user