The open creative studio on ComfyUI: images, video, 3D and audio on open weights, on your own GPU or the cloud. Camera motions, effects, apps, Cinema, Layers, Image to 3D and an AI agent.
TypeScript ai-videocomfyuicreative-toolsgenerative-aiideogramimage-generationimage-to-3dimage-to-videoltx-videominimax-h3nextjsopen-sourceopen-weightsqwen-imagetext-to-imagevideo-generationwan
Layout N7-2: Reuse round trip in the tests and the composer e2e script
Claude3526b4d3d9c0
diff --git a/tests/e2e/composer-flows.mjs b/tests/e2e/composer-flows.mjsindex 3f6a8029..609038b7 100644--- a/tests/e2e/composer-flows.mjs+++ b/tests/e2e/composer-flows.mjs@@ -11,7 +11,7 @@// line only while its tiles are folded away.// 7. Layout mode (Image studio, MOSS-Image in the cloud, demo mode): draw one box by mouse and one by touch at// 390 px, a Text box asks for its words, Generate sends the layout (compiled at the size fal renders, prompt-// expansion off) and the feed says "Layout · 1 box"; Edit layout from the tile reopens the boxes.+// expansion off) and the feed says "Layout · 1 box"; Reuse and Edit layout from the tile reopen the boxes.//// Playwright: the `playwright` (or `playwright-core`) package if it resolves, else the global install at// /opt/node22/lib/node_modules. Chromium: $CHROMIUM_PATH, else the newest /opt/pw-browsers/chromium-*.@@ -269,6 +269,14 @@ async function ready(page, url) {check("layout: the feed says it's a layout", await tile.waitFor({ timeout: 30_000 }).then(() => true, () => false));const preview = await page.request.post(`${app}/api/generations?preview=1`, { data: body }).then((r) => r.json()).catch(() => ({}));check("layout: the run gets the compiled MOSS prompt", typeof preview.prompt === "string" && preview.prompt.includes('"bbox_coord_space":"abs_centralized"'), (preview.prompt ?? preview.error ?? "").slice(0, 80));+ // Reuse: with Layout mode off and the prompt cleared, the run comes back as boxes with its caption.+ await page.getByRole("button", { name: "Layout off" }).click();+ await page.locator("[data-composer] textarea").fill("");+ await tile.locator("header").hover();+ await tile.getByRole("button", { name: "Reuse" }).click();+ await page.locator("[data-layout-strip]").waitFor({ timeout: 10_000 }).catch(() => {});+ const reused = await page.locator("[data-layout-strip]").innerText().catch(() => "");+ check("layout: Reuse brings the boxes and the caption back", /1 box/.test(reused) && (await page.locator("[data-composer] textarea").inputValue()) === "A candle sale poster");await page.waitForFunction(() => document.querySelector("[data-gen-id] img, [data-gen-id] video"), null, { timeout: 60_000 }).catch(() => {});const t = tile.locator(".group\\/tile").first();await t.hover();diff --git a/tests/layout-mode.test.ts b/tests/layout-mode.test.tsindex a66e30c5..0a365808 100644--- a/tests/layout-mode.test.ts+++ b/tests/layout-mode.test.ts@@ -248,6 +248,23 @@ describe("Edit layout", () => {});});+describe("Reuse", () => {+ it("round-trips: the request the composer sends comes back as the same boxes and words, and plans to the same prompt", () => {+ const asked = sent(poster, "A candle sale poster", { aspectRatio: "16:9", seed: 12 });+ const stored = JSON.parse(JSON.stringify(asked)) as typeof asked;+ const back = withoutLayout(stored.params);+ expect(back.params).toEqual({ aspectRatio: "16:9", seed: 12, extra: undefined });+ expect(back.layout?.items).toEqual(poster.items);+ // The composer sends it again from Layout mode: the same compiled prompt at the same size.+ const again = sent({ ...back.layout!, summary: { ...back.layout!.summary, caption: "" } }, stored.prompt, back.params);+ const a = plan("oss-moss-image", asked.params, asked.prompt);+ const b = plan("oss-moss-image", again.params, again.prompt);+ expect(b.prompt).toBe(a.prompt);+ expect(b.params.extra).toMatchObject({ width: 1360, height: 768 });+ expect(b.params.seed).toBe(12);+ });+});+describe("the editor's box maths", () => {// Whole pixels at this size: boxes snap to the canvas's pixels.const W = 1000;