Skip to content

Commit 7dc615b

Browse files
committed
refactor(select.spec.ts): streamline pinned node selection test to use real user interaction
1 parent da8ee70 commit 7dc615b

File tree

1 file changed

+17
-19
lines changed

1 file changed

+17
-19
lines changed

browser_tests/tests/vueNodes/interactions/node/select.spec.ts

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import type { NodeReference } from 'browser_tests/fixtures/utils/litegraphUtils'
2-
31
import {
42
comfyExpect as expect,
53
comfyPageFixture as test
@@ -53,34 +51,34 @@ test.describe('Vue Node Selection', () => {
5351
}
5452

5553
test('should select pinned node without dragging', async ({ comfyPage }) => {
56-
// Get a node and pin it
57-
const node = (await comfyPage.getFirstNodeRef()) as NodeReference
58-
await node.pin()
54+
const PIN_HOTKEY = 'p'
55+
const PIN_INDICATOR = '[data-testid="node-pin-indicator"]'
56+
57+
// Select a node by clicking its title
58+
const checkpointNodeHeader = comfyPage.page.getByText('Load Checkpoint')
59+
await checkpointNodeHeader.click()
5960

60-
// Verify it's pinned
61-
await expect(node).toBePinned()
61+
// Pin it using the hotkey (as a user would)
62+
await comfyPage.page.keyboard.press(PIN_HOTKEY)
6263

63-
// Click the node
64-
await comfyPage.page.getByText('Load Checkpoint').click()
64+
const checkpointNode = comfyPage.vueNodes.getNodeByTitle('Load Checkpoint')
65+
const pinIndicator = checkpointNode.locator(PIN_INDICATOR)
66+
await expect(pinIndicator).toBeVisible()
6567

66-
// Should be selected
6768
expect(await comfyPage.vueNodes.getSelectedNodeCount()).toBe(1)
6869

69-
// Get initial position
70-
const initialPos = await node.getPosition()
70+
const initialPos = await checkpointNodeHeader.boundingBox()
71+
if (!initialPos) throw new Error('Failed to get header position')
7172

72-
// Try to drag the node (should not move)
7373
await comfyPage.dragAndDrop(
74-
{ x: initialPos.x, y: initialPos.y - 15 },
74+
{ x: initialPos.x + 10, y: initialPos.y + 10 },
7575
{ x: initialPos.x + 100, y: initialPos.y + 100 }
7676
)
7777

78-
// Position should remain the same
79-
const finalPos = await node?.getPosition()
80-
expect(finalPos.x).toBeCloseTo(initialPos.x, 0)
81-
expect(finalPos.y).toBeCloseTo(initialPos.y, 0)
78+
const finalPos = await checkpointNodeHeader.boundingBox()
79+
if (!finalPos) throw new Error('Failed to get header position after drag')
80+
expect(finalPos).toEqual(initialPos)
8281

83-
// Should still be selected
8482
expect(await comfyPage.vueNodes.getSelectedNodeCount()).toBe(1)
8583
})
8684
})

0 commit comments

Comments
 (0)