Files
KomediruzeckiandGitHub c41dad038e feat(retirement): zoom the chart, and settings rows that read as settings rows (#412)
Sixty years drawn across half a screen puts a decade in a centimetre: the shape
is there but nothing can be read off it. Scroll zooms, drag pans, pinch works on
a touch screen, and a button appears in the chart's corner once there is a zoom
to undo — double-click does the same, since that is what people try first.

Done by moving the x scale's min/max, which a category scale reads as point
indices, so the axis relabels itself from whatever range it is given and the
markers stay on their crossings. chartjs-plugin-zoom would have been a new
dependency for a hundred lines of arithmetic, and installing one here writes
into the node_modules the main checkout shares. The window maths is separated
from the DOM so anchoring, clamping and gesture fall-through are testable
without a canvas: 18 tests on the arithmetic, 13 driving the real handlers.

A wheel that would zoom out from the full extent does not preventDefault.
Otherwise the chart is a trap — you reach it and can never scroll past it.

The two switches inside the form were the last native checkboxes on the page,
each with a line under it explaining what the setting currently means. That is a
settings row, so they use the one the app already has: wording and its live
description on the left, switch on the right. Their descriptions stay live —
they report the effect of the setting as it stands, not a fixed caption.

Release 5.9.2
-------------
Changelogs written for everything since v5.9.1 and the version bumped. Both tour
walks clean, desktop and mobile: 52 steps, none without a visible spotlight —
worth checking rather than assuming, since this branch moved the retirement
page's layout twice and the tour spotlights one of its panels.

No migrations since v5.9.1, so the deploy has no schema step to rehearse.
2026-08-23 14:08:13 +02:00
..

E2E test conventions

Playwright end-to-end tests live here. They run against the built SPA proxied to the backend (see playwright.config.ts). CI runs the @smoke subset on pull requests and the full suite on main.

Select by data-test-id, not by copy

Structural assertions must target data-test-id hooks, never user-visible text. Matching on copy (getByText(/Recent Transactions/i), getByRole('button', { name: /save/i }), locator('button', { hasText: '...' })) couples the test to wording that product/design change freely. When the dashboard card "Recent Transactions" was renamed to "Transactions", a copy-matching smoke test silently went red on every build without a single line of app logic changing — the failure it reported ("element not found") looked like a data bug and cost real time to chase. A test-id would have survived the rename untouched.

playwright.config.ts sets testIdAttribute: 'data-test-id', so use the built-in locator:

await expect(page.getByTestId('dashboard-transactions')).toBeVisible()

(There is also a getByTestId(page, id) helper in test-helpers.ts for spots that need the raw CSS selector.)

When text matching is correct

Assert on copy only when the copy itself is what you're testing — an i18n string, a specific error message, a formatted currency value. Even then, scope it to a data-test-id element (page.getByTestId('dashboard-metric-networth-value') then check its text) rather than searching the whole page.

Naming

Kebab-case, hierarchical, stable across redesigns:

{area}-{element}[-{qualifier}]
  • area — the page or feature: dashboard, transactions, budgets, nav, …
  • element — the meaningful node: header, metric-networth, transactions, link-accounts.
  • qualifier — an optional sub-part: dashboard-metric-networth-value.

Repeated rows share one id and are queried positionally:

<For each={txns}>{(t) => <div data-test-id="dashboard-transaction-item">…</div>}</For>
await expect(page.getByTestId('dashboard-transaction-item').first()).toBeVisible()

Where to put the hook

Put the data-test-id on the semantically meaningful container a test needs to find — the page root, a section/card, a key value, an actionable control, or a list item. Add it to the component, keep it stable, and don't reuse one id for unrelated nodes.

Reference implementation

tests/dashboard.spec.ts + the ids in src/features/Dashboard.tsx, src/components/Dashboard/OverviewDeck.tsx, and the nav in src/App.tsx are the worked example of the above. New/updated specs should follow that shape; existing copy-matching specs are being migrated to it area-by-area.