Files
register-referentie/tests/e2e/resume.spec.ts
T
notandClaude Opus 5 27f2607e4e refactor(e2e): route every portal login through one Keycloak helper (refs #161)
`medewerker-login.ts` becomes `keycloak-login.ts`: the three citizen specs
each duplicated the same three-line password login, so a fix to the login path
had to be made four times. They now call `loginBurger`, and both realms share
`submitPassword`.

No behaviour change — all 6 specs green against a live stack.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-04 11:44:30 +02:00

33 lines
1.8 KiB
TypeScript

import { expect, test } from '@playwright/test';
import { loginBurger } from './keycloak-login';
// S-26: a zorgprofessional submits, then reloads the self-service portal. On load the portal asks the
// BFF for the caller's current open registration (owner-scoped by the DigiD token's bsn) and restores
// the submitted view — so a refresh no longer strands the in-flight registration and its actions.
test('DigiD submit → reload → self-service restores the existing registration', async ({ page }) => {
await page.goto('/');
// Its own DigiD user (like every self-service spec): on the shared verify stack, resume-on-load
// (S-26) restores any open registration for the bsn, so each spec uses a dedicated citizen that no
// other spec or verify-* check touches. This one in particular leaves an open registration.
await loginBurger(page, 'sanne-burger');
await expect(page.getByRole('heading', { name: /Zelfservice/i })).toBeVisible();
await page.getByRole('button', { name: /indienen/i }).click();
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();
// Reload: the component's in-memory submitted state is gone, but the DigiD session persists and the
// portal resumes from the BFF instead of dropping back to the blank submit form.
await page.reload();
await expect(page.getByText(/ontvangen/i)).toBeVisible();
// The same reference the citizen saw before the reload is restored...
await expect(page.getByText(new RegExp(reference!))).toBeVisible();
// ...and its actions are reachable again (e.g. "trek aanvraag in").
await expect(page.getByRole('button', { name: /trek aanvraag in/i })).toBeVisible();
});