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:
ZProger
2026-08-16 22:56:53 +03:00
parent 98c61d50d8
commit 8e46726b4d
24 changed files with 1104 additions and 2 deletions

View File

@@ -0,0 +1,31 @@
import { test, expect } from "@playwright/test";
import { createTransaction, getCategoryId, getDefaultAccountId } from "./helpers";
// Regression for v0.17.1: the "All transactions" link on Dashboard always
// went to /transactions with no params, so it silently reset to the
// current month even if you were looking at a different one. It should
// carry the selected year/month through as query params. See UPDATES.md
// (v0.17.1) and frontend/src/components/dashboard/RecentTransactionsCard.tsx.
test("Dashboard's All transactions link opens Transactions on the same month", async ({ page, request }) => {
const accountId = await getDefaultAccountId(request);
const categoryId = await getCategoryId(request, "Groceries");
await createTransaction(request, {
account_id: accountId,
category_id: categoryId,
type: "expense",
amount: "42.00",
description: "2018-march-txn",
date: "2018-03-15",
});
await page.goto("/");
await page.getByRole("button", { name: /^\d{4}$/ }).first().click();
await page.getByRole("option", { name: "2018" }).click();
await page.getByRole("button", { name: "Мар", exact: true }).click();
await page.getByRole("link", { name: "Все транзакции" }).click();
await expect(page).toHaveURL(/\/transactions\?year=2018&month=3/);
await expect(page.getByRole("button", { name: "2018", exact: true })).toBeVisible();
await expect(page.getByText("2018-march-txn")).toBeVisible();
});