From 305fc6c2114f15fe7626f29c97523d9f533fd210 Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 4 Dec 2026 06:54:05 +0000 Subject: [PATCH] test(ui-e2e): the Setup navigation auditor set is saved into a package of its own A new metadata item names a writable package (ADR-0070 D1), so the live helper authors (or finds) one fixed e2e package and saves the auditor's permission set into it with ?package=. Claude-Session: https://claude.ai/code/session_01L9qibxRrrjrsQAWAcsbV46 Co-authored-by: Claude --- ui/e2e/live/helpers/setup-nav-39060.ts | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/ui/e2e/live/helpers/setup-nav-39060.ts b/ui/e2e/live/helpers/setup-nav-39060.ts index 84e304d5b5a..5e9942c8904 100644 --- a/ui/e2e/live/helpers/setup-nav-39060.ts +++ b/ui/e2e/live/helpers/setup-nav-39060.ts @@ -35,12 +35,35 @@ export const SETUP = '/apps/setup'; export const AUDITOR_PERMISSION_SET = 'e2e_setup_auditor_39060'; const AUDITOR_CAPABILITIES = ['setup.access', 'view_all_audit_log']; +/** + * The package the auditor's permission set is saved into. A new metadata item + * names a writable package (objectstack ADR-0070 D1) and the showcase is + * provided by code, so this file authors a package of its own, the way the + * Studio live specs do. One fixed id, so every test (and every project run in + * parallel) authors or finds the same package and the same set. + */ +const AUDITOR_PACKAGE = 'com.e2e.setupauditor39060'; + +/** Author the auditor's package, or find it when an earlier test already did. */ +async function authorAuditorPackage(admin: APIRequestContext): Promise { + const exists = async () => (await admin.get(`${API}/api/v1/packages/${AUDITOR_PACKAGE}`)).ok(); + if (await exists()) return AUDITOR_PACKAGE; + const res = await admin.post(`${API}/api/v1/packages`, { + data: { manifest: { id: AUDITOR_PACKAGE, name: 'E2E Setup Auditor', version: '0.1.0', type: 'app' } }, + }); + // A parallel test may have authored it between the read and the install, + // which answers 409; the package then exists, and that is all this needs. + expect(res.ok() || (await exists()), `authoring ${AUDITOR_PACKAGE}: ${await res.text()}`).toBe(true); + return AUDITOR_PACKAGE; +} + /** * Author (or find) the auditor's permission set and sign a member holding it * in. `admin` is the spec's `request` fixture (the global setup's admin). */ export async function signInAuditor(admin: APIRequestContext): Promise { - const saved = await admin.put(`${API}/api/v1/meta/permission/${AUDITOR_PERMISSION_SET}`, { + const pkgId = await authorAuditorPackage(admin); + const saved = await admin.put(`${API}/api/v1/meta/permission/${AUDITOR_PERMISSION_SET}?package=${pkgId}`, { data: { name: AUDITOR_PERMISSION_SET, label: 'E2E Setup Auditor',