test_1784361_coldwellbankerhomes_com.py (1041B)
1 import pytest 2 3 URL = "https://www.coldwellbankerhomes.com/ri/little-compton/kvc-17_1,17_2/" 4 ANDROID_ERROR_MSG = 'can\'t access property "dataset", v[0] is undefined' 5 LOADED_IMG_CSS = "img.psr-lazy:not([src*='spacer'])" 6 7 8 async def get_image_aspect_ratio(client): 9 await client.navigate(URL) 10 img = client.await_css(LOADED_IMG_CSS) 11 return client.execute_script( 12 """ 13 const img = arguments[0]; 14 return img.clientWidth / img.clientHeight; 15 """, 16 img, 17 ) 18 19 20 @pytest.mark.asyncio 21 @pytest.mark.with_interventions 22 async def test_enabled(client): 23 assert await get_image_aspect_ratio(client) < 1.6 24 25 26 @pytest.mark.skip_platforms("android") 27 @pytest.mark.asyncio 28 @pytest.mark.without_interventions 29 async def test_disabled_desktop(client): 30 assert not await get_image_aspect_ratio(client) > 1.6 31 32 33 @pytest.mark.only_platforms("android") 34 @pytest.mark.asyncio 35 @pytest.mark.without_interventions 36 async def test_disabled_android(client): 37 await client.navigate(URL, await_console_message=ANDROID_ERROR_MSG)