test_1868345_tvmovie_de.py (1543B)
1 import asyncio 2 3 import pytest 4 from webdriver import NoSuchElementException 5 6 # This is just a regression test. 7 8 URL = "https://www.tvmovie.de/tv/fernsehprogramm" 9 10 POPUP_CSS = "#sp_message_container_1179875" 11 12 13 async def check_if_scroll_bounces(client, in_headless_mode): 14 if in_headless_mode: 15 pytest.xfail("Skipping as test does not work properly in headless mode.") 16 return False 17 18 await client.navigate(URL) 19 20 try: 21 client.await_css(POPUP_CSS, is_displayed=True, timeout=3).click() 22 except NoSuchElementException: 23 pass 24 25 # If we scroll down a few times, the page will start scrolling on 26 # its own when things are broken. As such we can read window.scrollY 27 # to see if it changes on its own after a moment, without our help. 28 client.apz_scroll(client.await_css("body"), dy=100000) 29 await asyncio.sleep(0.2) 30 client.apz_scroll(client.await_css("body"), dy=100000) 31 await asyncio.sleep(0.2) 32 client.apz_scroll(client.await_css("body"), dy=100000) 33 await asyncio.sleep(0.2) 34 client.apz_scroll(client.await_css("body"), dy=100000) 35 await asyncio.sleep(0.2) 36 expected_pos = client.execute_script("return window.scrollY") 37 await asyncio.sleep(0.2) 38 final_pos = client.execute_script("return window.scrollY") 39 return expected_pos != final_pos 40 41 42 @pytest.mark.skip_platforms("android") 43 @pytest.mark.asyncio 44 @pytest.mark.without_interventions 45 async def test_disabled(client, in_headless_mode): 46 assert not await check_if_scroll_bounces(client, in_headless_mode)