test_1844503_1849058_nicochannel_jp.py (1196B)
1 import pytest 2 3 URL = "https://nicochannel.jp/engage-kiss/video/smBAc4UhdTUivpbuzBexSa9d" 4 5 6 async def check_for_regression(client, url, shouldPass=True): 7 CONSENT = client.css(".MuiDialog-container button.MuiButton-containedPrimary") 8 PREMIUM = client.text( 9 "視聴するには、会員プランまたはレンタルプランを購入してください" 10 ) 11 BLOCKED = client.text("このブラウザはサポートされていません。") 12 PLAY = client.css("[data-testid=PlayArrowRoundedIcon]") 13 14 await client.navigate(url) 15 16 while True: 17 consent, premium, blocked, play = client.await_first_element_of( 18 [ 19 CONSENT, 20 PREMIUM, 21 BLOCKED, 22 PLAY, 23 ], 24 is_displayed=True, 25 timeout=30, 26 ) 27 if not consent: 28 break 29 consent.click() 30 client.await_element_hidden(CONSENT) 31 continue 32 if shouldPass: 33 assert play or premium 34 else: 35 assert blocked 36 37 38 @pytest.mark.asyncio 39 @pytest.mark.without_interventions 40 async def test_disabled(client): 41 await check_for_regression(client, URL, shouldPass=True)