Files
olivv-cs-ComfyUI-FunPack/app/tests-layout/logwindow.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

92 lines
3.9 KiB
JavaScript

// The log panel, against the real route.
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 openLog = async (page) => {
await page.getByRole("button", { name: "Settings" }).click();
await page.locator(".cx-filter-row", { hasText: "ComfyUI log" }).click();
await expect(page.locator(".cx-modal")).toBeVisible();
};
test("the log shows real lines and says which file they came from", async ({ page }) => {
await page.goto("/funpack/");
await page.waitForFunction(() => window.FunPack !== undefined);
const real = await page.evaluate(async () => (await fetch("/funpack/api/log?limit=5")).json());
await openLog(page);
if (real.path) {
await expect(page.locator(".cx-modal-foot")).toContainText(real.path);
await expect(page.locator(".cx-code-block")).toContainText(real.lines.at(-1).slice(0, 30));
} else {
await expect(page.locator(".cx-code-block")).toContainText(real.detail);
}
});
test("no log file reads as a reason, not as a quiet log", async ({ page }) => {
await page.goto("/funpack/");
await page.waitForFunction(() => window.FunPack !== undefined);
await page.route("**/api/log**", (route) => route.fulfill({
json: { lines: [], path: null,
detail: "ComfyUI is not writing a log file here, so there is nothing to show." },
}));
await openLog(page);
await expect(page.locator(".cx-code-block")).toContainText("not writing a log file");
});
test("it keeps the last lines when the server goes away", async ({ page }) => {
// The most interesting thing a log can say is that the server just died --
// and replacing the lines from just before it went with an error message
// throws away the only evidence of why.
await page.goto("/funpack/");
await page.waitForFunction(() => window.FunPack !== undefined);
await page.route("**/api/log**", (route) => route.fulfill({
json: { lines: ["the line before it went"], path: "/x/comfyui.log", detail: "" },
}));
await openLog(page);
await expect(page.locator(".cx-code-block")).toContainText("the line before it went");
await page.unroute("**/api/log**");
await page.route("**/api/log**", (route) => route.abort());
await expect(page.locator(".cx-modal-foot")).toContainText(/Cannot reach ComfyUI/i);
await expect(page.locator(".cx-code-block"), "the last lines were thrown away")
.toContainText("the line before it went");
});
test("it stops redrawing while text is being selected", async ({ page }) => {
// Copying a stack trace is the one thing anybody opens a log to do, and a
// panel that redraws under the drag makes it impossible.
await page.goto("/funpack/");
await page.waitForFunction(() => window.FunPack !== undefined);
let served = 0;
await page.route("**/api/log**", (route) => {
served += 1;
return route.fulfill({ json: { lines: [`line ${served}`], path: "/x", detail: "" } });
});
await openLog(page);
await expect(page.locator(".cx-code-block")).toContainText("line 1");
await page.evaluate(() => {
const pre = document.querySelector(".cx-code-block");
const range = document.createRange();
range.selectNodeContents(pre);
const sel = getSelection();
sel.removeAllRanges();
sel.addRange(range);
});
const held = await page.locator(".cx-code-block").textContent();
await page.waitForTimeout(2600); // more than one poll
expect(await page.locator(".cx-code-block").textContent(),
"the panel redrew under a selection").toBe(held);
});