From f2d79919c45b56432f6de7344e852a3de8f70247 Mon Sep 17 00:00:00 2001 From: Niek Otten Date: Tue, 14 Jul 2026 15:36:24 +0200 Subject: [PATCH] fix(e2e): poll the register by reference, not a shared INGEDIEND cell (refs #78) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The verify stack is shared: earlier verify-projection/verify-domain checks leave INGEDIEND rows in the register before the e2e submits. A status-only poll short-circuited on a stale row, then the reference assertion ran against a not-yet-reloaded page and timed out. Poll (with reload) on this submission's reference cell instead — stronger, and it directly proves the #78 correlation. Scope the INGEDIEND/INGESCHREVEN status checks to that reference row too. Co-Authored-By: Claude Opus 4.8 (1M context) --- tests/e2e/registration.spec.ts | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/tests/e2e/registration.spec.ts b/tests/e2e/registration.spec.ts index 88c2de9..9c678ab 100644 --- a/tests/e2e/registration.spec.ts +++ b/tests/e2e/registration.spec.ts @@ -26,19 +26,22 @@ test('DigiD login → submit → public INGEDIEND → approve → public INGESCH // The openbaar register (anonymous, its own origin) shows the submitted entry once the projection // catches up. The projection updates asynchronously (NRC → event-subscriber), and the register loads - // on open, so reload until a submitted (INGEDIEND) row appears. + // on open, 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 before our row is projected. await page.goto('http://openbaar/'); await expect(page.getByRole('heading', { name: /Openbaar BIG-register/i })).toBeVisible(); - await expect - .poll(async () => { - await page.reload(); - return page.getByRole('cell', { name: 'INGEDIEND' }).count(); - }, { timeout: 30_000, intervals: [1_000, 2_000, 3_000, 5_000] }) - .toBeGreaterThan(0); // #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(page.getByRole('cell', { name: reference })).toBeVisible(); + await expect + .poll(async () => { + await page.reload(); + return page.getByRole('cell', { name: reference }).count(); + }, { timeout: 30_000, intervals: [1_000, 2_000, 3_000, 5_000] }) + .toBeGreaterThan(0); + await expect(page.getByRole('row', { name: reference }).getByRole('cell', { name: 'INGEDIEND' })) + .toBeVisible(); // Approve via the temporary admin endpoint (reached directly on the compose network, as a // behandelaar would until the behandel-portal exists — S-12). The zaak is opened off the request @@ -53,11 +56,12 @@ test('DigiD login → submit → public INGEDIEND → approve → public INGESCH const approve = await request.post(`http://domain:8080/registrations/${reference}/approve`); expect(approve.status()).toBe(204); - // The approval flows back to the projection; the openbaar register now shows it as INGESCHREVEN. + // The approval flows back to the projection; the openbaar register now shows *our* row (matched by + // its reference) as INGESCHREVEN. await expect .poll(async () => { await page.reload(); - return page.getByRole('cell', { name: 'INGESCHREVEN' }).count(); + return page.getByRole('row', { name: reference }).getByRole('cell', { name: 'INGESCHREVEN' }).count(); }, { timeout: 30_000, intervals: [1_000, 2_000, 3_000, 5_000] }) .toBeGreaterThan(0); });