From e7981ddfbb193e9295361ac34537aa84751b19f3 Mon Sep 17 00:00:00 2001 From: akhil-vamshi-konam Date: Fri, 6 Nov 2026 17:13:29 +0530 Subject: [PATCH] test: fix collections pages and group-sync project mapping e2e payloads Both tests were sending payloads the server rejects with a 400: - collections: a collection holds only workspace wiki pages, and the test added a project-scoped page ("Page ... is not a workspace wiki page"). Create the page at the workspace path and archive+delete it on cleanup. - group-sync: project roles are admin/contributor/commenter/guest; there is no project "member" role ("Unknown project role slug"). Use "contributor". Test-only change; no SDK code touched. --- tests/e2e/v2/collections.e2e.test.ts | 12 ++++++++++-- tests/e2e/v2/group-sync.e2e.test.ts | 4 +++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/tests/e2e/v2/collections.e2e.test.ts b/tests/e2e/v2/collections.e2e.test.ts index 7bc4b8ff..7870617e 100644 --- a/tests/e2e/v2/collections.e2e.test.ts +++ b/tests/e2e/v2/collections.e2e.test.ts @@ -42,7 +42,9 @@ maybe("v2 collections (live)", () => { const collection = await wiki().collections.create(slug(), { name: uniqueName("collection-pages"), }); - const page = await suite.projectRow.pages.create({ + // A collection only holds workspace wiki pages — a project-scoped page is a 400 + // ("Page ... is not a workspace wiki page"), so create this one at the workspace path. + const page = await wiki().pages.create(slug(), { name: uniqueName("page-for-collection"), }); try { @@ -52,7 +54,13 @@ maybe("v2 collections (live)", () => { const removed = await wiki().collections.pages.remove(slug(), collection.id, [page.id]); expect(removed).toContain(page.id); } finally { - await suite.projectRow.pages.delete(page.id).catch(() => undefined); + // A workspace page must be archived (and unlocked) before it can be deleted. + await wiki() + .pages.update(slug(), page.id, { archived_at: new Date().toISOString(), is_locked: false }) + .catch(() => undefined); + await wiki() + .pages.delete(slug(), page.id) + .catch(() => undefined); await wiki() .collections.delete(slug(), collection.id) .catch(() => undefined); diff --git a/tests/e2e/v2/group-sync.e2e.test.ts b/tests/e2e/v2/group-sync.e2e.test.ts index e0de1a17..a8843138 100644 --- a/tests/e2e/v2/group-sync.e2e.test.ts +++ b/tests/e2e/v2/group-sync.e2e.test.ts @@ -27,7 +27,9 @@ maybe("GroupSync (v2, live)", () => { try { const created = await groupSync().projectMappings.create(slug(), { idp_group_name: `sdk-e2e-${Date.now()}`, - role_slug: "member", + // Project roles are admin/contributor/commenter/guest — there is no project `member` + // (that slug is a workspace role), so "member" here is a 400 "Unknown project role slug". + role_slug: "contributor", project_id: suite.projectId, }); createdId = created.id;