test_1902454_onvideo_kuaishou_com.py (1135B)
1 import pytest 2 3 URL = "https://onvideo.kuaishou.com/v2/hub/home?source=cp" 4 HERO_CSS = "img[alt=QRcode]" 5 UNSUPPORTED_TEXT = "建议您升级为谷歌最新版本浏览器" 6 MOBILE_UNSUPPORTED_TEXT = "暂不支持移动端,请使用电脑进行体验" 7 8 9 async def does_warning_appear(client): 10 await client.navigate(URL, wait="none") 11 good, bad = client.await_first_element_of( 12 [ 13 client.css(HERO_CSS), 14 client.text(UNSUPPORTED_TEXT), 15 ], 16 is_displayed=True, 17 ) 18 return bad and not good 19 20 21 @pytest.mark.skip_platforms("android") 22 @pytest.mark.asyncio 23 @pytest.mark.with_interventions 24 async def test_enabled(client): 25 assert not await does_warning_appear(client) 26 27 28 @pytest.mark.skip_platforms("android") 29 @pytest.mark.asyncio 30 @pytest.mark.without_interventions 31 async def test_disabled(client): 32 assert await does_warning_appear(client) 33 34 35 @pytest.mark.only_platforms("android") 36 @pytest.mark.asyncio 37 @pytest.mark.without_interventions 38 async def test_mobile_still_unsupported(client): 39 await client.navigate(URL, wait="none") 40 assert client.await_text(MOBILE_UNSUPPORTED_TEXT)