test_1902520_keisan_nta_go_jp.py (1167B)
1 import pytest 2 3 URL = "https://www.keisan.nta.go.jp/kyoutu/ky/sm/top_web#bsctrl" 4 CARD_YES_CSS = "#card_yes + label" 5 PHONE_AND_READER_YES_CSS = "#phoneAndReader_yes + label" 6 SUBMIT_CSS = "[onclick*=doSubmit][onclick*=csw0100_myno_qr]" 7 NOTICE_CSS = "[onclick*=openExternalSubGuidance][onclick*=recommend]" 8 PROGRESS_CSS = "form[action*=cmw0900] .yeartitle.tounen" 9 10 11 async def is_blocked(client): 12 await client.navigate(URL) 13 client.await_css(CARD_YES_CSS, is_displayed=True).click() 14 client.await_css(PHONE_AND_READER_YES_CSS, is_displayed=True).click() 15 client.await_css(SUBMIT_CSS, is_displayed=True).click() 16 bad, good = client.await_first_element_of( 17 [ 18 client.css(NOTICE_CSS), 19 client.css(PROGRESS_CSS), 20 ], 21 is_displayed=True, 22 ) 23 return bad is not None 24 25 26 @pytest.mark.only_platforms("mac", "windows") 27 @pytest.mark.asyncio 28 @pytest.mark.with_interventions 29 async def test_enabled(client): 30 assert not await is_blocked(client) 31 32 33 @pytest.mark.only_platforms("mac", "windows") 34 @pytest.mark.asyncio 35 @pytest.mark.without_interventions 36 async def test_disabled(client): 37 assert await is_blocked(client)