tor-browser

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

test_1855014_77221_eksiseyler_com.py (1380B)


      1 import pytest
      2 from webdriver.error import NoSuchElementException
      3 
      4 URL = "https://eksiseyler.com/evrimin-kisa-surede-de-yasanabilecegini-kanitlayan-1971-hirvatistan-kertenkele-deneyi"
      5 CAPTCHA_TEXT = "Verifying you are human"
      6 IMAGE_CSS = ".content-heading .cover-img img"
      7 ERROR_MSG = "loggingEnabled is not defined"
      8 INFINITE_CAPTCHA_MSG = (
      9    "Seem to be stuck in an infinite Captcha; please test this page manually."
     10 )
     11 
     12 
     13 async def visit_site(client):
     14    await client.navigate(URL)
     15    try:
     16        # Unfortunately, the site tends to show an infinitely-repeating non-interactive Cloudflare Captcha now.
     17        client.await_text(CAPTCHA_TEXT, is_displayed=True, timeout=4)
     18        pytest.skip(INFINITE_CAPTCHA_MSG)
     19        return False
     20    except NoSuchElementException:
     21        return True
     22 
     23 
     24 @pytest.mark.only_platforms("android")
     25 @pytest.mark.asyncio
     26 @pytest.mark.with_interventions
     27 async def test_enabled(client):
     28    if await visit_site(client):
     29        client.await_css(IMAGE_CSS, condition="!elem.src.includes('placeholder')")
     30 
     31 
     32 @pytest.mark.only_platforms("android")
     33 @pytest.mark.asyncio
     34 @pytest.mark.without_interventions
     35 async def test_disabled(client):
     36    console_msg = await client.promise_console_message_listener(ERROR_MSG)
     37    if await visit_site(client):
     38        await console_msg
     39        client.await_css(IMAGE_CSS, condition="elem.src.includes('placeholder')")