Add filter/sort e2e tests and fix filtering/sorting bugs#319
Merged
Conversation
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
This was referenced Jul 5, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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+ newqueryEngine.ts) now honours thefilters,sorts,search,statesandpaginationGraphQL 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
notContains/notBetweentoNEQ. AddedNOT_CONTAINSandNOT_BETWEENoperators 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 inweb/utils/tableStateToApi.ts.deserializeColumnFiltersFromViewrebuilt the filter parameter and droppedsearchTags/searchTag/searchTagsContains, so older views' state/sex/priority filters no longer applied. They are preserved now.virtualDerivedTableState.ts):parameter.uuidValue, which the matcher ignored (e.g. "Priority equals Normal" returned an empty list);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.Verification
mainand pass with the fixes.tasks.spec.ts › should handle page load without errors, pre-exists onmain— a dev-server devtools chunk error unrelated to this change).web:tsc --noEmit,eslint, and all 141 vitest tests pass.backend:ruffpasses; 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