tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_1924441_contractorinduction_colesgroup_com_au.py (1153B)


      1 import pytest
      2 
      3 URL = "https://contractorinduction.colesgroup.com.au/"
      4 
      5 CAPTCHA_CSS = "iframe[src*='Incapsula_Resource']"
      6 SUPPORTED_CSS = "#EmailAddress"
      7 UNSUPPORTED_TEXT = "we do not support your current browser"
      8 
      9 
     10 async def visit_site(client):
     11    await client.navigate(URL, wait="none")
     12    _, _, vpn = client.await_first_element_of(
     13        [
     14            client.css(SUPPORTED_CSS),
     15            client.text(UNSUPPORTED_TEXT),
     16            client.css(CAPTCHA_CSS),
     17        ],
     18        is_displayed=True,
     19    )
     20    if vpn:
     21        pytest.skip("Region-locked, cannot test. Try using a VPN set to Australia.")
     22 
     23 
     24 @pytest.mark.asyncio
     25 @pytest.mark.with_interventions
     26 async def test_enabled(client):
     27    await visit_site(client)
     28    assert client.await_css(SUPPORTED_CSS, is_displayed=True)
     29    assert not client.find_text(UNSUPPORTED_TEXT)
     30 
     31 
     32 @pytest.mark.skip_platforms("android")  # currently works on Android; see bz1924441#c7
     33 @pytest.mark.asyncio
     34 @pytest.mark.without_interventions
     35 async def test_disabled(client):
     36    await visit_site(client)
     37    assert client.await_text(UNSUPPORTED_TEXT, is_displayed=True)
     38    assert not client.find_css(SUPPORTED_CSS)