@@ -949,7 +949,7 @@ async function interactions(browser: Browser, profile: Profile, repetition: numb
949949 }
950950 } )
951951 await apiControls ( run , profile , repetition )
952- await measure ( profile , '/workflows' , repetition , 'workflow-inspector -control' , async ( ) => {
952+ await measure ( profile , '/workflows' , repetition , 'workflow-canvas -control' , async ( ) => {
953953 await run . page . goto ( new URL ( '/workflows' , base ) . href , { waitUntil : 'domcontentloaded' } )
954954 await meaningful ( run . page , new URL ( '/workflows' , base ) . pathname )
955955 const trigger = run . page
@@ -963,20 +963,65 @@ async function interactions(browser: Browser, profile: Profile, repetition: numb
963963 await dialog . waitFor ( )
964964 await painted ( run . page )
965965 const feedbackMs = performance . now ( ) - start
966- const block = dialog
967- . getByRole ( 'group' , { name : 'Inspect a block' } )
968- . getByRole ( 'button' )
969- . first ( )
970- if ( await block . count ( ) ) {
971- await block . click ( )
972- await painted ( run . page )
973- }
966+ const canvas = dialog . locator ( '.react-flow__pane' )
967+ const viewport = dialog . locator ( '.react-flow__viewport' )
968+ const node = dialog . locator ( '.react-flow__node' ) . first ( )
969+ await expect ( node ) . toBeVisible ( )
970+ await painted ( run . page )
971+ const bounds = await canvas . boundingBox ( )
972+ if ( ! bounds ) throw new Error ( 'Workflow canvas has no visible bounds' )
973+ const transform = ( element : Locator ) =>
974+ element . evaluate ( ( element ) => {
975+ const matrix = new DOMMatrixReadOnly ( getComputedStyle ( element ) . transform )
976+ return { x : matrix . e , y : matrix . f , scale : matrix . a }
977+ } )
978+ const beforePan = await transform ( viewport )
979+ const x = bounds . x + bounds . width / 2
980+ const y = bounds . y + bounds . height - 24
981+ await run . page . mouse . move ( x , y )
982+ await run . page . mouse . down ( )
983+ await run . page . mouse . move ( x + 24 , y - 24 , { steps : 5 } )
984+ await run . page . mouse . up ( )
985+ await expect . poll ( async ( ) => ( await transform ( viewport ) ) . x ) . not . toBe ( beforePan . x )
986+ const afterPan = await transform ( viewport )
987+ expect ( afterPan . scale ) . toBe ( beforePan . scale )
988+ const beforeZoom = afterPan . scale
989+ await run . page . mouse . wheel ( 0 , - 80 )
990+ await expect
991+ . poll ( ( ) =>
992+ viewport . evaluate (
993+ ( element ) => new DOMMatrixReadOnly ( getComputedStyle ( element ) . transform ) . a
994+ )
995+ )
996+ . toBeGreaterThan ( beforeZoom )
997+ await node . click ( { trial : true , position : { x : 8 , y : 8 } } )
998+ const afterZoom = await transform ( viewport )
999+ const nodeBefore = await transform ( node )
1000+ const nodeBounds = await node . boundingBox ( )
1001+ if ( ! nodeBounds ) throw new Error ( 'Workflow node has no visible bounds' )
1002+ await run . page . mouse . move ( nodeBounds . x + nodeBounds . width / 2 , nodeBounds . y + 8 )
1003+ await run . page . mouse . down ( )
1004+ await run . page . mouse . move ( nodeBounds . x + nodeBounds . width / 2 + 20 , nodeBounds . y + 28 , {
1005+ steps : 5 ,
1006+ } )
1007+ await run . page . mouse . up ( )
1008+ await expect
1009+ . poll ( async ( ) => {
1010+ const position = await transform ( node )
1011+ return Math . hypot ( position . x - nodeBefore . x , position . y - nodeBefore . y )
1012+ } )
1013+ . toBeGreaterThan ( 1 )
1014+ expect ( await transform ( viewport ) ) . toEqual ( afterZoom )
9741015 const data = {
975- selectedBlock : ( await block . count ( ) ) ? await block . textContent ( ) : undefined ,
976- dialogTextLength : ( await dialog . textContent ( ) ) ?. length ,
1016+ beforePan,
1017+ afterPan,
1018+ afterZoom,
1019+ nodeBefore,
1020+ nodeAfter : await transform ( node ) ,
9771021 }
9781022 await run . page . keyboard . press ( 'Escape' )
9791023 await dialog . waitFor ( { state : 'hidden' } )
1024+ await expect ( trigger ) . toBeFocused ( )
9801025 return { status : 'completed' , feedbackMs, data }
9811026 } )
9821027 for ( const route of [
0 commit comments