Skip to content

armgit / fuobe

Public Imported from GitHub
0

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.

Canvas: the Skills tab and Save as skill pass the browser checks at 1440 and 390 px, light and dark

Claudeeb1d7128d1cf
diff --git a/src/components/canvas/canvas-list.tsx b/src/components/canvas/canvas-list.tsx
index 43fe59c2..0e2cb4a1 100644
--- a/src/components/canvas/canvas-list.tsx
+++ b/src/components/canvas/canvas-list.tsx
@@ -264,8 +264,15 @@ function ListInner({ templates }: { templates: TemplateCardData[] }) {
["skills", "Skills"],
] as const
).map(([k, label]) => (
- <button key={k} role="tab" aria-selected={tab === k} onClick={() => setTab(k)} className={cn("rounded-full px-3.5 transition-colors", tab === k ? "bg-background text-foreground shadow-soft" : "text-muted-foreground hover:text-foreground")}>
- {label}
+ <button key={k} role="tab" aria-selected={tab === k} onClick={() => setTab(k)} className={cn("rounded-full px-3.5 whitespace-nowrap transition-colors", tab === k ? "bg-background text-foreground shadow-soft" : "text-muted-foreground hover:text-foreground")}>
+ {k === "mine" ? (
+ <>
+ <span className="sm:hidden">Mine</span>
+ <span className="max-sm:hidden">{label}</span>
+ </>
+ ) : (
+ label
+ )}
</button>
))}
</div>
diff --git a/tests/e2e/canvas-smoke.mjs b/tests/e2e/canvas-smoke.mjs
index 6277b354..3053ee05 100644
--- a/tests/e2e/canvas-smoke.mjs
+++ b/tests/e2e/canvas-smoke.mjs
@@ -6,6 +6,9 @@
// 1. An edit followed at once by an in-app link (the debounce hasn't fired) reaches the server.
// 2. Renaming a canvas and then back to its first name is saved.
// 3. A result moved to the Trash from the Viewer leaves its node, and Run all makes it again.
+// 5. Skills as canvases (W5), at 1440 and 390 px, light and dark: the Skills tab lists a recipe skill, "Open as canvas"
+// draws it on a new canvas, and the run menu's "Save as skill…" opens the review (Varies kept), checks it for free and
+// saves it back into the skill, then opens its Run form. Nothing scrolls sideways.
// 4. --perf=N: a board of N nodes (prompt → image → video chains) loads, and typing in one prompt
// repaints within budget (prints keystroke → paint times; fails above 50 ms on average).
//
@@ -102,6 +105,75 @@ try {
);
await thumb.waitFor({ timeout: 60_000 });
+ // 5. Skills as canvases: a recipe skill on the Skills tab, opened as a canvas, saved back as a skill.
+ {
+ const NAME = "e2e-canvas-skill";
+ await fetch(`${app}/api/assist/skills/${NAME}`, { method: "DELETE" });
+ await api("/api/assist/skills", { method: "POST", body: JSON.stringify({ name: NAME, title: "E2E Canvas Skill", description: "A poster from a few words.", body: "# E2E Canvas Skill" }) });
+ const put = await api(`/api/assist/skills/${NAME}/recipe`, {
+ method: "PUT",
+ body: JSON.stringify({
+ fuobeRecipe: 1,
+ params: [{ id: "subject", label: "Subject", type: "text", required: true, example: "a red fox in snow" }],
+ steps: [{ key: "poster", kind: "generate", label: "Poster", request: { feature: "skill", modelId: "nano-banana-pro", op: "t2i", prompt: "{{subject}}, a bold travel poster", params: { aspectRatio: "3:4" } } }],
+ }),
+ });
+ check("the canvas skill is seeded", put.canvas?.ok === true, JSON.stringify(put.canvas ?? put.error));
+ const noSideScroll = (pg) => pg.evaluate(() => document.documentElement.scrollWidth <= document.documentElement.clientWidth);
+ const seen = (loc, timeout = 30_000) => loc.waitFor({ timeout }).then(() => true).catch(() => false);
+ let flowDone = false;
+ for (const [width, height] of [
+ [1440, 900],
+ [390, 844],
+ ]) {
+ for (const scheme of ["light", "dark"]) {
+ const tag = `${width} ${scheme}`;
+ const ctx = await browser.newContext({ viewport: { width, height }, colorScheme: scheme, ...(width < 500 ? { isMobile: true, hasTouch: true } : {}) });
+ const pg = await ctx.newPage();
+ pg.on("pageerror", (e) => failures.push(`${tag} page error: ${e.message}`));
+ pg.on("console", (m) => m.type() === "error" && failures.push(`${tag} console error: ${m.text().slice(0, 200)}`));
+ await pg.goto(`${app}/canvas?tab=skills`, { waitUntil: "load" });
+ const open = pg.getByRole("article").filter({ hasText: `/${NAME}` }).getByRole("button", { name: "Open as canvas" });
+ check(`${tag}: the Skills tab lists the skill with Open as canvas`, await seen(open));
+ check(`${tag}: the Skills tab doesn't scroll sideways`, await noSideScroll(pg));
+ if (!flowDone && width === 1440) {
+ await open.click();
+ await pg.waitForURL(/\/canvas\/[^/?]+$/, { timeout: 30_000 });
+ await pg.locator(".react-flow__node").first().waitFor({ timeout: 60_000 });
+ check(`${tag}: the canvas has the skill's input and step`, (await pg.locator(".react-flow__node").count()) === 2);
+ await pg.getByRole("button", { name: "More run options" }).click();
+ await pg.getByRole("menuitem", { name: /Save as skill/ }).click();
+ const dialog = pg.getByRole("dialog");
+ check(`${tag}: Save as skill opens the review`, await seen(dialog.getByRole("heading", { name: "Save as skill" }), 60_000));
+ check(`${tag}: it offers to save back into the skill`, await seen(dialog.getByText(`Save back into /${NAME}`)));
+ await dialog.getByRole("button", { name: /Check it/ }).click();
+ await dialog.getByRole("button", { name: "Save back" }).waitFor({ timeout: 90_000 });
+ const enabled = await pg
+ .waitForFunction(() => [...document.querySelectorAll('[role="dialog"] button')].some((b) => b.textContent?.includes("Save back") && !b.disabled), null, { timeout: 90_000 })
+ .then(() => true)
+ .catch(() => false);
+ check(`${tag}: the free check passes`, enabled);
+ check(`${tag}: the review doesn't scroll sideways`, await noSideScroll(pg));
+ await dialog.getByRole("button", { name: "Save back" }).click();
+ check(`${tag}: saved back, its Run form opens`, await seen(pg.getByText(/Saved back into/).first(), 60_000));
+ const after = await api(`/api/assist/skills/${NAME}/recipe`);
+ check(`${tag}: the skill kept its input and is checked`, after.recipe?.params?.[0]?.id === "subject" && after.ready?.length > 0, JSON.stringify(after.recipe?.params));
+ flowDone = true;
+ } else if (width < 500) {
+ // On a phone: the review fills the screen without scrolling sideways.
+ const c = await api("/api/canvases", { method: "POST", body: JSON.stringify({ skill: NAME }) });
+ await pg.goto(`${app}/canvas/${c.id}`, { waitUntil: "load" });
+ await pg.getByRole("button", { name: "More run options" }).click();
+ await pg.getByRole("menuitem", { name: /Save as skill/ }).click();
+ check(`${tag}: Save as skill opens the review on a phone`, await seen(pg.getByRole("dialog").getByText(`Save back into /${NAME}`), 60_000));
+ check(`${tag}: the review doesn't scroll sideways`, await noSideScroll(pg));
+ await fetch(`${app}/api/canvases/${c.id}`, { method: "DELETE" });
+ }
+ await ctx.close();
+ }
+ }
+ }
+
// 4. A big board stays responsive.
if (perf > 0) {
const chains = Math.ceil(perf / 3);