@@ -64,48 +64,6 @@ const renderedEdgePaths = async (
6464 ) as Record < string , string >
6565 )
6666
67- /**
68- * Pick nodes whose centres are real pointer targets, ordered from the viewport
69- * centre outwards. The standalone header and palette overlay the canvas; using
70- * fixture indices assumes those controls do not exist and can leave Playwright
71- * sending a measured drag to a negative or obscured viewport coordinate.
72- */
73- const unobscuredNodesNearestViewportCenter = async (
74- editor : Locator ,
75- count : number
76- ) : Promise < string [ ] > =>
77- editor
78- . locator ( '.react-flow__node[data-id^="perf-node-"]' )
79- . evaluateAll ( ( elements , desiredCount ) => {
80- const viewportCenter = {
81- x : window . innerWidth / 2 ,
82- y : window . innerHeight / 2 ,
83- }
84- return elements
85- . flatMap ( ( element ) => {
86- const id = element . getAttribute ( "data-id" )
87- const rect = element . getBoundingClientRect ( )
88- const center = {
89- x : rect . left + rect . width / 2 ,
90- y : rect . top + rect . height / 2 ,
91- }
92- const pointerTarget = document . elementFromPoint ( center . x , center . y )
93- if ( ! id || ! pointerTarget || ! element . contains ( pointerTarget ) )
94- return [ ]
95- return [
96- {
97- id,
98- distance :
99- ( center . x - viewportCenter . x ) ** 2 +
100- ( center . y - viewportCenter . y ) ** 2 ,
101- } ,
102- ]
103- } )
104- . sort ( ( a , b ) => a . distance - b . distance )
105- . slice ( 0 , desiredCount )
106- . map ( ( { id } ) => id )
107- } , count )
108-
10967const hasMultipleDirectionChanges = ( path : string ) : boolean => {
11068 const commands = [
11169 ...path . matchAll ( / ( [ M L ] ) \s * ( - ? \d + (?: \. \d + ) ? ) \s + ( - ? \d + (?: \. \d + ) ? ) / g) ,
@@ -553,15 +511,11 @@ test("large-diagram interaction sustains a 30 fps p95 frame budget", async ({
553511 await openLocalWithPerf ( page , fixture )
554512 const editor = page . locator ( `#react-flow-library-${ String ( fixture . id ) } ` )
555513 const frameDeltas : number [ ] = [ ]
556- const nodeIds = await unobscuredNodesNearestViewportCenter ( editor , 4 )
557514
558- expect (
559- nodeIds ,
560- "performance fixture must expose four unobscured nodes"
561- ) . toHaveLength ( 4 )
562-
563- for ( const [ index , nodeId ] of nodeIds . entries ( ) ) {
564- const node = editor . locator ( `.react-flow__node[data-id="${ nodeId } "]` )
515+ for ( let index = 0 ; index < 4 ; index ++ ) {
516+ const node = editor . locator (
517+ `.react-flow__node[data-id="perf-node-${ String ( index ) . padStart ( 2 , "0" ) } "]`
518+ )
565519 frameDeltas . push (
566520 ...( await dragNodeBy ( node , page , index % 2 === 0 ? 40 : - 40 , 30 , {
567521 steps : 12 ,
0 commit comments