## What & why S-10b: the self-service **diploma upload** is now real. After submitting, the citizen picks a PDF and uploads it; the portal base64-encodes it client-side → BFF → domain → **ACL**, which stores it in the ZGW **Documenten (DRC) API** as an `enkelvoudiginformatieobject` and relates it to the zaak, then the `WachtOpDocumenten` wait completes and the case advances to beoordeling. Per §8.1 only the ACL talks to ZGW. Closes #103 Mechanism in **ADR-0018** (proposal #107). Builds on S-10a (#102). The zaak-close-on-expiry item is carved to **#106 (S-10c)**. ## Definition of Done - [x] Linked Gitea issue (above). - [x] Failing test committed before the implementation (red→green per layer). - [x] Conventional Commits referencing the issue (`refs #103`). - [ ] CI green — all Gitea Actions jobs (pending on this PR). - [x] `docker compose up` health unaffected (ACL boots on a placeholder informatieobjecttype URL; the real one is injected by verify-domain). - [x] Docs updated (ADR-0018, demo-script, BACKLOG + S-10c). - [x] ADR added (`docs/architecture/adr-0018-diploma-upload-via-acl-documenten.md`). - [x] Demo note in `docs/demo-script.md`. ## Notes for reviewers - **ACL** (`OpenZaakGateway.StoreDocumentAsync` + `AclService.StoreDiplomaAsync` + `POST /documenten`) reuses the existing gateway patterns (ZGW Bearer, buffered non-chunked body, **no CRS** — Documenten isn't geo). Unit-tested via the stub handler; an **integration test** stores a real document against live OpenZaak (verify-acl). - **Transport:** base64 JSON on every hop (portal encodes client-side) — I deviated from proposal #107's multipart to keep one contract shape and avoid `IFormFile`/antiforgery/multipart-client plumbing; fine at diploma size (ADR-0018 §Alternatives). - **Infra:** `seed_catalogus.py` seeds + publishes a "Diploma" `informatieobjecttype` and relates it to the zaaktype (while both concept); `verify-domain` injects its URL into the ACL. No new ZGW scopes (seed applicatie has `heeft_alle_autorisaties`). - **e2e:** uploads a real PDF (`setInputFiles`) after the openbaar INGEDIEND row confirms the zaak is open (so storage doesn't race the OpenZaak worker). - **Scope boundary:** the ZGW zaak is not set to a cancellation status on 30-day expiry — that's #106 (S-10c). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Reviewed-on: #108
110 lines
5.9 KiB
TypeScript
110 lines
5.9 KiB
TypeScript
import { expect, test } from '@playwright/test';
|
|
|
|
// Walking-skeleton happy path (S-08d + S-09 + S-09b + S-12 + S-10a): a zorgprofessional logs in via
|
|
// mock DigiD and submits through the self-service portal → BFF → domain; the entry appears in the
|
|
// openbaar register as INGEDIEND; the citizen supplies the documents the process is waiting for
|
|
// (S-10a); a behandelaar then logs in to the behandel portal, finds the registration in the werkbak,
|
|
// and approves it (goedkeuren); the decision completes the Flowable Beoordelen task and flows via the
|
|
// ACL → NRC → event-subscriber → projection, and the openbaar register shows INGESCHREVEN.
|
|
test('DigiD submit → public INGEDIEND → documenten → behandelaar goedkeurt → public INGESCHREVEN', async ({
|
|
page,
|
|
context,
|
|
}) => {
|
|
// Visiting the guarded page redirects to the Keycloak (mock DigiD) login.
|
|
await page.goto('/');
|
|
|
|
// Keycloak's default login form (stable ids across themes).
|
|
await page.locator('#username').fill('jan-burger');
|
|
await page.locator('#password').fill('test123');
|
|
await page.locator('#kc-login').click();
|
|
|
|
// Back on the portal, authenticated.
|
|
await expect(page.getByRole('heading', { name: /Zelfservice/i })).toBeVisible();
|
|
|
|
await page.getByRole('button', { name: /indienen/i }).click();
|
|
|
|
// The BFF accepted it and the page shows the confirmation with the reference.
|
|
const confirmation = page.getByText(/ontvangen/i);
|
|
await expect(confirmation).toBeVisible();
|
|
const reference = (await confirmation.textContent())?.match(/Referentie:\s*([0-9a-fA-F-]+)/)?.[1];
|
|
expect(reference, 'the confirmation shows a registration reference').toBeTruthy();
|
|
|
|
// The openbaar register (anonymous, its own origin) shows the submitted entry once the projection
|
|
// catches up. We check it on a SEPARATE page so the self-service tab keeps its (in-memory) submitted
|
|
// state — the "Documenten aanleveren" action below acts on that same session. The projection updates
|
|
// asynchronously (NRC → event-subscriber), so reload until *this* submission's row appears. We poll
|
|
// on the reference cell (not a generic INGEDIEND cell): the shared verify stack already holds
|
|
// INGEDIEND rows from earlier checks, so a status-only poll would short-circuit on a stale row.
|
|
const staff = await context.newPage();
|
|
await staff.goto('http://openbaar/');
|
|
await expect(staff.getByRole('heading', { name: /Openbaar BIG-register/i })).toBeVisible();
|
|
|
|
// #78: the reference shown in the public register must be the exact one the citizen saw on the
|
|
// submit confirmation — no mismatch between the two portals.
|
|
await expect
|
|
.poll(async () => {
|
|
await staff.reload();
|
|
return staff.getByRole('cell', { name: reference }).count();
|
|
}, { timeout: 30_000, intervals: [1_000, 2_000, 3_000, 5_000] })
|
|
.toBeGreaterThan(0);
|
|
await expect(staff.getByRole('row', { name: reference }).getByRole('cell', { name: 'INGEDIEND' }))
|
|
.toBeVisible();
|
|
|
|
// Provide the documents the registration is waiting for (S-10a), on the still-open self-service tab.
|
|
// The process parks at WachtOpDocumenten only after the zaak is opened; the INGEDIEND row above proves
|
|
// the zaak exists — so the OpenZaak worker has completed and the process is now at the wait — which is
|
|
// why we supply the documents here rather than right after submit, when the trigger would race the
|
|
// wait and no-op. (S-10b turns this into a real file upload; here it is the trigger that unblocks
|
|
// beoordeling.)
|
|
await page.setInputFiles('#diploma', {
|
|
name: 'diploma.pdf',
|
|
mimeType: 'application/pdf',
|
|
buffer: Buffer.from('%PDF-1.4 synthetic diploma\n'),
|
|
});
|
|
await page.getByRole('button', { name: /documenten aanleveren/i }).click();
|
|
await expect(page.getByText(/documenten zijn aangeleverd/i)).toBeVisible();
|
|
|
|
// A behandelaar picks the registration up in the behandel-portal werkbak and approves it (goedkeuren)
|
|
// — the S-12 flow that replaces the temporary admin endpoint. The staff tab switches to the
|
|
// medewerker realm (a different Keycloak realm than the citizen's digid session).
|
|
await staff.goto('http://behandel/');
|
|
await staff.locator('#username').fill('merel-behandelaar');
|
|
await staff.locator('#password').fill('test123');
|
|
await staff.locator('#kc-login').click();
|
|
|
|
await expect(staff.getByRole('heading', { name: /Werkbak/i })).toBeVisible();
|
|
|
|
// The registration reaches the Beoordelen user task only after its documents are provided (above), so
|
|
// it appears in the werkbak asynchronously — reload until this reference's row shows up. Target the
|
|
// decide button by reference (not a generic "Goedkeuren"): the shared verify stack holds other open
|
|
// tasks, so a positional match could act on someone else's registration.
|
|
const goedkeuren = staff.getByRole('button', { name: `Goedkeuren ${reference}` });
|
|
await expect
|
|
.poll(async () => {
|
|
await staff.reload();
|
|
return goedkeuren.count();
|
|
}, { timeout: 30_000, intervals: [1_000, 2_000, 3_000, 5_000] })
|
|
.toBeGreaterThan(0);
|
|
|
|
// Click and wait for the decide POST to finish (204) BEFORE leaving the page. `click()` only
|
|
// dispatches the request; navigating away immediately cancels it in flight (nginx logs a 499) and
|
|
// the decision never reaches the domain — so the registration would stay INGEDIEND.
|
|
const decided = staff.waitForResponse(
|
|
(r) =>
|
|
r.url().includes(`/behandel/registrations/${reference}/decide`) &&
|
|
r.request().method() === 'POST',
|
|
);
|
|
await goedkeuren.click();
|
|
expect((await decided).status()).toBe(204);
|
|
|
|
// The approval flows back to the projection; back on the openbaar register *our* row (matched by
|
|
// its reference) now shows INGESCHREVEN.
|
|
await staff.goto('http://openbaar/');
|
|
await expect
|
|
.poll(async () => {
|
|
await staff.reload();
|
|
return staff.getByRole('row', { name: reference }).getByRole('cell', { name: 'INGESCHREVEN' }).count();
|
|
}, { timeout: 30_000, intervals: [1_000, 2_000, 3_000, 5_000] })
|
|
.toBeGreaterThan(0);
|
|
});
|