fix: address PR review feedback

- Select node before widget context menu right-click (subgraphPromotion)
- Use retrying toHaveCount assertion (subgraphPromotionDom)
- Isolate dummy node-type registration in beforeEach/afterEach (SubgraphSerialization)

Amp-Thread-ID: https://ampcode.com/threads/T-019d4195-1a01-77d9-b200-dd8f1f667519
Co-authored-by: Amp <amp@ampcode.com>
This commit is contained in:
Alexander Brown
2026-03-30 19:13:17 -07:00
parent d5cc36902f
commit 8d67396f43
3 changed files with 11 additions and 12 deletions

View File

@@ -159,6 +159,7 @@ test.describe(
await subgraphNode.navigateIntoSubgraph()
const ksampler = await comfyPage.nodeOps.getNodeRefById('1')
await ksampler.click('title')
const stepsWidget = await ksampler.getWidget(2)
const widgetPos = await stepsWidget.getPosition()
@@ -188,9 +189,9 @@ test.describe(
const subgraphNode2 = await comfyPage.nodeOps.getNodeRefById('2')
await subgraphNode2.navigateIntoSubgraph()
const stepsWidget2 = await (
await comfyPage.nodeOps.getNodeRefById('1')
).getWidget(2)
const ksampler2 = await comfyPage.nodeOps.getNodeRefById('1')
await ksampler2.click('title')
const stepsWidget2 = await ksampler2.getWidget(2)
const widgetPos2 = await stepsWidget2.getPosition()
await comfyPage.canvas.click({

View File

@@ -129,10 +129,7 @@ test.describe('Subgraph Promotion DOM', { tag: ['@subgraph'] }, () => {
'subgraphs/subgraph-with-promoted-text-widget'
)
const textareaCount = await comfyPage.page
.locator(DOM_WIDGET_SELECTOR)
.count()
expect(textareaCount).toBe(1)
await expect(comfyPage.page.locator(DOM_WIDGET_SELECTOR)).toHaveCount(1)
const subgraphNode = await comfyPage.nodeOps.getNodeRefById('11')
expect(await subgraphNode.exists()).toBe(true)

View File

@@ -4,7 +4,7 @@
* Tests for saving, loading, and version compatibility of subgraphs.
* This covers serialization, deserialization, data integrity, and migration scenarios.
*/
import { beforeEach, describe, expect, it } from 'vitest'
import { afterEach, beforeEach, describe, expect, it } from 'vitest'
import { createTestingPinia } from '@pinia/testing'
import { setActivePinia } from 'pinia'
@@ -56,6 +56,11 @@ function createRegisteredNode(
beforeEach(() => {
setActivePinia(createTestingPinia({ stubActions: false }))
resetSubgraphFixtureState()
LiteGraph.registerNodeType('dummy', DummyNode)
})
afterEach(() => {
delete LiteGraph.registered_node_types.dummy
})
describe('SubgraphSerialization - Basic Serialization', () => {
@@ -483,8 +488,6 @@ describe('SubgraphSerialization - Data Integrity', () => {
})
it('deduplicates duplicate subgraph node IDs while keeping root nodes canonical', () => {
LiteGraph.registerNodeType('dummy', DummyNode)
const graph = new LGraph()
graph.configure(structuredClone(duplicateSubgraphNodeIds))
@@ -508,8 +511,6 @@ describe('SubgraphSerialization - Data Integrity', () => {
})
it('patches remapped link and proxyWidget references during duplicate-ID hydration', () => {
LiteGraph.registerNodeType('dummy', DummyNode)
const graph = new LGraph()
graph.configure(structuredClone(duplicateSubgraphNodeIds))