test_1577519_stream_directv_com.py (1318B)
1 import pytest 2 3 URL = "https://stream.directv.com/" 4 LOGIN_CSS = "#userID, [data-testid='emailInput_TextInput']" 5 UNSUPPORTED_CSS = ".title-new-browse-ff" 6 DENIED_XPATH = "//h1[text()='Access Denied']" 7 BLOCKED_TEXT = "An error occurred while processing your request." 8 9 10 async def check_site(client, should_pass): 11 await client.navigate(URL) 12 13 denied, blocked, login, unsupported = client.await_first_element_of( 14 [ 15 client.xpath(DENIED_XPATH), 16 client.text(BLOCKED_TEXT), 17 client.css(LOGIN_CSS), 18 client.css(UNSUPPORTED_CSS), 19 ], 20 is_displayed=True, 21 ) 22 23 if blocked: 24 pytest.skip("Blocked from accessing site. Please try testing manually.") 25 return 26 27 if denied: 28 pytest.skip( 29 "Region-locked, cannot test. Try using a VPN set to a different region in the USA." 30 ) 31 return 32 33 assert (should_pass and login) or (not should_pass and unsupported) 34 35 36 @pytest.mark.asyncio 37 @pytest.mark.with_interventions 38 @pytest.mark.skip_platforms("android") 39 async def test_enabled(client): 40 await check_site(client, should_pass=True) 41 42 43 @pytest.mark.asyncio 44 @pytest.mark.without_interventions 45 @pytest.mark.skip_platforms("android") 46 async def test_disabled(client): 47 await check_site(client, should_pass=False)