refactor interactions_service to use object destructuring for scroll coordinates, enhancing code clarity and maintainability
Build and Push Docker Images / build-and-push (push) Successful in 21s

This commit is contained in:
2026-04-23 15:49:03 +02:00
parent f233fb1b83
commit c9a0b0c1aa
@@ -225,19 +225,17 @@ async def interactions_service(
target_scroll_y = max(0.0, y - (inner_h / 2.0)) target_scroll_y = max(0.0, y - (inner_h / 2.0))
await page.evaluate( await page.evaluate(
"""(sx, sy) => { """({ sx, sy }) => {
window.scrollTo({ left: sx, top: sy, behavior: 'auto' }); window.scrollTo({ left: sx, top: sy, behavior: 'auto' });
}""", }""",
target_scroll_x, {"sx": target_scroll_x, "sy": target_scroll_y},
target_scroll_y,
) )
# Wait for scroll offsets to settle before resolving the viewport point. # Wait for scroll offsets to settle before resolving the viewport point.
try: try:
await page.wait_for_function( await page.wait_for_function(
"""(sx, sy) => Math.abs(window.scrollX - sx) <= 2 && Math.abs(window.scrollY - sy) <= 2""", """({ sx, sy }) => Math.abs(window.scrollX - sx) <= 2 && Math.abs(window.scrollY - sy) <= 2""",
target_scroll_x, {"sx": target_scroll_x, "sy": target_scroll_y},
target_scroll_y,
timeout=10000, timeout=10000,
) )
except Exception: except Exception: