|
1 |
| -import type { NodeReference } from 'browser_tests/fixtures/utils/litegraphUtils' |
2 |
| - |
3 | 1 | import {
|
4 | 2 | comfyExpect as expect,
|
5 | 3 | comfyPageFixture as test
|
@@ -53,34 +51,34 @@ test.describe('Vue Node Selection', () => {
|
53 | 51 | }
|
54 | 52 |
|
55 | 53 | 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() |
59 | 60 |
|
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) |
62 | 63 |
|
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() |
65 | 67 |
|
66 |
| - // Should be selected |
67 | 68 | expect(await comfyPage.vueNodes.getSelectedNodeCount()).toBe(1)
|
68 | 69 |
|
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') |
71 | 72 |
|
72 |
| - // Try to drag the node (should not move) |
73 | 73 | await comfyPage.dragAndDrop(
|
74 |
| - { x: initialPos.x, y: initialPos.y - 15 }, |
| 74 | + { x: initialPos.x + 10, y: initialPos.y + 10 }, |
75 | 75 | { x: initialPos.x + 100, y: initialPos.y + 100 }
|
76 | 76 | )
|
77 | 77 |
|
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) |
82 | 81 |
|
83 |
| - // Should still be selected |
84 | 82 | expect(await comfyPage.vueNodes.getSelectedNodeCount()).toBe(1)
|
85 | 83 | })
|
86 | 84 | })
|
0 commit comments