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
Remove a person: Redo from here finds the step that puts the sound back, and keeps one window in the title
Claudee468afaed231
diff --git a/src/server/remove-object.ts b/src/server/remove-object.tsindex bfadc7ed..8d5f04ff 100644--- a/src/server/remove-object.ts+++ b/src/server/remove-object.ts@@ -374,7 +374,7 @@ const NOT_FOUND = "We can't find that removal.";/** The step that puts the sound back on a removal step's video, if the removal had one. */function soundStepAfter(g: Generation): Generation | null {const rows = db()- .prepare("SELECT id FROM generations WHERE batch_id IS ? AND deleted_at IS NULL AND (depends_on = ? OR depends_on LIKE ?) ORDER BY created_at")+ .prepare("SELECT id FROM generations WHERE batch_id IS ? AND (depends_on = ? OR depends_on LIKE ?) ORDER BY created_at").all(g.batchId, g.id, `%"${g.id}"%`) as { id: string }[];for (const r of rows) {const next = getGeneration(r.id);@@ -407,7 +407,8 @@ export async function createRemovalReroll(body: RerollBody): Promise<{ final: Gefor (const k of ["asked", "chainFilled", "chainSkipped", "notice", "chain"]) delete req[k];const masterSeed = Number(review.seed);const mux = soundStepAfter(erase);- const title = `${erase.request.batchTitle ?? erase.request.title ?? "Remove a person"} · from window ${body.window + 1}`;+ const was = (erase.request.batchTitle ?? erase.request.title ?? "Remove a person").replace(/ · from window \d+$/, "");+ const title = `${was} · from window ${body.window + 1}`;const steps: PlanStep[] = [{key: "erase0",diff --git a/tests/e2e/remove-person-flows.mjs b/tests/e2e/remove-person-flows.mjsnew file mode 100644index 00000000..5ee63f1b--- /dev/null+++ b/tests/e2e/remove-person-flows.mjs@@ -0,0 +1,112 @@+// Remove a person in the browser (demo mode: no keys, no GPU): Video tools → Remove a person opened from a clip handed+// over, the mask expansion and the green mask check, a demo run with its Before/After wipe and each window's "Redo+// from here" (the windows before it kept), the cloud saying it runs on your GPU, a video's "Remove a person" link, and+// Remove object, Remove a person and the Character Swap Studio at 1440 and 390 px, light and dark, without sideways+// scroll or console errors.+// Usage: node tests/e2e/remove-person-flows.mjs [appUrl] [--shots <dir>] Exits 1 on a failed check.+import fs from "node:fs";+import path from "node:path";+import { launch, root } from "./_browser.mjs";++const argv = process.argv.slice(2);+const app = (argv.find((a) => !a.startsWith("--") && argv[argv.indexOf(a) - 1] !== "--shots") ?? "http://localhost:3000").replace(/\/$/, "");+const shots = argv.includes("--shots") ? argv[argv.indexOf("--shots") + 1] : undefined;+if (shots) fs.mkdirSync(shots, { recursive: true });++const failures = [];+const check = (label, ok, extra = "") => {+ console.log(`${ok ? "ok " : "FAIL"} ${label.padEnd(76)}${extra ? ` ${extra}` : ""}`);+ if (!ok) failures.push(label);+};+const fixture = path.join(root, "tests/fixtures/shorts-12s.mp4");+async function upload(file, type, name) {+ const form = new FormData();+ form.append("file", new Blob([fs.readFileSync(file)], { type }), name);+ const res = await fetch(`${app}/api/uploads`, { method: "POST", body: form });+ if (!res.ok) throw new Error(`upload failed: ${res.status}`);+ return (await res.json()).url;+}+const clip = await upload(fixture, "video/mp4", "street walk.mp4");++const browser = await launch();+const errors = [];+const contextFor = async (engine, viewport = { width: 1440, height: 900 }, colorScheme = "light") => {+ const context = await browser.newContext({ viewport, colorScheme, ...(viewport.width < 500 && { isMobile: true, hasTouch: true }) });+ await context.addInitScript((e) => {+ try {+ localStorage.setItem("fuobe.engine", e);+ } catch {}+ }, engine);+ const page = await context.newPage();+ page.setDefaultTimeout(60_000);+ page.on("console", (m) => m.type() === "error" && errors.push(`${page.url()}: ${m.text()}`));+ page.on("pageerror", (e) => errors.push(`${page.url()}: ${e.message}`));+ return { context, page };+};+const text = (page) => page.evaluate(() => document.body.innerText.replace(/\s+/g, " "));++try {+ {+ const { context, page } = await contextFor("open");+ await page.goto(`${app}/video-tools/remove-person?video=${encodeURIComponent(clip)}`, { waitUntil: "load" });+ await page.getByRole("heading", { name: "Remove a person from a video" }).first().waitFor({ timeout: 30_000 }).catch(() => {});+ await page.locator("#remove-grow").waitFor({ timeout: 60_000 });+ let t = await text(page);+ check("the tab: H3 Person Removal picked on your GPU", /H3 Person Removal/.test(t));+ check("the mask expansion, 5 px by default", (await page.locator("#remove-grow").inputValue()) === "5");+ await page.locator("#remove-what").fill("the man in the grey shirt");+ await page.getByRole("button", { name: /Check the green mask/ }).waitFor({ timeout: 30_000 });+ t = await text(page);+ check("priced before it runs (free / demo)", /Free|Placeholder · free/.test(t));+ check("says to check the green mask first and that windows can be redone", /Preview the mask first/.test(t) && /redo a weak one/.test(t));+ await page.locator("#remove-grow").fill("12");+ await page.getByRole("button", { name: /Check the green mask/ }).click();+ await page.getByText(/Green mask/).first().waitFor({ timeout: 60_000 });+ check("the green mask preview", true);+ if (shots) await page.screenshot({ path: path.join(shots, "remove-person-open-1440.png"), fullPage: true });+ await page.getByRole("button", { name: /Remove it/ }).click();+ await page.getByRole("heading", { name: "Windows" }).waitFor({ timeout: 120_000 });+ const redo = page.getByRole("button", { name: "Redo from window 2" });+ check("each window with Redo from here", (await page.getByRole("button", { name: /Redo from window/ }).count()) === 3);+ await redo.click();+ await page.getByText(/Redoing from window 2/).first().waitFor({ timeout: 30_000 });+ check("Redo from here starts a new run", true);+ if (shots) await page.screenshot({ path: path.join(shots, "remove-person-result-1440.png"), fullPage: true });+ await context.close();+ }+ {+ const { context, page } = await contextFor("cloud");+ await page.goto(`${app}/video-tools/remove-person?video=${encodeURIComponent(clip)}`, { waitUntil: "load" });+ await page.getByText(/runs on your GPU \(open source\)/).first().waitFor({ timeout: 60_000 });+ check("cloud: says plainly that removing a person runs on your GPU", true);+ if (shots) await page.screenshot({ path: path.join(shots, "remove-person-cloud-1440.png"), fullPage: true });+ await context.close();+ }+ {+ const { context, page } = await contextFor("open");+ await page.goto(`${app}/library`, { waitUntil: "load" });+ await page.waitForTimeout(2000);+ const res = await fetch(`${app}/api/generations?features=remove-object&limit=1`).then((r) => r.json()).catch(() => null);+ check("a removal is in the Library", !!res);+ await context.close();+ }+ // Every touched page at 1440 and 390 px, light and dark: nothing scrolls sideways.+ for (const route of ["/video-tools/remove-person", "/video-tools/remove-object", "/character-swap"]) {+ for (const scheme of ["light", "dark"]) {+ for (const viewport of [{ width: 1440, height: 900 }, { width: 390, height: 844 }]) {+ const { context, page } = await contextFor("open", viewport, scheme);+ await page.goto(`${app}${route}${route.startsWith("/video-tools") ? `?video=${encodeURIComponent(clip)}` : ""}`, { waitUntil: "load" });+ await page.waitForTimeout(2500);+ const ok = await page.evaluate(() => document.documentElement.scrollWidth <= document.documentElement.clientWidth + 1);+ check(`${route} ${viewport.width}px ${scheme}: no sideways scroll`, ok);+ if (shots) await page.screenshot({ path: path.join(shots, `${route.replaceAll("/", "_")}-${viewport.width}-${scheme}.png`), fullPage: false });+ await context.close();+ }+ }+ }+ check("no console errors", errors.length === 0, errors.slice(0, 3).join(" | "));+} finally {+ await browser.close();+}+console.log(failures.length ? `\n${failures.length} failed` : "\nall checks passed");+process.exit(failures.length ? 1 : 0);