Files
ComfyUI_frontend/browser_tests/tests/subgraph-promoted-widget-dom.spec.ts
Alexander Brown 4b9c32d326 [backport core/1.41] fix: subgraph promoted widget input label rename (#10412)
Backport of #10195 to `core/1.41`.

## Summary

- Fix widget-input slot positioning for promoted subgraph inputs in both
LiteGraph and Vue rendering modes
- Sync `input.widget.name` with display name on label rename and initial
setup
- `_arrangeWidgetInputSlots` rewrite iterates `_concreteInputs` directly
- Add `promotedLabel` field to `SafeWidgetData` for correct label
display after rename

## Conflicts resolved

- `useGraphNodeManager.ts`: Added `tooltip` and `promotedLabel` fields
without `sourceExecutionId` (not on target branch)
- `SubgraphNode.ts`: Kept PR's comment about not changing
`input.widget.name`, deduplicated `_invalidatePromotedViewsCache()` call
- `NodeWidgets.vue`: Applied `widget.promotedLabel ??
widgetState?.label` without `linkedUpstream` (not on target branch)
- `widgetUtil.test.ts`: Took PR version with new `_subgraphSlot.label`
test case

Fixes #9998

┆Issue is synchronized with this [Notion
page](https://www.notion.so/PR-10412-backport-core-1-41-fix-subgraph-promoted-widget-input-label-rename-32d6d73d365081c7919ffaf5d37a8478)
by [Unito](https://www.unito.io)

---------

Co-authored-by: Arthur R Longbottom <art.longbottom.jr@gmail.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: jaeone94 <jaeone.prt@gmail.com>
2026-03-23 18:05:08 -07:00

58 lines
2.0 KiB
TypeScript

import { expect } from '@playwright/test'
import { comfyPageFixture as test } from '../fixtures/ComfyPage'
import { getPromotedWidgetNames } from '../helpers/promotedWidgets'
test.describe(
'Subgraph promoted widget DOM position',
{ tag: '@subgraph' },
() => {
test.beforeEach(async ({ comfyPage }) => {
await comfyPage.settings.setSetting('Comfy.UseNewMenu', 'Disabled')
})
test('Promoted seed widget renders in node body, not header', async ({
comfyPage
}) => {
await comfyPage.workflow.loadWorkflow('default')
// Convert KSampler (id 3) to subgraph — seed is auto-promoted.
const ksampler = await comfyPage.nodeOps.getNodeRefById('3')
await ksampler.click('title')
const subgraphNode = await ksampler.convertToSubgraph()
await comfyPage.nextFrame()
// Enable Vue nodes now that the subgraph has been created
await comfyPage.settings.setSetting('Comfy.VueNodes.Enabled', true)
const subgraphNodeId = String(subgraphNode.id)
const promotedNames = await getPromotedWidgetNames(
comfyPage,
subgraphNodeId
)
expect(promotedNames).toContain('seed')
// Wait for Vue nodes to render
await comfyPage.vueNodes.waitForNodes()
const nodeLocator = comfyPage.vueNodes.getNodeLocator(subgraphNodeId)
await expect(nodeLocator).toBeVisible()
// The seed widget should be visible inside the node body
const seedWidget = nodeLocator.getByLabel('seed', { exact: true }).first()
await expect(seedWidget).toBeVisible()
// Verify widget is inside the node body, not the header
const headerBox = await nodeLocator
.locator('[data-testid^="node-header-"]')
.boundingBox()
const widgetBox = await seedWidget.boundingBox()
expect(headerBox).not.toBeNull()
expect(widgetBox).not.toBeNull()
// Widget top should be below the header bottom
expect(widgetBox!.y).toBeGreaterThan(headerBox!.y + headerBox!.height)
})
}
)