Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
72 changes: 72 additions & 0 deletions tests/e2e/workflows/catalog-ratings.spec.ts
Original file line number Diff line number Diff line change
@@ -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')
})
52 changes: 52 additions & 0 deletions tests/e2e/workflows/self-registration.spec.ts
Original file line number Diff line number Diff line change
@@ -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()
})
Loading