test_1902403_musicstore_auone_jp.py (1104B)
1 import pytest 2 from webdriver.bidi.error import UnknownErrorException 3 4 URL = "https://musicstore.auone.jp/" 5 HERO_CSS = ".top-campaignbnr-list__item-link" 6 UNSUPPORTED_TEXT = "このブラウザはサポートされていません" 7 NEED_VPN_TEXT = "access from within Japan" 8 9 10 async def is_unsupported(client): 11 vpn = False 12 try: 13 await client.navigate(URL, wait="none", no_skip=True) 14 _, vpn = client.await_first_element_of( 15 [client.css(HERO_CSS), client.text(NEED_VPN_TEXT)], is_displayed=True 16 ) 17 except UnknownErrorException as e: 18 if "NS_ERROR_UNKNOWN_HOST" not in str(e): 19 raise e 20 vpn = True 21 if vpn: 22 pytest.skip("Region-locked, cannot test. Try using a VPN set to Japan.") 23 return False 24 return client.find_text(UNSUPPORTED_TEXT, is_displayed=True) 25 26 27 @pytest.mark.asyncio 28 @pytest.mark.with_interventions 29 async def test_enabled(client): 30 assert not await is_unsupported(client) 31 32 33 @pytest.mark.asyncio 34 @pytest.mark.without_interventions 35 async def test_disabled(client): 36 assert await is_unsupported(client)