251251echo " "
252252echo -e " ${BLUE} === Test 4: Scroll Down ===${NC} "
253253
254- # Send scroll event at center of window (300, 300), scroll down 200px
255- echo " Sending scroll event (delta_y=-200)..."
256- RESPONSE=$( send_command ' {"op":"scroll","x":300,"y":300,"delta_x":0,"delta_y":-200}' )
254+ # Use scroll_node_by on node 3 (the scroll container)
255+ # Note: "scroll" event only simulates mouse position, not actual scrolling
256+ # The scroll_node_by API directly modifies scroll position
257+ # Positive delta_y = scroll down (content moves up, viewport moves down)
258+ echo " Scrolling node 3 by delta_y=200..."
259+ RESPONSE=$( send_command ' {"op":"scroll_node_by","node_id":3,"delta_x":0,"delta_y":200}' )
257260STATUS=$( echo " $RESPONSE " | jq -r ' .status' 2> /dev/null)
258261
259262if [ " $STATUS " = " ok" ]; then
@@ -276,10 +279,10 @@ if [ -n "$VALUE" ]; then
276279 SCROLL_Y=$( echo " $VALUE " | jq -r ' .scroll_states[0].scroll_y // 0' 2> /dev/null || echo " 0" )
277280 echo " Current scroll_y: $SCROLL_Y "
278281
279- # Check if scroll position changed (negative = scrolled down)
282+ # Check if scroll position changed (positive = scrolled down)
280283 SCROLL_Y_INT=" ${SCROLL_Y% .* } "
281- if [ " ${SCROLL_Y_INT:- 0} " -lt 0 ]; then
282- echo -e " ${GREEN} ✓ PASS:${NC} Content scrolled (scroll_y < 0)"
284+ if [ " ${SCROLL_Y_INT:- 0} " -gt 0 ]; then
285+ echo -e " ${GREEN} ✓ PASS:${NC} Content scrolled (scroll_y > 0)"
283286 else
284287 echo -e " ${YELLOW} ⚠ WARN:${NC} Scroll position unchanged (may need scrollable content)"
285288 fi
302305echo " "
303306echo -e " ${BLUE} === Test 5: Scroll Down More ===${NC} "
304307
305- send_command ' {"op":"scroll","x":300,"y":300,"delta_x":0,"delta_y":-300}' > /dev/null 2>&1
308+ # Positive delta_y = scroll down (scroll position increases)
309+ echo " Scrolling node 3 by delta_y=300..."
310+ send_command ' {"op":"scroll_node_by","node_id":3,"delta_x":0,"delta_y":300}' > /dev/null 2>&1
306311sleep 0.3
307312send_command ' {"op":"wait_frame"}' > /dev/null 2>&1
308313
327332echo " "
328333echo -e " ${BLUE} === Test 6: Scroll Back Up ===${NC} "
329334
330- send_command ' {"op":"scroll","x":300,"y":300,"delta_x":0,"delta_y":250}' > /dev/null 2>&1
335+ # Negative delta_y = scroll up (scroll position decreases)
336+ echo " Scrolling node 3 by delta_y=-250..."
337+ send_command ' {"op":"scroll_node_by","node_id":3,"delta_x":0,"delta_y":-250}' > /dev/null 2>&1
331338sleep 0.3
332339send_command ' {"op":"wait_frame"}' > /dev/null 2>&1
333340
0 commit comments