test_1902399_recochoku_jp.py (935B)
1 import pytest 2 3 URL = "https://recochoku.jp/" 4 HERO_CSS = "input.js-search-form" 5 VPN_TEXT = "This site is limited to access from within Japan" 6 UNSUPPORTED_TEXT = "Chromeブラウザの最新版をご利用ください" 7 8 9 async def visit_site(client): 10 await client.navigate(URL, wait="none") 11 hero, vpn = client.await_first_element_of( 12 [client.css(HERO_CSS), client.text(VPN_TEXT)], is_displayed=True 13 ) 14 if vpn: 15 pytest.skip("Region-locked, cannot test. Try using a VPN set to Japan.") 16 return False 17 return True 18 19 20 @pytest.mark.asyncio 21 @pytest.mark.with_interventions 22 async def test_enabled(client): 23 if await visit_site(client): 24 assert not client.find_text(UNSUPPORTED_TEXT, is_displayed=True) 25 26 27 @pytest.mark.asyncio 28 @pytest.mark.without_interventions 29 async def test_disabled(client): 30 if await visit_site(client): 31 assert client.find_text(UNSUPPORTED_TEXT, is_displayed=True)