Skip to content

test(e2e): add coverage for instruments, authz, admin and the gateway (stage 2)#1430

Merged
joshunrau merged 2 commits into
DouglasNeuroInformatics:mainfrom
joshunrau:test/e2e-coverage
Jul 21, 2026
Merged

test(e2e): add coverage for instruments, authz, admin and the gateway (stage 2)#1430
joshunrau merged 2 commits into
DouglasNeuroInformatics:mainfrom
joshunrau:test/e2e-coverage

Conversation

@joshunrau

Copy link
Copy Markdown
Collaborator

Summary

Stage 2 of the e2e work — new coverage on top of the stage-one structure (#1429), plus a pages/ layout that mirrors apps/web's TanStack route tree.

New specs

Spec Covers
instrument-completion Start a session → administer the Happiness Questionnaire (sliders via arrow keys) → submit → confirm the record via View Current Subject
authorization GROUP_MANAGER gets the management nav; STANDARD does not, and is redirected off /dashboard and /session/remote-assignment
admin-management ADMIN creates a group through the UI; lists users
gateway-assignment Create a remote assignment → complete it as the patient on the gateway origin (solving the Cap proof-of-work) → clinician sees it as Complete

Supporting changes

  • authenticateAs(role) fixture: injects a role's token without navigating, which redirect probes need (getPageModel asserts its landing route).
  • Page objects for the instrument showcase and the instrument runner.
  • pages/ now mirrors the route tree 1:1 — e.g. _app/session/start-session.page.ts_app/session/start-session.tsx — so a route tells you exactly where its page object lives.

App behaviour these encode

  • Multi-step flows navigate via sidebar clicks, not page.goto(): the active session is memory-only and does not survive a hard navigation.
  • Group creation asserts the success toast + redirect rather than list membership — /admin/groups appears to be scoped to groups the actor belongs to, and creating one does not add the creator as a member. Flagged rather than asserted.

Verification

32 passed, both parallel and with CI=1 (serial).

🤖 Generated with Claude Code

joshunrau and others added 2 commits July 21, 2026 14:34
Stage two of the e2e work: new coverage on top of the stage-one structure,
plus a pages/ layout that mirrors apps/web's TanStack route tree so each page
object sits at its route's path (+ .page.ts).

New specs:
- instrument-completion: start a session, administer the Happiness
  Questionnaire, submit, and confirm the record via "View Current Subject".
- authorization: GROUP_MANAGER gets the management nav; STANDARD does not and
  is redirected off /dashboard and /session/remote-assignment.
- admin-management: ADMIN creates a group through the UI and lists users.
- gateway-assignment: create a remote assignment, complete it as the patient
  on the gateway origin (solving the Cap proof-of-work), and confirm the
  clinician sees it as Complete.

Supporting changes:
- `authenticateAs(role)` fixture injects a role's token without navigating, so
  redirect probes are possible (getPageModel asserts its landing route).
- Page objects for the instrument showcase and the instrument runner.

Notes on the app behaviour these encode: multi-step flows navigate via sidebar
clicks because the active session is memory-only and does not survive a hard
navigation; and group creation deliberately asserts the success toast/redirect
rather than list membership, since /admin/groups appears to be scoped to groups
the actor belongs to.

Verified locally: 32 passed, parallel and with CI=1 (serial).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The assignment status posts back from the gateway asynchronously and can still
read "Outstanding" for a while on a slower runner (seen in CI). A single
reload plus assertion retries was not enough, since retries re-query the
locator rather than refetching. Retry the reload itself via expect.toPass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@joshunrau
joshunrau merged commit e0ebb21 into DouglasNeuroInformatics:main Jul 21, 2026
1 check passed
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.

1 participant