Skip to content

Add filter/sort e2e tests and fix filtering/sorting bugs#319

Merged
felixevers merged 1 commit into
mainfrom
claude/filter-sort-e2e-tests-it1uyg
Jul 5, 2026
Merged

Add filter/sort e2e tests and fix filtering/sorting bugs#319
felixevers merged 1 commit into
mainfrom
claude/filter-sort-e2e-tests-it1uyg

Conversation

@felixevers

Copy link
Copy Markdown
Member

Filter & sorting: e2e coverage + bug fixes

Adds Playwright e2e coverage for filtering and sorting on the patient list, the task list, and custom (saved) views — and fixes the bugs those tests uncovered.

E2E tests (25 new tests)

  • tests/e2e/filter-sort-patients.spec.ts — sorting by name (asc/desc), birthdate, and a text property column; text filters (contains, does not contain), tag filters (status, sex), filter+sort combination, and server-side search.
  • tests/e2e/filter-sort-tasks.spec.ts — default order (open before done, due date asc), sorting by patient (guards Sorting of my tasks list based on patients not possible #213), title, and priority; title/priority/patient filters and search.
  • tests/e2e/filter-sort-views.spec.ts — saved views apply their stored filter/sort definitions (including legacy serializations), saving a new view, overwriting and discarding changes, and the related panels (patients tab of a task view, tasks tab of a patient view).

To make this testable without a database, the mock backend (tests/e2e/support/mockBackend.ts + new queryEngine.ts) now honours the filters, sorts, search, states and pagination GraphQL arguments with the same semantics as the backend query engine, and serves queryable-field metadata and saved views. Tests assert both the rendered row order and the query clauses sent to the API.

Bug fixes

  • "does not contain" / "not between" filters behaved like "not equals" (same class as does not contain - filter is not working #227): the table state mapped notContains/notBetween to NEQ. Added NOT_CONTAINS and NOT_BETWEEN operators to the backend query engine (string columns, dates, numbers, and the patient/assignee/team reference labels; NULL values are kept, matching the client-side matchers) and mapped them in web/utils/tableStateToApi.ts.
  • Saved views silently lost legacy tag filters: deserializeColumnFiltersFromView rebuilt the filter parameter and dropped searchTags/searchTag/searchTagsContains, so older views' state/sex/priority filters no longer applied. They are preserved now.
  • Related panels (custom views), client-side matching (virtualDerivedTableState.ts):
    • tag filters with the equals/not equals operator never matched — the tag popup stores the selection in parameter.uuidValue, which the matcher ignored (e.g. "Priority equals Normal" returned an empty list);
    • assignee filters ignored the selected user id and only ever did (empty) text matching;
    • sorting patients by "Updated" actually sorted by name; the panel now derives an update date from the latest related task and sorts by it;
    • state ordering (WAIT < ADMITTED < DISCHARGED < DEAD), priority ordering (P1..P4), and due-date NULL placement now match the backend's ordering; added firstname/lastname and ward/room/bed filter + sort support.
  • Client-side fallback task order (embedded lists) now places tasks without a due date first, matching the server-driven lists.

Verification

  • All 25 new e2e tests pass; the three regression tests for the related-panel/saved-view bugs fail on main and pass with the fixes.
  • Full e2e suite: 52/53 pass (the one failure, tasks.spec.ts › should handle page load without errors, pre-exists on main — a dev-server devtools chunk error unrelated to this change).
  • web: tsc --noEmit, eslint, and all 141 vitest tests pass. backend: ruff passes; unit tests show no new failures.

Closes #213 is not claimed here — sorting my-tasks by patient is covered by a regression test and works in this stack; please verify against production data before closing.

🤖 Generated with Claude Code

https://claude.ai/code/session_01WCSmjBuS6NbcB6oRmKvQgT


Generated by Claude Code

E2E tests (tests/e2e):
- filter-sort-patients.spec.ts: sorting (name, birthdate, text property),
  text/tag filters, "does not contain", server-side search
- filter-sort-tasks.spec.ts: default order, sorting by patient/title/priority,
  text/tag filters, search (guards issue #213)
- filter-sort-views.spec.ts: saved views apply stored filters/sorting,
  legacy serializations, save/overwrite/discard, related panels
- support/queryEngine.ts + extended mockBackend.ts: the mock now honours
  filters/sorts/search/pagination with the same semantics as the backend
  query engine, serves queryable-field metadata and saved views

Fixes:
- "does not contain"/"not between" filters were sent as NEQ and silently
  behaved like "not equals": new NOT_CONTAINS/NOT_BETWEEN query operators
  in the backend, mapped from the table filter state (issue #227 class)
- saved views: legacy searchTags-based tag filters were dropped on
  deserialization, silently disabling the stored filter
- related panels (custom views): tag filters with the "equals" operator
  never matched because the selection is stored in uuidValue; assignee
  filters ignored the selected user id
- related patients panel: sorting by "Updated" sorted by name instead of
  the update date (now derived from the latest related task update)
- related panels: state ordering (WAIT<ADMITTED<DISCHARGED<DEAD), priority
  ordering (P1..P4), and due-date null ordering now match the backend;
  added firstname/lastname and ward/room/bed filter+sort support

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WCSmjBuS6NbcB6oRmKvQgT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sorting of my tasks list based on patients not possible

2 participants