From 31e80d70b372ce3c11267dc0a1b5d2f2e7ee88bb Mon Sep 17 00:00:00 2001 From: Austin Date: Fri, 8 May 2026 15:39:38 -0700 Subject: [PATCH] Add test for for editor toggling of linked widgets --- .../fixtures/components/SubgraphEditor.ts | 11 ++++++--- .../tests/subgraph/subgraphPromotion.spec.ts | 23 +++++++++++++++++++ 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/browser_tests/fixtures/components/SubgraphEditor.ts b/browser_tests/fixtures/components/SubgraphEditor.ts index a68f99e86c..6c9f0a45f4 100644 --- a/browser_tests/fixtures/components/SubgraphEditor.ts +++ b/browser_tests/fixtures/components/SubgraphEditor.ts @@ -47,13 +47,18 @@ export class SubgraphEditor { .filter({ hasText: options.widgetName }) }) } + + getToggleButton(item: Locator) { + return item.getByTestId(TestIds.subgraphEditor.widgetToggle) + } + async togglePromotionOnItem(item: Locator, toState?: boolean) { - const toggleButton = item.getByTestId(TestIds.subgraphEditor.iconEye) + const toggleIcon = item.getByTestId(TestIds.subgraphEditor.iconEye) if (toState !== undefined) { const expectedIcon = `icon-[lucide--eye${toState ? '-off' : ''}]` - await expect(toggleButton).toContainClass(expectedIcon) + await expect(toggleIcon).toContainClass(expectedIcon) } - await toggleButton.click() + await toggleIcon.click() } async togglePromotion( diff --git a/browser_tests/tests/subgraph/subgraphPromotion.spec.ts b/browser_tests/tests/subgraph/subgraphPromotion.spec.ts index a93e4928d3..79c9127fdb 100644 --- a/browser_tests/tests/subgraph/subgraphPromotion.spec.ts +++ b/browser_tests/tests/subgraph/subgraphPromotion.spec.ts @@ -799,3 +799,26 @@ test('Can promote multiple previews @vue-nodes', async ({ comfyPage }) => { await expect(subgraph.content).toHaveCount(1) }) }) + +test('Linked widgets can not be demoted @vue-nodes', async ({ comfyPage }) => { + await comfyPage.workflow.loadWorkflow('subgraphs/basic-subgraph') + const { editor } = comfyPage.subgraph + const subgraphNode = comfyPage.vueNodes.getNodeLocator('2') + + await test.step('Enter subgraph and link widget to input', async () => { + await comfyPage.vueNodes.enterSubgraph('2') + const ksampler = await comfyPage.vueNodes.getFixtureByTitle('KSampler') + + const fromSlot = ksampler.getSlot('steps') + const toPos = await comfyPage.subgraph.getInputSlot().getOpenSlotPosition() + await fromSlot.dragTo(comfyPage.canvas, { targetPosition: toPos }) + const isConnected = () => comfyPage.vueNodes.isSlotConnected(fromSlot) + await expect.poll(isConnected).toBe(true) + + await comfyPage.subgraph.exitViaBreadcrumb() + }) + + await editor.open(subgraphNode) + const stepsItem = await editor.resolvePromotionItem({ widgetName: 'steps' }) + await expect(editor.getToggleButton(stepsItem)).toBeDisabled() +})