mirror of
https://github.com/Zproger/Aurum.git
synced 2026-11-04 06:36:53 +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:
38
e2e/tests/dashboard-recent-transactions.spec.ts
Normal file
38
e2e/tests/dashboard-recent-transactions.spec.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import { test, expect } from "@playwright/test";
|
||||
import { createTransaction, getCategoryId, getDefaultAccountId } from "./helpers";
|
||||
|
||||
// Regression for the Aug 2026 bug: RecentTransactionsCard queried
|
||||
// transactions without year/month at all, so switching the Dashboard's
|
||||
// month did nothing — it just showed the latest N transactions globally,
|
||||
// including ones from a completely different month. See UPDATES.md
|
||||
// (v0.15.3) and frontend/src/components/dashboard/RecentTransactionsCard.tsx.
|
||||
test("Recent Transactions on Dashboard only shows the selected 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: "12.00",
|
||||
description: "july-2015-only-txn",
|
||||
date: "2015-07-26",
|
||||
});
|
||||
await createTransaction(request, {
|
||||
account_id: accountId,
|
||||
category_id: categoryId,
|
||||
type: "expense",
|
||||
amount: "34.00",
|
||||
description: "august-2015-only-txn",
|
||||
date: "2015-08-08",
|
||||
});
|
||||
|
||||
await page.goto("/");
|
||||
await page.getByRole("button", { name: /^\d{4}$/ }).first().click();
|
||||
await page.getByRole("option", { name: "2015" }).click();
|
||||
await page.getByRole("button", { name: "Авг", exact: true }).click();
|
||||
|
||||
const recentCard = page.locator("div.rounded-xl", { has: page.getByText("Последние транзакции", { exact: true }) });
|
||||
await expect(recentCard.getByText("august-2015-only-txn")).toBeVisible();
|
||||
await expect(recentCard.getByText("july-2015-only-txn")).toHaveCount(0);
|
||||
});
|
||||
Reference in New Issue
Block a user