@@ -528,4 +528,103 @@ test.describe('Subgraph Operations', () => {
528528 expect ( finalCount ) . toBe ( parentCount )
529529 } )
530530 } )
531+
532+ test . describe ( 'Navigation Hotkeys' , ( ) => {
533+ test . beforeEach ( async ( { comfyPage } ) => {
534+ await comfyPage . setSetting ( 'Comfy.UseNewMenu' , 'Top' )
535+ } )
536+
537+ test ( 'Navigation hotkey can be customized' , async ( { comfyPage } ) => {
538+ await comfyPage . loadWorkflow ( 'basic-subgraph' )
539+ await comfyPage . nextFrame ( )
540+
541+ // Change the Exit Subgraph keybinding from Escape to Alt+Q
542+ await comfyPage . setSetting ( 'Comfy.Keybinding.NewBindings' , [
543+ {
544+ commandId : 'Comfy.Graph.ExitSubgraph' ,
545+ combo : {
546+ key : 'q' ,
547+ ctrl : false ,
548+ alt : true ,
549+ shift : false
550+ }
551+ }
552+ ] )
553+
554+ await comfyPage . setSetting ( 'Comfy.Keybinding.UnsetBindings' , [
555+ {
556+ commandId : 'Comfy.Graph.ExitSubgraph' ,
557+ combo : {
558+ key : 'Escape' ,
559+ ctrl : false ,
560+ alt : false ,
561+ shift : false
562+ }
563+ }
564+ ] )
565+
566+ // Reload the page
567+ await comfyPage . page . reload ( )
568+ await comfyPage . page . waitForTimeout ( 1024 )
569+
570+ // Navigate into subgraph
571+ const subgraphNode = await comfyPage . getNodeRefById ( '2' )
572+ await subgraphNode . navigateIntoSubgraph ( )
573+ await comfyPage . page . waitForSelector ( SELECTORS . breadcrumb )
574+
575+ // Verify we're in a subgraph
576+ expect ( await isInSubgraph ( comfyPage ) ) . toBe ( true )
577+
578+ // Test that Escape no longer exits subgraph
579+ await comfyPage . page . keyboard . press ( 'Escape' )
580+ await comfyPage . nextFrame ( )
581+ if ( ! ( await isInSubgraph ( comfyPage ) ) ) {
582+ throw new Error ( 'Not in subgraph' )
583+ }
584+
585+ // Test that Alt+Q now exits subgraph
586+ await comfyPage . page . keyboard . press ( 'Alt+q' )
587+ await comfyPage . nextFrame ( )
588+ expect ( await isInSubgraph ( comfyPage ) ) . toBe ( false )
589+ } )
590+
591+ test ( 'Escape prioritizes closing dialogs over exiting subgraph' , async ( {
592+ comfyPage
593+ } ) => {
594+ await comfyPage . loadWorkflow ( 'basic-subgraph' )
595+ await comfyPage . nextFrame ( )
596+
597+ const subgraphNode = await comfyPage . getNodeRefById ( '2' )
598+ await subgraphNode . navigateIntoSubgraph ( )
599+ await comfyPage . page . waitForSelector ( SELECTORS . breadcrumb )
600+
601+ // Verify we're in a subgraph
602+ if ( ! ( await isInSubgraph ( comfyPage ) ) ) {
603+ throw new Error ( 'Not in subgraph' )
604+ }
605+
606+ // Open settings dialog using hotkey
607+ await comfyPage . page . keyboard . press ( 'Control+,' )
608+ await comfyPage . page . waitForSelector ( '.settings-container' , {
609+ state : 'visible'
610+ } )
611+
612+ // Press Escape - should close dialog, not exit subgraph
613+ await comfyPage . page . keyboard . press ( 'Escape' )
614+ await comfyPage . nextFrame ( )
615+
616+ // Dialog should be closed
617+ await expect (
618+ comfyPage . page . locator ( '.settings-container' )
619+ ) . not . toBeVisible ( )
620+
621+ // Should still be in subgraph
622+ expect ( await isInSubgraph ( comfyPage ) ) . toBe ( true )
623+
624+ // Press Escape again - now should exit subgraph
625+ await comfyPage . page . keyboard . press ( 'Escape' )
626+ await comfyPage . nextFrame ( )
627+ expect ( await isInSubgraph ( comfyPage ) ) . toBe ( false )
628+ } )
629+ } )
531630} )
0 commit comments