Files
aurum/e2e/run.sh
ZProger d1458eb160 feat: view and edit a transaction's note from the list
Transactions can carry a `notes` field (set via the API — e.g. the
currency-conversion metadata on this user's imported historical data), but
there was no way to see it in the UI at all.

TransactionsTable now shows a note icon next to edit/delete, only when a
transaction actually has one, opening a dialog with the text. The edit
form's `notes` field was already wired end to end (state, payload) but had
no input in the JSX — added it, since a view-only note with no way to edit
or clear it would be a dead end.

Also fixed e2e/run.sh's readiness check, found while running the full
suite for this change: it polled `/` (nginx, answers almost immediately)
instead of `/api/health`, so the first test could start before the backend
finished migrating/seeding and fail trying to parse nginx's HTML error
page as JSON.
2026-08-16 23:50:10 +03:00

42 lines
1.5 KiB
Bash
Executable File

#!/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}/api/health ..."
# /api/health, not just / — nginx (the `web` container) answers the bare root
# well before the backend has finished running migrations + seeding, and a
# request racing ahead of that gets nginx's own HTML error page back instead
# of JSON, which the first test to touch the API then fails to parse.
for _ in $(seq 1 60); do
if curl -sf "http://localhost:${AURUM_WEB_PORT}/api/health" >/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 "$@"