test(e2e): open the werkbak before the registration is ready for beoordeling (refs #162)
CI / build (pull_request) Successful in 1m4s
CI / lint (pull_request) Successful in 1m23s
CI / unit (pull_request) Successful in 1m24s
CI / frontend (pull_request) Successful in 3m8s
CI / mutation (pull_request) Successful in 6m18s
CI / verify-stack (pull_request) Successful in 10m15s
CI / build (pull_request) Successful in 1m4s
CI / lint (pull_request) Successful in 1m23s
CI / unit (pull_request) Successful in 1m24s
CI / frontend (pull_request) Successful in 3m8s
CI / mutation (pull_request) Successful in 6m18s
CI / verify-stack (pull_request) Successful in 10m15s
The happy path visited the behandel portal only after the documents were supplied, so the row was already in the werkbak at page load — dropping the reload proved nothing. Now the behandelaar logs in first, asserts the row is NOT there yet, and only then does the citizen supply the documents that route it to Beoordelen. The row can therefore only reach that already-open, never-reloaded page by the werkbak refreshing itself. Verified both ways against a live stack: with the interval stubbed out the spec fails at "Goedkeuren <ref> … element(s) not found" after 30s; with it, the behandel nginx logs the poll that delivers the row. The werkbak page is foregrounded before the assertion — Chromium throttles timers in a hidden tab. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -59,12 +59,32 @@ test('DigiD submit → public INGEDIEND → documenten → behandelaar goedkeurt
|
|||||||
await expect(staff.getByRole('row', { name: reference }).getByRole('cell', { name: 'INGEDIEND' }))
|
await expect(staff.getByRole('row', { name: reference }).getByRole('cell', { name: 'INGEDIEND' }))
|
||||||
.toBeVisible();
|
.toBeVisible();
|
||||||
|
|
||||||
|
// A behandelaar opens the behandel-portal werkbak and approves the registration (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).
|
||||||
|
//
|
||||||
|
// The werkbak is opened BEFORE the citizen supplies the documents that route the registration to
|
||||||
|
// Beoordelen, so its row cannot be there at page load: the only thing that can deliver it to this
|
||||||
|
// already-open page is the werkbak refreshing itself (S-26/#162, ADR-0032). This spec used to
|
||||||
|
// `staff.reload()` in a poll loop here; the absence of that reload is the live-refresh assertion.
|
||||||
|
await staff.goto('http://behandel/');
|
||||||
|
// That realm enforces MFA (S-15c), so the behandelaar logs in with password + TOTP.
|
||||||
|
await loginMedewerker(staff, 'merel-behandelaar');
|
||||||
|
|
||||||
|
await expect(staff.getByRole('heading', { name: /Werkbak/i })).toBeVisible();
|
||||||
|
|
||||||
|
// 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(goedkeuren, 'the registration is not awaiting beoordeling yet').toBeHidden();
|
||||||
|
|
||||||
// Provide the documents the registration is waiting for (S-10a), on the still-open self-service tab.
|
// 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 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
|
// 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
|
// 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
|
// wait and no-op. (S-10b turns this into a real file upload; here it is the trigger that unblocks
|
||||||
// beoordeling.)
|
// beoordeling.)
|
||||||
|
await page.bringToFront();
|
||||||
await page.setInputFiles('#diploma', {
|
await page.setInputFiles('#diploma', {
|
||||||
name: 'diploma.pdf',
|
name: 'diploma.pdf',
|
||||||
mimeType: 'application/pdf',
|
mimeType: 'application/pdf',
|
||||||
@@ -73,22 +93,10 @@ test('DigiD submit → public INGEDIEND → documenten → behandelaar goedkeurt
|
|||||||
await page.getByRole('button', { name: /documenten aanleveren/i }).click();
|
await page.getByRole('button', { name: /documenten aanleveren/i }).click();
|
||||||
await expect(page.getByText(/documenten zijn aangeleverd/i)).toBeVisible();
|
await expect(page.getByText(/documenten zijn aangeleverd/i)).toBeVisible();
|
||||||
|
|
||||||
// A behandelaar picks the registration up in the behandel-portal werkbak and approves it (goedkeuren)
|
// Back to the werkbak — untouched since login, never reloaded. The row arrives on its own once the
|
||||||
// — the S-12 flow that replaces the temporary admin endpoint. The staff tab switches to the
|
// DMN routes the registration to Beoordelen. (Foregrounded so Chromium doesn't throttle the page's
|
||||||
// medewerker realm (a different Keycloak realm than the citizen's digid session).
|
// refresh timer as a hidden tab.)
|
||||||
await staff.goto('http://behandel/');
|
await staff.bringToFront();
|
||||||
// That realm enforces MFA (S-15c), so the behandelaar logs in with password + TOTP.
|
|
||||||
await loginMedewerker(staff, 'merel-behandelaar');
|
|
||||||
|
|
||||||
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. Since S-26 (#162) the werkbak refreshes itself, so
|
|
||||||
// this waits on the row WITHOUT reloading the page — the reload here is what the slice removes, and
|
|
||||||
// its absence is the live-refresh assertion. 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(goedkeuren).toBeVisible({ timeout: 30_000 });
|
await expect(goedkeuren).toBeVisible({ timeout: 30_000 });
|
||||||
|
|
||||||
// Click and wait for the decide POST to finish (204) BEFORE leaving the page. `click()` only
|
// Click and wait for the decide POST to finish (204) BEFORE leaving the page. `click()` only
|
||||||
|
|||||||
Reference in New Issue
Block a user