From 2d60f597b59c78f3c49f53e14fbae3aa517023e0 Mon Sep 17 00:00:00 2001 From: Nicolas CHAUVIN Date: Fri, 11 Sep 2026 14:39:26 +0200 Subject: [PATCH] fix(e2e): let each captured flow file under its own category --- apps/web/e2e/capture.spec.ts | 2 +- apps/web/e2e/push.ts | 27 ++++++++++++--------------- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/apps/web/e2e/capture.spec.ts b/apps/web/e2e/capture.spec.ts index e9bfb4a..0d9e57a 100644 --- a/apps/web/e2e/capture.spec.ts +++ b/apps/web/e2e/capture.spec.ts @@ -281,6 +281,6 @@ test.describe('judging a capture', () => { } expect(recordings).toHaveLength(2) - await push('judging a capture', shots, recordings) + await push('judging a capture', shots, recordings, 'review') }) }) diff --git a/apps/web/e2e/push.ts b/apps/web/e2e/push.ts index fdff3f9..88946b0 100644 --- a/apps/web/e2e/push.ts +++ b/apps/web/e2e/push.ts @@ -63,7 +63,7 @@ export type Recording = { variant: Record; bytes: Buffer } * case, and a fresh case each run would leave a book full of one-run cases with * nothing to compare against. */ -async function caseFor(title: string): Promise { +async function caseFor(title: string, category: string): Promise { const listed = (await (await call(`/projects/${PROJECT}/cases`)).json()) as { id: string title: string @@ -75,25 +75,17 @@ async function caseFor(title: string): Promise { await call(`/projects/${PROJECT}/cases`, { method: 'POST', headers: { 'content-type': 'application/json' }, - body: JSON.stringify({ title, categoryId: await categoryFor(CATEGORY) }), + body: JSON.stringify({ title, categoryId: await categoryFor(category) }), }) ).json()) as { id: string } return made.id } /** - * The branch these captures hang from. - * - * A case belongs to exactly one category, and the catalogue only lists the - * cases of a named one — a case filed nowhere is a case no screen can show - * (#115). Named here rather than configured: these are ozalid's own screens, - * and where they belong is not a deployment decision. - * - * `account`, not `ozalid`: the project is already called ozalid, and a branch - * repeating its project's name sorts nothing. The flow captured here is the - * account one — signing in. + * The branch a flow's captures hang from: named by the flow itself (#245) — + * a case belongs to exactly one category, and "where it belongs" is what the + * flow knows, not a constant of the pusher. Found or made at the root. */ -const CATEGORY = 'account' async function categoryFor(name: string): Promise { const tree = (await (await call(`/projects/${PROJECT}/categories`)).json()) as { @@ -115,9 +107,14 @@ async function categoryFor(name: string): Promise { } /** Upload what the store does not already hold, and push one edition. */ -export async function push(title: string, shots: Shot[], recordings: Recording[] = []) { +export async function push( + title: string, + shots: Shot[], + recordings: Recording[] = [], + category = 'account', +) { expect(shots.length, 'nothing was captured').toBeGreaterThan(0) - const caseId = await caseFor(title) + const caseId = await caseFor(title, category) // One step per screen, one capture per variant. The order of the steps is the // order they were walked, which is what makes the grid read as the flow.