test_1999198_anime-bit_ru.py (1053B)
1 import pytest 2 3 URL = "https://anime-bit.ru/" 4 HIDDEN_IMAGES_CSS = ".anime_list.shadow.lazy" 5 6 7 async def are_wrong_images_hidden(client): 8 await client.navigate(URL, wait="none") 9 client.execute_script("window.scrollTo(0, 200)") 10 await client.stall(1) 11 # The site hides images with a class .lazy {display:none}, so we can check 12 # if any of those images are onscreen and should be lacking that CSS class. 13 return client.execute_script( 14 """ 15 for (const img of arguments[0]) { 16 if (img.getBoundingClientRect().top < window.innerHeight) { 17 return true; 18 } 19 } 20 """, 21 client.await_css(HIDDEN_IMAGES_CSS, all=True), 22 ) 23 24 25 @pytest.mark.only_platforms("android") 26 @pytest.mark.asyncio 27 @pytest.mark.with_interventions 28 async def test_enabled(client): 29 assert not await are_wrong_images_hidden(client) 30 31 32 @pytest.mark.only_platforms("android") 33 @pytest.mark.asyncio 34 @pytest.mark.without_interventions 35 async def test_disabled(client): 36 assert await are_wrong_images_hidden(client)