test_1973976_iweather_gov_vn.py (1251B)
1 import pytest 2 3 URL = "https://iweather.gov.vn/dashboard/?areaRadar=COM&productRadar=CMAX" 4 5 MAP_CSS = "#map" 6 ASIDE_CSS = "aside.fixed" 7 BOTTOM_BAR_CSS = ".w-mc.transition-all" 8 9 10 async def is_bottom_bar_full_width(client, platform): 11 await client.navigate(URL, wait="none") 12 client.add_stylesheet(f"{BOTTOM_BAR_CSS} {{ transition-duration:0s !important; }}") 13 map = client.await_css(MAP_CSS, is_displayed=True) 14 aside = client.await_css(ASIDE_CSS, is_displayed=True) 15 bottom_bar = client.await_css(BOTTOM_BAR_CSS, is_displayed=True) 16 return client.execute_script( 17 """ 18 const [ bottom_bar, map, aside, android ] = arguments; 19 return bottom_bar.clientWidth == map.clientWidth - (android ? 0 : aside.clientWidth); 20 """, 21 bottom_bar, 22 map, 23 aside, 24 platform == "android", 25 ) 26 27 28 @pytest.mark.enable_webkit_fill_available 29 @pytest.mark.asyncio 30 @pytest.mark.with_interventions 31 async def test_enabled(client, platform): 32 assert await is_bottom_bar_full_width(client, platform) 33 34 35 @pytest.mark.disable_webkit_fill_available 36 @pytest.mark.asyncio 37 @pytest.mark.without_interventions 38 async def test_disabled(client, platform): 39 assert not await is_bottom_bar_full_width(client, platform)