test(acl,e2e): live diploma-upload coverage (refs #103)
- ACL integration test: stores a real document against a published Diploma informatieobjecttype and asserts it is persisted (bestandsnaam, informatieobjecttype, bestandsomvang) and related to the zaak. - e2e: the registration journey now selects a PDF and uploads it (setInputFiles) before the behandelaar step. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -77,6 +77,18 @@ public sealed class OpenZaakFixture : IDisposable
|
||||
return JsonDocument.Parse(json).RootElement.Clone();
|
||||
}
|
||||
|
||||
/// <summary>The URL of the published "Diploma" informatieobjecttype (S-10b), or null when the
|
||||
/// stack has not been seeded with OZ_PUBLISH=1. `status=definitief` returns published types only.</summary>
|
||||
public async Task<Uri?> FindPublishedDiplomaInformatieobjecttypeAsync(CancellationToken ct = default)
|
||||
{
|
||||
var query = new Uri(BaseUrl, "/catalogi/api/v1/informatieobjecttypen?status=definitief");
|
||||
var page = await GetJsonAsync(query, ct);
|
||||
foreach (var iot in page.GetProperty("results").EnumerateArray())
|
||||
if (iot.TryGetProperty("omschrijving", out var o) && o.GetString() == "Diploma")
|
||||
return new Uri(iot.GetProperty("url").GetString()!);
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>The zaaktype's eindstatus (terminal statustype) URL — the one an approval sets.</summary>
|
||||
public async Task<Uri> FindEindstatustypeAsync(Uri zaaktypeUrl, CancellationToken ct = default)
|
||||
{
|
||||
|
||||
@@ -74,4 +74,55 @@ public sealed class OpenZaakGatewayIntegrationTests(OpenZaakFixture stack)
|
||||
var eindstatustype = await stack.FindEindstatustypeAsync(zaaktype!);
|
||||
Assert.Equal(eindstatustype.ToString(), status.GetProperty("statustype").GetString());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Storing_a_diploma_creates_a_real_informatieobject_related_to_the_zaak()
|
||||
{
|
||||
var zaaktype = await stack.FindPublishedBigZaaktypeAsync();
|
||||
Assert.True(zaaktype is not null,
|
||||
"No published BIG-REGISTRATIE zaaktype found — seed the stack with OZ_PUBLISH=1.");
|
||||
var informatieobjecttype = await stack.FindPublishedDiplomaInformatieobjecttypeAsync();
|
||||
Assert.True(informatieobjecttype is not null,
|
||||
"No published Diploma informatieobjecttype found — seed the stack with OZ_PUBLISH=1.");
|
||||
|
||||
var gateway = new OpenZaakGateway(stack.Http, stack.Options);
|
||||
var zaakUrl = await gateway.OpenZaakAsync(new ZaakRequest(
|
||||
Bronorganisatie: "517439943",
|
||||
VerantwoordelijkeOrganisatie: "517439943",
|
||||
Vertrouwelijkheidaanduiding: "openbaar",
|
||||
Zaaktype: zaaktype!,
|
||||
Startdatum: DateOnly.FromDateTime(DateTime.UtcNow),
|
||||
Identificatie: Guid.NewGuid().ToString()));
|
||||
|
||||
var content = System.Text.Encoding.UTF8.GetBytes("%PDF-1.4 synthetic diploma\n");
|
||||
var documentUrl = await gateway.StoreDocumentAsync(new DocumentRequest(
|
||||
Bronorganisatie: "517439943",
|
||||
Informatieobjecttype: informatieobjecttype!,
|
||||
Vertrouwelijkheidaanduiding: "openbaar",
|
||||
Zaak: zaakUrl,
|
||||
Creatiedatum: DateOnly.FromDateTime(DateTime.UtcNow),
|
||||
Titel: "Diploma",
|
||||
Auteur: "zorgprofessional",
|
||||
Taal: "nld",
|
||||
Bestandsnaam: "diploma.pdf",
|
||||
Formaat: "application/pdf",
|
||||
Inhoud: content));
|
||||
|
||||
// The gateway returns the canonical informatieobject URL...
|
||||
Assert.StartsWith(
|
||||
new Uri(stack.BaseUrl, "/documenten/api/v1/enkelvoudiginformatieobjecten/").ToString(),
|
||||
documentUrl.ToString());
|
||||
|
||||
// ...the document is really persisted with the default-filled fields...
|
||||
var doc = await stack.GetJsonAsync(documentUrl);
|
||||
Assert.Equal("diploma.pdf", doc.GetProperty("bestandsnaam").GetString());
|
||||
Assert.Equal(informatieobjecttype.ToString(), doc.GetProperty("informatieobjecttype").GetString());
|
||||
Assert.Equal(content.Length, doc.GetProperty("bestandsomvang").GetInt32());
|
||||
|
||||
// ...and it is related to the zaak (a zaakinformatieobject links the two).
|
||||
var relations = await stack.GetJsonAsync(new Uri(stack.BaseUrl,
|
||||
"/zaken/api/v1/zaakinformatieobjecten?informatieobject=" + Uri.EscapeDataString(documentUrl.ToString())));
|
||||
Assert.Contains(relations.EnumerateArray(),
|
||||
r => r.GetProperty("zaak").GetString() == zaakUrl.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,6 +56,11 @@ test('DigiD submit → public INGEDIEND → documenten → behandelaar goedkeurt
|
||||
// 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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user