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
390 px sweep: routes without a sample get a not-found one by themselves; demo chats are checked
Claudeb163c69a6f15
diff --git a/tests/assist-polish.test.ts b/tests/assist-polish.test.tsindex 8ac2f1bf..36f15c9a 100644--- a/tests/assist-polish.test.ts+++ b/tests/assist-polish.test.ts@@ -32,11 +32,35 @@ describe("the 390 px sweep visits dynamic routes", () => {const { routes, patterns } = studioRoutes(root) as { routes: string[]; patterns: string[] };expect(routes).toContain("/assist/skills");expect(patterns).toEqual(expect.arrayContaining(["/audio/[mode]", "/video-tools/[mode]", "/upscale/[mode]", "/cinema/[id]", "/canvas/[id]", "/apps/[id]", "/assist/projects/[id]"]));- const { urls, unsampled } = dynamicSamples(root, { cinema: "c1", canvas: "v1", assistProject: "p1" }) as { urls: string[]; unsampled: string[] };- expect(unsampled).toEqual([]);+ const { urls, byPattern } = dynamicSamples(root, { cinema: "c1", canvas: "v1", assistProject: "p1" }) as { urls: string[]; byPattern: Record<string, string[]> };+ // Every dynamic route is visited at least once, and no sample still has a [param] in it.+ for (const p of patterns) expect(byPattern[p]?.length, p).toBeGreaterThan(0);+ expect(urls.filter((u) => /\[/.test(u))).toEqual([]);expect(urls).toEqual(expect.arrayContaining(["/cinema/c1", "/cinema/does-not-exist", "/canvas/v1", "/canvas/does-not-exist", "/assist/projects/p1", "/apps/does-not-exist"]));});+ it("gives a route added later (another branch's /faceless/[id]/[episode]) a not-found sample by itself", () => {+ const tmp = fs.mkdtempSync(path.join(os.tmpdir(), "fuobe-routes-"));+ const page = (rel: string) => {+ fs.mkdirSync(path.join(tmp, "src/app/(studio)", rel), { recursive: true });+ fs.writeFileSync(path.join(tmp, "src/app/(studio)", rel, "page.tsx"), "export default function P() { return null; }\n");+ };+ fs.mkdirSync(path.join(tmp, "src/lib"), { recursive: true });+ fs.writeFileSync(path.join(tmp, "src/lib/hubs.ts"), "export const HUB_MODES = {\n};\n");+ for (const r of ["faceless", "faceless/[id]", "faceless/[id]/[episode]", "faceless/[id]/new", "cinema/[id]", "docs/[...slug]"]) page(r);+ try {+ const { byPattern, generated } = dynamicSamples(tmp, { cinema: "c1" }) as { byPattern: Record<string, string[]>; generated: string[] };+ expect(byPattern["/faceless/[id]"]).toEqual(["/faceless/does-not-exist"]);+ expect(byPattern["/faceless/[id]/[episode]"]).toEqual(["/faceless/does-not-exist/does-not-exist"]);+ expect(byPattern["/faceless/[id]/new"]).toEqual(["/faceless/does-not-exist/new"]);+ expect(byPattern["/docs/[...slug]"]).toEqual(["/docs/does-not-exist"]);+ expect(byPattern["/cinema/[id]"]).toEqual(["/cinema/c1", "/cinema/does-not-exist"]);+ expect(generated.sort()).toEqual(["/docs/[...slug]", "/faceless/[id]", "/faceless/[id]/[episode]", "/faceless/[id]/new"]);+ } finally {+ fs.rmSync(tmp, { recursive: true, force: true });+ }+ });+it("reads every hub mode from src/lib/hubs.ts (the first mode is the hub's own page)", () => {const expected = Object.entries(HUB_MODES).flatMap(([hub, modes]) => modes.slice(1).map((m) => `/${hub}/${m.id}`));expect((hubModePaths(root) as string[]).sort()).toEqual(expected.sort());diff --git a/tests/e2e/_routes.mjs b/tests/e2e/_routes.mjsindex 2c5c5250..cad760b2 100644--- a/tests/e2e/_routes.mjs+++ b/tests/e2e/_routes.mjs@@ -36,7 +36,10 @@ export function hubModePaths(root) {/*** Sample URLs for the dynamic patterns. `ids` holds ids created for the run (cinema, canvas,- * assistProject). Unknown ids are included on purpose: their not-found pages must fit too.+ * assistProject). Unknown ids are included on purpose: their not-found pages must fit too. A+ * pattern with no explicit sample (a route another branch adds) gets one with "does-not-exist"+ * for each [param], so every dynamic page is visited at least through its not-found state;+ * `generated` lists those patterns.*/export function dynamicSamples(root, ids = {}) {const samples = {@@ -49,12 +52,18 @@ export function dynamicSamples(root, ids = {}) {const hubs = hubModePaths(root);const { patterns } = studioRoutes(root);const urls = [];- const unsampled = [];+ const byPattern = {};+ const generated = [];for (const p of patterns) {const hub = /^\/([\w-]+)\/\[mode\]$/.exec(p);- const list = hub ? hubs.filter((h) => h.startsWith(`/${hub[1]}/`)) : (samples[p] ?? []).filter(Boolean);- if (!list.length) unsampled.push(p);+ let list = hub ? hubs.filter((h) => h.startsWith(`/${hub[1]}/`)) : (samples[p] ?? []).filter(Boolean);+ if (!list.length) {+ // [id], [...slug] and [[...slug]] alike: one unknown value per segment.+ list = [p.replace(/\[\[?(?:\.\.\.)?[\w-]+\]?\]/g, "does-not-exist")];+ generated.push(p);+ }+ byPattern[p] = list;urls.push(...list);}- return { urls, unsampled };+ return { urls, byPattern, generated };}diff --git a/tests/e2e/no-horizontal-scroll.mjs b/tests/e2e/no-horizontal-scroll.mjsindex b4c08553..bd95ff41 100644--- a/tests/e2e/no-horizontal-scroll.mjs+++ b/tests/e2e/no-horizontal-scroll.mjs@@ -6,7 +6,8 @@// Every page under src/app/(studio) is visited, dynamic segments with samples from tests/e2e/_routes.mjs:// every studio hub mode (/audio/music, /video-tools/join…), real ids (a cinema project, a canvas and an// Assist project are created for the purpose) and unknown ids (their not-found pages must fit too),-// plus /login and an unknown URL (the 404 page). A dynamic route without a sample is named. For each route it+// plus two demo Assist chats (an approval card, and results), /login and an unknown URL (the 404 page). A+// dynamic route without a sample is visited with "does-not-exist" for each segment, and named. For each route it// asserts document.documentElement.scrollWidth === clientWidth once the page has rendered, and names// the widest elements when it isn't. Pages that don't load are reported apart from layout failures.import { launch, openRoute, PHONE, post, root } from "./_browser.mjs";@@ -23,12 +24,18 @@ async function discoverRoutes() {const project = await post(app, "/api/cinema/projects", { name: "Layout check" });const canvas = await post(app, "/api/canvases", { name: "Layout check" });const assistProject = await post(app, "/api/assist/projects", { name: "Layout check" });- const { urls, unsampled } = dynamicSamples(root, { cinema: project?.id, canvas: canvas?.id, assistProject: assistProject?.id });- const samples = [...urls, "/library?tab=favorites", "/login", "/this-page-does-not-exist"];+ // Two demo chats: one waiting on its approval card, one that ran by itself (results in the chat).+ const brief = "4 product photos of a matte black perfume bottle on wet stone";+ const askFirst = await post(app, "/api/assist", { text: brief, engine: "cloud", mode: { mode: "free" } });+ const autoRun = await post(app, "/api/assist", { text: brief, engine: "cloud", autoApprove: true, mode: { mode: "free" } });+ const { urls, generated } = dynamicSamples(root, { cinema: project?.id, canvas: canvas?.id, assistProject: assistProject?.id });+ const chats = [askFirst?.id, autoRun?.id].filter(Boolean).map((id) => `/assist?c=${id}`);+ const samples = [...urls, ...chats, "/library?tab=favorites", "/login", "/this-page-does-not-exist"];if (!project?.id) console.log("note: couldn't create a sample cinema project, only an unknown /cinema/[id] is checked");if (!canvas?.id) console.log("note: couldn't create a sample canvas, only an unknown /canvas/[id] is checked");if (!assistProject?.id) console.log("note: couldn't create a sample Assist project, only an unknown /assist/projects/[id] is checked");- for (const p of unsampled) console.log(`note: ${p} has no sample in tests/e2e/_routes.mjs, so it isn't checked`);+ if (chats.length < 2) console.log("note: couldn't start the sample Assist chats, so /assist?c=<id> isn't fully checked");+ for (const p of generated) console.log(`note: ${p} has no sample in tests/e2e/_routes.mjs: only its not-found page is checked`);return [...new Set([...out, ...samples])];}