From 9ff3dc68ce504ed94203b7c87dd15dab03c6d64d Mon Sep 17 00:00:00 2001 From: 134 Date: Thu, 13 Aug 2026 16:32:25 +0800 Subject: [PATCH] test(canvas): guard PSD template toolbar entry --- playwright.helpers.config.ts | 1 + .../routes/canvas-psd-template-entry.test.ts | 26 +++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 tests/routes/canvas-psd-template-entry.test.ts diff --git a/playwright.helpers.config.ts b/playwright.helpers.config.ts index 8267ac79c..3717de6ce 100644 --- a/playwright.helpers.config.ts +++ b/playwright.helpers.config.ts @@ -12,6 +12,7 @@ export default defineConfig({ /routes\/settings-visual-consistency\.test\.ts/, /routes\/canvas-scale-adjust-intent\.test\.ts/, /routes\/canvas-runtime-internal-endpoint\.test\.ts/, + /routes\/canvas-psd-template-entry\.test\.ts/, /routes\/model-classification\.test\.ts/, /routes\/model3d-style-pro-regressions\.test\.ts/, /routes\/clawd-request-lifecycle\.test\.ts/, diff --git a/tests/routes/canvas-psd-template-entry.test.ts b/tests/routes/canvas-psd-template-entry.test.ts new file mode 100644 index 000000000..5b267bb4a --- /dev/null +++ b/tests/routes/canvas-psd-template-entry.test.ts @@ -0,0 +1,26 @@ +import { readFileSync } from "node:fs"; +import { resolve } from "node:path"; +import { expect, test } from "@playwright/test"; + +function readSource(path: string) { + return readFileSync(resolve(process.cwd(), path), "utf8"); +} + +test.describe("canvas PSD template replacement entry", () => { + test("keeps the selected-image toolbar action and launch flow wired", () => { + const imageNode = readSource("components/canvas/nodes/ImageNode.tsx"); + const workspace = readSource("components/canvas/CanvasWorkspace.tsx"); + + expect(imageNode).toContain( + 'getCanvasToolbarItem(\n canvasToolbarConfig,\n "imagePsdTemplateReplace"' + ); + expect(imageNode).toContain('isSelectedImageActionInline("psdTemplate")'); + expect(imageNode).toContain('isSelectedImageActionInMore("psdTemplate")'); + expect(imageNode).toContain('handleAction("psd-template")'); + expect(imageNode).toContain("handleOpenPsdTemplateReplace"); + expect(imageNode).toContain("/psd-template?launch="); + expect(workspace).toContain( + 'requestImageNodeAction(selectedImageNodes[0].id, "psd-template")' + ); + }); +});