test_1902496_be_bim_mx.py (943B)
1 import pytest 2 3 URL = "https://be.bim.mx/nb/index.cfm" 4 5 UNBLOCKED_CSS = "#myModal" 6 BLOCKED_TEXT = "Google Chrome" 7 VPN_TEXT = "Error 403 - Forbidden" 8 9 10 async def visit_site(client, expected): 11 await client.navigate(URL, wait="none") 12 vpn, expected = client.await_first_element_of( 13 [ 14 client.text(VPN_TEXT), 15 expected, 16 ], 17 is_displayed=True, 18 ) 19 if vpn: 20 pytest.skip( 21 "Region-locked, cannot test. Try using a VPN set to Canada or the USA." 22 ) 23 24 25 @pytest.mark.asyncio 26 @pytest.mark.with_interventions 27 async def test_enabled(client): 28 await visit_site(client, client.css(UNBLOCKED_CSS)) 29 assert not client.find_text(BLOCKED_TEXT, is_displayed=True) 30 31 32 @pytest.mark.asyncio 33 @pytest.mark.without_interventions 34 async def test_disabled(client): 35 await visit_site(client, client.text(BLOCKED_TEXT)) 36 assert not client.find_css(UNBLOCKED_CSS, is_displayed=True)