From e227051059bb7801dde4ea715ed283d55eb6f6d7 Mon Sep 17 00:00:00 2001 From: Ruben van der Linde Date: Sat, 21 Nov 2026 17:14:58 +0000 Subject: [PATCH 1/2] test(e2e): write the catalog-ratings and self-registration specs the change names catalog-ratings.spec.ts rates a seeded application 8 on its page and reads the review back as rating 8, pending (REQ-CLR-009). self-registration.spec.ts is written against the intake and marked fixme, because the public sign-up form (task 12) is not built. Neither has run against a live instance. Assisted-by: ClaudeCode:claude-opus-5-5 --- tests/e2e/workflows/catalog-ratings.spec.ts | 72 +++++++++++++++++++ tests/e2e/workflows/self-registration.spec.ts | 52 ++++++++++++++ 2 files changed, 124 insertions(+) create mode 100644 tests/e2e/workflows/catalog-ratings.spec.ts create mode 100644 tests/e2e/workflows/self-registration.spec.ts diff --git a/tests/e2e/workflows/catalog-ratings.spec.ts b/tests/e2e/workflows/catalog-ratings.spec.ts new file mode 100644 index 000000000..bdf9e0e78 --- /dev/null +++ b/tests/e2e/workflows/catalog-ratings.spec.ts @@ -0,0 +1,72 @@ +// SPDX-License-Identifier: EUPL-1.2 +// SPDX-FileCopyrightText: 2026 Conduction B.V. +/** + * Catalog ratings: a user rates an application on its page, and the review + * is saved with that rating and the status pending (REQ-CLR-009). + * + * Seeds one application carrying this run's RUN_ID through the OpenRegister + * API, opens its page, writes a review with rating 8 through the rendered + * "Write a review" dialog, and reads the saved review back through the API. + * Afterwards the review and the application are deleted. + * + * Written from the change's scenario; not yet run against a live instance. + * + * @spec openspec/changes/capability-rows-the-code-does-not-yet-meet/specs/catalog-ratings/spec.md#requirement-a-review-carries-a-rating-from-1-to-10-req-clr-009 + */ +import type { APIRequestContext } from '@playwright/test' +import type { VoorzieningenConfig } from './_fixtures.ts' + +import { expect, test } from '@playwright/test' +import { createObject, deleteObject, findAll, newApiContext, resolveConfig, RUN_ID } from './_fixtures.ts' +import { dismissSupportDialog, gotoAppRoute } from './_ui.ts' + +const REVIEW_SCHEMA = 'software-review' +const appName = `${RUN_ID} rated application` +const reviewTitle = `${RUN_ID} review` + +let apiCtx: APIRequestContext +let cfg: VoorzieningenConfig +let moduleId = '' + +test.describe.configure({ mode: 'serial' }) + +test.beforeAll(async () => { + apiCtx = await newApiContext() + cfg = await resolveConfig(apiCtx) + moduleId = await createObject(apiCtx, cfg.register, cfg.module_schema, { + name: appName, + shortDescription: 'E2E application to rate', + }) +}) + +test.afterAll(async () => { + if (!apiCtx) return + for (const review of await findAll(apiCtx, cfg.register, REVIEW_SCHEMA, RUN_ID)) { + const id = String((review as { id?: string }).id ?? (review as { '@self'?: { id?: string } })['@self']?.id ?? '') + if (id) await deleteObject(apiCtx, cfg.register, REVIEW_SCHEMA, id) + } + if (moduleId) await deleteObject(apiCtx, cfg.register, cfg.module_schema, moduleId) + await apiCtx.dispose() +}) + +// @e2e catalog-ratings::a-user-rates-an-application-they-use +test('a user rates an application on its page and the review is saved with rating 8, pending', async ({ page }) => { + await gotoAppRoute(page, `/modules/${moduleId}`) + await dismissSupportDialog(page) + await expect(page.getByText(appName).first()).toBeVisible({ timeout: 30000 }) + + await page.getByRole('button', { name: 'Write a review' }).first().click() + const dialog = page.getByRole('dialog', { name: 'Write a review' }) + await expect(dialog).toBeVisible() + await dialog.getByLabel('Title').fill(reviewTitle) + await dialog.getByLabel('Rating (1-10)').click() + await page.getByRole('option', { name: '8', exact: true }).click() + await dialog.getByLabel('Testimonial').fill('Works well for us.') + await dialog.getByRole('button', { name: 'Submit review' }).click() + await expect(dialog).toBeHidden({ timeout: 30000 }) + + const saved = (await findAll(apiCtx, cfg.register, REVIEW_SCHEMA, RUN_ID)).find((review) => review.name === reviewTitle) + expect(saved, 'the review is saved').toBeTruthy() + expect(saved?.rating).toBe(8) + expect(saved?.status).toBe('pending') +}) diff --git a/tests/e2e/workflows/self-registration.spec.ts b/tests/e2e/workflows/self-registration.spec.ts new file mode 100644 index 000000000..402d016bb --- /dev/null +++ b/tests/e2e/workflows/self-registration.spec.ts @@ -0,0 +1,52 @@ +// SPDX-License-Identifier: EUPL-1.2 +// SPDX-FileCopyrightText: 2026 Conduction B.V. +/** + * Self-registration: a visitor who is not signed in signs up an organisation + * through the public sign-up form, and the registration lands in the admin's + * moderation queue as pending (REQ in open-data-publishing, task 12). + * + * Task 12 is not built: stackiq serves no public page for the form yet, and + * where the form lives is an open decision. The scenario is written against + * the intake endpoint the form posts to (`POST /api/intake/register`) and is + * marked fixme until the form exists. The second scenario of the requirement + * (a generic create cannot skip the intake) is a server rule, covered by + * PHPUnit, not here. + * + * Written from the change's scenario; not yet run against a live instance. + * + * @spec openspec/changes/capability-rows-the-code-does-not-yet-meet/specs/open-data-publishing/spec.md + */ +import { expect, request as playwrightRequest, test } from '@playwright/test' +import { BASE_URL, deleteObject, findAll, newApiContext, resolveConfig, RUN_ID } from './_fixtures.ts' + +const supplier = `${RUN_ID} Leverancier B.V.` + +// @e2e open-data-publishing::a-supplier-signs-up-without-an-account +test.fixme('a supplier signs up without an account and appears as pending in the moderation queue', async ({ browser }) => { + // A visitor with no session at all. + const context = await browser.newContext({ baseURL: BASE_URL, storageState: { cookies: [], origins: [] } }) + const page = await context.newPage() + await page.goto('/index.php/apps/stackiq/sign-up', { waitUntil: 'domcontentloaded' }) + await page.getByLabel('Organisation name').fill(supplier) + await page.getByRole('button', { name: 'Send' }).click() + await expect(page.getByText('Registration received')).toBeVisible({ timeout: 30000 }) + await context.close() + + // The admin finds it pending. + const admin = await newApiContext() + const cfg = await resolveConfig(admin) + const found = (await findAll(admin, cfg.register, cfg.organisatie_schema, RUN_ID)).find((org) => org.name === supplier) + expect(found, 'the registration is stored').toBeTruthy() + expect(found?.registrationStatus).toBe('pending') + + // An anonymous caller cannot read it back. + const anonymous = await playwrightRequest.newContext({ baseURL: BASE_URL, storageState: { cookies: [], origins: [] } }) + const listed = await anonymous.get(`/index.php/apps/openregister/api/objects/${cfg.register}/${cfg.organisatie_schema}?_search=${encodeURIComponent(RUN_ID)}`) + const rows = listed.ok() ? ((await listed.json())?.results ?? []) : [] + expect((rows as Array<{ name?: string }>).map((row) => row.name)).not.toContain(supplier) + await anonymous.dispose() + + const id = String((found as { id?: string } | undefined)?.id ?? '') + if (id) await deleteObject(admin, cfg.register, cfg.organisatie_schema, id) + await admin.dispose() +}) From 7bcd52db86e05732ff55a8be7ea936c50dcf7ba3 Mon Sep 17 00:00:00 2001 From: Ruben van der Linde Date: Sat, 21 Nov 2026 17:17:42 +0000 Subject: [PATCH 2/2] docs(openspec): progress notes on tasks 10 and 12 of capability-rows Assisted-by: ClaudeCode:claude-opus-5-5 --- .../changes/capability-rows-the-code-does-not-yet-meet/tasks.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openspec/changes/capability-rows-the-code-does-not-yet-meet/tasks.md b/openspec/changes/capability-rows-the-code-does-not-yet-meet/tasks.md index a6dc1d510..64608e706 100644 --- a/openspec/changes/capability-rows-the-code-does-not-yet-meet/tasks.md +++ b/openspec/changes/capability-rows-the-code-does-not-yet-meet/tasks.md @@ -70,6 +70,7 @@ - **acceptance_criteria**: - REQ-CLR-005, 009, 011, 013, 014, 015, 016 and 017 each have a test that passes against the current code - [ ] Test +- Progress 21 Nov: `tests/e2e/workflows/catalog-ratings.spec.ts` (REQ-CLR-009) is written; like the other specs this task lists, it has not run against a live instance yet. ### Task 11: Open a vulnerability on its own page with the exposed organisations - **spec_ref**: openspec/changes/capability-rows-the-code-does-not-yet-meet/specs/module-vulnerability-tracking/spec.md @@ -82,6 +83,7 @@ - **files**: `src/views/public/SignUpView.vue`, `src/manifest.json`, `lib/Settings/softwarecatalogus_register.json` (organization authorization.create without public) - [ ] Implement - [ ] Test (Playwright `tests/e2e/workflows/self-registration.spec.ts`, PHPUnit `tests/Unit/Settings/OrganisationCreateRuleTest.php`) +- Open 21 Nov: stackiq serves no public (signed-out) page, so where the form lives is a decision (a public stackiq page, or the portal site posting to `POST /api/intake/register`). Dropping `public` from the organisation schema's create also needs the intake to save without RBAC, and a check that no other client creates organisations anonymously through the objects API. `tests/e2e/workflows/self-registration.spec.ts` is written against the intake and marked fixme until the form exists. ### Task 13: Record the requirements in the capability matrix - **spec_ref**: openspec/changes/capability-rows-the-code-does-not-yet-meet/proposal.md