@@ -27,27 +27,22 @@ test.describe('Vue Nodes Canvas Pan', { tag: '@vue-nodes' }, () => {
2727 }
2828 )
2929
30- test . describe ( 'spacebar panning' , ( ) => {
31- test . beforeEach ( async ( { comfyPage } ) => {
32- await comfyPage . settings . setSetting (
33- 'Comfy.Canvas.NavigationMode' ,
34- 'standard'
35- )
36- await comfyPage . workflow . loadWorkflow ( 'vueNodes/simple-triple' )
37- } )
30+ test ( 'spacebar panning' , async ( { comfyPage, comfyMouse } ) => {
31+ await comfyPage . settings . setSetting (
32+ 'Comfy.Canvas.NavigationMode' ,
33+ 'standard'
34+ )
35+ await comfyPage . workflow . loadWorkflow ( 'vueNodes/simple-triple' )
36+ const node = await comfyPage . vueNodes . getFixtureByTitle ( 'KSampler' )
3837
39- test ( 'Space + left-drag on a Vue node pans canvas' , async ( {
40- comfyPage,
41- comfyMouse
42- } ) => {
43- const node = comfyPage . vueNodes . getNodeByTitle ( 'KSampler' )
38+ await test . step ( 'Space + click on a node starts a pan' , async ( ) => {
4439 const offsetBefore = await comfyPage . canvasOps . getOffset ( )
4540
4641 await comfyPage . canvas . focus ( )
4742 await comfyPage . page . keyboard . down ( 'Space' )
4843 await expect . poll ( ( ) => comfyPage . canvasOps . isReadOnly ( ) ) . toBe ( true )
4944 try {
50- await comfyMouse . dragElementBy ( node , { x : 140 , y : 90 } )
45+ await comfyMouse . dragElementBy ( node . root , { x : - 300 , y : 0 } )
5146 } finally {
5247 await comfyPage . page . keyboard . up ( 'Space' )
5348 }
@@ -56,6 +51,23 @@ test.describe('Vue Nodes Canvas Pan', { tag: '@vue-nodes' }, () => {
5651 . poll ( ( ) => comfyPage . canvasOps . getOffset ( ) )
5752 . not . toEqual ( offsetBefore )
5853 } )
54+
55+ await test . step ( 'while dragging node, spacebar starts pan' , async ( ) => {
56+ await node . header . hover ( )
57+ const offset1 = await comfyPage . canvasOps . getOffset ( )
58+ await comfyPage . page . mouse . down ( )
59+ await comfyPage . page . mouse . move ( 500 , 500 , { steps : 5 } )
60+ expect ( await comfyPage . canvasOps . getOffset ( ) ) . toEqual ( offset1 )
61+ await comfyPage . page . keyboard . down ( 'Space' )
62+ await comfyPage . page . mouse . move ( 400 , 400 , { steps : 5 } )
63+ await expect
64+ . poll ( ( ) => comfyPage . canvasOps . getOffset ( ) )
65+ . not . toEqual ( offset1 )
66+ await comfyPage . page . keyboard . up ( 'Space' )
67+ const offset2 = await comfyPage . canvasOps . getOffset ( )
68+ await comfyPage . page . mouse . move ( 500 , 500 , { steps : 5 } )
69+ expect ( await comfyPage . canvasOps . getOffset ( ) ) . toEqual ( offset2 )
70+ } )
5971 } )
6072
6173 test (
0 commit comments