Files
olivv-cs-ComfyUI-FunPack/app/tests-layout/prompt.spec.js
T
digital-garbageandClaude Sonnet 5 6303f1312c fix: retire the stale composer layout suite, close a registry test gap
Two real findings from adversarial review of the previous commit (the v4
UI port's route change), both fixed:

- app/tests-layout/*.spec.js (20 files, 133 tests): every one of these
  navigated to /funpack/ and asserted on composer-specific DOM
  (.cx-workspace*, window.FunPack) that no longer exists there now that
  the ported v4 frontend is served at that URL instead. Left as-is they
  would silently time out on every run. Each file now carries an explicit
  test.skip(true, "...") with a comment explaining why and pointing at
  the plan's pixel-exactness step, which is what will eventually rewrite
  these against the new DOM -- declared and tracked, not quietly broken.

- core/tests/test_registry.py's fixture-based tests never exercised the
  new category field through the real announcement_of()/scan() path --
  only test_schema.py's direct validate() calls did, which bypass
  registry.py's FIELDS name-mapping entirely. A typo there (e.g.
  "Category" instead of "CATEGORY") would have passed every existing
  test. The "good module" fixture gained CATEGORY = "guidance" and
  test_the_good_module_loads now asserts on it, closing the gap.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-15 00:21:18 +03:00

72 lines
3.4 KiB
JavaScript

// The prompt, where it has a box model and a real server.
//
// jsdom covers what the controls DO. What only a browser can answer is whether
// the pipeline the real server serves actually puts them there.
import { test, expect } from "@playwright/test";
// Skipped: / now serves the ported v4 frontend (app/legacy/), not composer --
// these specs assert on .cx-workspace*/window.FunPack, which no longer exist
// on the served page. Pending rewrite against the v4-derived DOM as part of
// the v4-UI-onto-v5-backend port's pixel-exactness verification step (see
// the plan file). Not deleted: the assertions are still the right SHAPE of
// check, just against selectors this page no longer has.
test.skip(true, "composer retired in favor of the v4 UI port -- rewrite against app/legacy's DOM");
const openConstructor = (page) =>
page.locator(".cx-panel-head").getByRole("button", { name: "Constructor" }).click();
test("the prompt is written in the Constructor, and typing in it is what runs", async ({ page }) => {
// The prompt is a slot input like any other. Until it was wired the only way
// to type one was to open the pipeline window and find the node; it now has a
// window of its own, opened from the timeline that a run fills.
await page.goto("/funpack/");
await page.waitForFunction(() => window.FunPack !== undefined);
// Negative prompt lives on the Project tab now, not the Constructor -- a
// real textarea in the DOM (the Scene tab is the default, so it is hidden,
// not absent), which is why this checks what is VISIBLE, not what exists.
await expect(page.locator("textarea:visible"), "the prompt is on the main window").toHaveCount(0);
await openConstructor(page);
const boxes = page.locator(".cx-modal textarea");
await expect(boxes).toHaveCount(1);
await boxes.first().fill("a cat on a rooftop");
await boxes.first().blur(); // a control commits on blur
const sent = await page.evaluate(async () => {
const body = JSON.stringify({ inputs: window.FunPack.prompts() });
const res = await fetch("/funpack/api/pipeline",
{ method: "POST", headers: { "Content-Type": "application/json" }, body });
return res.json();
});
const positive = sent.slots.find((s) => s.id === "positive");
expect(sent.refused).toEqual([]);
expect(positive.inputs.text).toBe("a cat on a rooftop");
expect(positive.inputs.clip, "the wiring was replaced by a value").toEqual(["clip", 0]);
});
test("what was typed is still there the next time the window opens", async ({ page }) => {
await page.goto("/funpack/");
await page.waitForFunction(() => window.FunPack !== undefined);
await openConstructor(page);
await page.locator(".cx-modal textarea").first().fill("a cat on a rooftop");
await page.locator(".cx-modal textarea").first().blur();
await page.locator(".cx-modal").getByRole("button", { name: "Done" }).click();
await expect(page.locator(".cx-modal")).toHaveCount(0);
await openConstructor(page);
await expect(page.locator(".cx-modal textarea").first()).toHaveValue("a cat on a rooftop");
});
test("a region that filled does not keep its stand-in", async ({ page }) => {
await page.goto("/funpack/");
await page.waitForFunction(() => window.FunPack !== undefined);
await openConstructor(page);
const modal = page.locator(".cx-modal");
await expect(modal.locator("textarea")).toHaveCount(1);
await expect(modal.getByText("Nothing to write yet")).toHaveCount(0);
});