MCPcopy Create free account
hub / github.com/Vinyzu/Botright / test_scroll

Function test_scroll

tests/playwright_tests/test_element_handle.py:353–372  ·  view source on GitHub ↗
(page, server)

Source from the content-addressed store, hash-verified

351
352@pytest.mark.asyncio
353async def test_scroll(page, server):
354 await page.goto(server.PREFIX + "/offscreenbuttons.html")
355 for i in range(11):
356 button = await page.query_selector(f"#btn{i}")
357 before = await button.evaluate(
358 """button => {
359 return button.getBoundingClientRect().right - window.innerWidth
360 }"""
361 )
362
363 assert before == 10 * i
364 await button.scroll_into_view_if_needed()
365 after = await button.evaluate(
366 """button => {
367 return button.getBoundingClientRect().right - window.innerWidth
368 }"""
369 )
370
371 assert after <= 0
372 await page.evaluate("() => window.scrollTo(0, 0)")
373
374
375@pytest.mark.asyncio

Callers

nothing calls this directly

Calls 1

query_selectorMethod · 0.45

Tested by

no test coverage detected