Skip to content

Commit d134b01

Browse files
committed
fix(test): Correct scroll delta direction in scrolling.sh
- Use positive delta_y for scroll down (content moves up) - Use negative delta_y for scroll up (content moves down) - Use scroll_node_by API instead of scroll event for direct control - Update validation to check for scroll_y > 0 instead of < 0
1 parent 2289d41 commit d134b01

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

tests/e2e/scrolling.sh

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,12 @@ fi
251251
echo ""
252252
echo -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}')
257260
STATUS=$(echo "$RESPONSE" | jq -r '.status' 2>/dev/null)
258261

259262
if [ "$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
@@ -302,7 +305,9 @@ fi
302305
echo ""
303306
echo -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
306311
sleep 0.3
307312
send_command '{"op":"wait_frame"}' > /dev/null 2>&1
308313

@@ -327,7 +332,9 @@ fi
327332
echo ""
328333
echo -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
331338
sleep 0.3
332339
send_command '{"op":"wait_frame"}' > /dev/null 2>&1
333340

0 commit comments

Comments
 (0)