From 52ba2fc242825453883bc68632f74358808991fd Mon Sep 17 00:00:00 2001 From: Niek Otten Date: Thu, 16 Jul 2026 10:12:50 +0200 Subject: [PATCH] fix(e2e): await the decide POST before leaving the werkbak page (refs #13) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The happy path clicked Goedkeuren and immediately navigated to the openbaar register, which cancelled the in-flight POST /behandel/registrations/{id}/decide (nginx 499) — the decision never reached the domain, so the registration stayed INGEDIEND and the final INGESCHREVEN assertion failed. Wait for the decide response (204) before navigating away. Co-Authored-By: Claude Opus 4.8 (1M context) --- tests/e2e/registration.spec.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/e2e/registration.spec.ts b/tests/e2e/registration.spec.ts index 3313bdc..c6395ff 100644 --- a/tests/e2e/registration.spec.ts +++ b/tests/e2e/registration.spec.ts @@ -66,7 +66,16 @@ test('DigiD submit → public INGEDIEND → behandelaar goedkeurt → public ING }, { 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 = page.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.